/**
 * Merge Documents Page Styles
 * Extracted from resources/views/filament/documents/pages/merge-documents.blade.php
 */

.merge-root {
    position: relative;
}

.merge-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 4px;
}

.merge-title {
    font-size: 30px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.02em;
}

.dark .merge-title {
    color: #ffffff;
}

.merge-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.merge-estimate {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.dark .merge-estimate {
    color: #9ca3af;
}

.merge-estimate strong {
    color: #111827;
    font-weight: 700;
    margin-left: 6px;
}

.dark .merge-estimate strong {
    color: #ffffff;
}

.merge-estimate-icon {
    width: 18px;
    height: 18px;
    color: #111827;
}

.dark .merge-estimate-icon {
    color: #ffffff;
}

.merge-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    background: #2b0a3d;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .05s ease, opacity .15s ease;
    white-space: nowrap;
}

.merge-btn-primary:active {
    transform: translateY(1px);
}

.merge-btn-primary:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.merge-btn-primary svg {
    width: 18px;
    height: 18px;
}

.merge-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 26px;
    padding: 18px 0 24px;
}

@media (max-width: 1200px) {
    .merge-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .merge-grid {
        grid-template-columns: 1fr;
    }

    .merge-estimate {
        display: none;
    }
}

.thumb-card {
    position: relative;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    padding: 16px;
    cursor: pointer;
    transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}

.thumb-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: #d1d5db;
}

.dark .thumb-card {
    background: #111827;
    border-color: #374151;
}

.dark .thumb-card:hover {
    border-color: #4b5563;
}

.thumb-card.is-selected {
    border-color: rgba(59, 130, 246, 0.8);
    box-shadow: 0 8px 22px rgba(59, 130, 246, 0.14);
}

.thumb-frame {
    position: relative;
    height: 390px;
    border-radius: 10px;
    overflow: hidden;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.dark .thumb-frame {
    background: #0b1220;
    border-color: #374151;
}

.thumb-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
}

.thumb-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 9999px;
    font-size: 11px;
    background: rgba(17, 24, 39, 0.82);
    color: #ffffff;
}

.thumb-caption {
    margin-top: 10px;
    text-align: center;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .thumb-caption {
    color: #9ca3af;
}

.thumb-check {
    position: absolute;
    right: 12px;
    top: 12px;
    z-index: 6;
    width: 34px;
    height: 34px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(229, 231, 235, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark .thumb-check {
    background: rgba(17, 24, 39, 0.92);
    border-color: #374151;
}

.thumb-check.is-selected {
    background: #2b0a3d;
    border-color: #2b0a3d;
}

.thumb-check svg {
    width: 18px;
    height: 18px;
    color: #ffffff;
}

.floating-left {
    position: fixed;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
}

.floating-right {
    position: fixed;
    right: 26px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fab {
    width: 44px;
    height: 44px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(229, 231, 235, 0.9);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .05s ease;
}

.dark .fab {
    background: rgba(17, 24, 39, 0.92);
    border-color: #374151;
}

.fab:active {
    transform: translateY(1px);
}

.fab svg {
    width: 20px;
    height: 20px;
    color: #111827;
}

.dark .fab svg {
    color: #ffffff;
}

/* Cards de documentos */
.doc-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
    background: white;
}

.dark .doc-card {
    background: #1f2937;
    border-color: #374151;
}

.doc-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .doc-card:hover {
    border-color: #4b5563;
}

.doc-card.selected {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2);
}

.dark .doc-card.selected {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
}

/* Checkbox */
.doc-checkbox {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
}

/* Número de orden */
.doc-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    background: #e5e7eb;
    color: #4b5563;
}

.dark .doc-number {
    background: #374151;
    color: #9ca3af;
}

.selected .doc-number {
    background: #3b82f6;
    color: white;
}

/* Icono de documento */
.doc-icon-wrapper {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #fee2e2;
}

.dark .doc-icon-wrapper {
    background: rgba(220, 38, 38, 0.2);
}

.doc-icon {
    width: 16px;
    height: 16px;
    color: #dc2626;
}

.dark .doc-icon {
    color: #f87171;
}

/* Información del documento */
.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .doc-name {
    color: white;
}

.doc-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 500;
    border-radius: 4px;
    background: #f3f4f6;
    color: #374151;
    text-transform: uppercase;
    margin-left: 8px;
}

.dark .doc-badge {
    background: #374151;
    color: #d1d5db;
}

/* Metadata */
.doc-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #6b7280;
}

.dark .doc-meta {
    color: #9ca3af;
}

.doc-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.doc-meta-icon {
    width: 12px;
    height: 12px;
}

/* Estado de selección */
.doc-check-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #3b82f6;
}

.doc-check-icon svg {
    width: 12px;
    height: 12px;
    color: white;
}

.doc-unchecked {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
}

.dark .doc-unchecked {
    border-color: #4b5563;
}

.doc-card:hover .doc-unchecked {
    border-color: #9ca3af;
}

/* Header badges */
.count-badge {
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 9999px;
    background: #dbeafe;
    color: #1e40af;
}

.dark .count-badge {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

/* Botones */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Spinner */
.spinner {
    animation: spin 1s linear infinite;
    width: 16px;
    height: 16px;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Success badge */
.success-badge {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #d1fae5;
}

.dark .success-badge {
    background: rgba(16, 185, 129, 0.2);
}

.success-badge svg {
    width: 20px;
    height: 20px;
    color: #059669;
}

.dark .success-badge svg {
    color: #34d399;
}

/* Alert boxes */
.alert-success {
    padding: 16px;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    color: #065f46;
}

.dark .alert-success {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.alert-info {
    padding: 12px;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    margin-top: 16px;
}

.dark .alert-info {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
}

.alert-info-text {
    font-size: 12px;
    color: #1e40af;
}

.dark .alert-info-text {
    color: #93c5fd;
}

/* Preview container */
.preview-container {
    margin-top: 24px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .preview-container {
    background: #111827;
    border-color: #374151;
}

.preview-header {
    padding: 12px 16px;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dark .preview-header {
    background: #1f2937;
    border-color: #374151;
}

.preview-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.dark .preview-title {
    color: white;
}

/* Spacing utilities */
.space-y-2>*+* {
    margin-top: 8px;
}

.space-y-4>*+* {
    margin-top: 16px;
}

.space-y-6>*+* {
    margin-top: 24px;
}

.mt-4 {
    margin-top: 16px;
}

.mb-1 {
    margin-bottom: 4px;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

/* MERGE FORM STYLES */
.merge-card {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.dark .merge-card {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.merge-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 20px;
}

.dark .merge-section-title {
    color: #f3f4f6;
}

.merge-form-group {
    margin-bottom: 20px;
}

.merge-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.dark .merge-form-label {
    color: #e5e7eb;
}

.merge-required {
    color: #dc2626;
    margin-left: 2px;
}

.merge-form-input {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background-color: #fff;
    color: #111827;
    padding: 10px 12px;
    padding-right: 32px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: none;
    transition: border-color 0.15s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

.dark .merge-form-input {
    border-color: rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

.merge-form-input:focus {
    outline: none;
    border-color: #d1d5db;
}

/* Metadata Grid - Merge Documents */
.metadata-grid-merge {
    display: flex;
    align-items: flex-start;
    gap: 40px;
}

.metadata-file-col {
    flex: 0 0 300px;
}

.metadata-info-col {
    flex: 1;
    display: flex;
    gap: 60px;
}

.metadata-item h4 {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.dark .metadata-item h4 {
    color: #e5e7eb;
}

.metadata-item p {
    font-size: 14px;
    color: #6b7280;
}

.loading-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.dark .loading-title {
    color: #e5e7eb;
}

@media (max-width: 768px) {
    .metadata-grid-merge {
        flex-direction: column;
        gap: 24px;
    }

    .metadata-file-col,
    .metadata-info-col {
        width: 100%;
        flex: none;
    }

    .metadata-info-col {
        flex-direction: column;
        gap: 16px;
    }
}

/* View Details Button */
.view-details-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #4b5563;
    transition: all 0.2s;
    z-index: 20;
}

.view-details-btn:hover {
    background: #fff;
    color: #2563eb;
    transform: scale(1.1);
}

/* Section Header Title */
.section-header-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
}

/* Success Banner */
.success-banner {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.dark .success-banner {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.success-title {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}

.dark .success-title {
    color: #ffffff;
}

.success-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-top: 2px;
}

.dark .success-subtitle {
    color: #9ca3af;
}

/* Mobile Responsiveness for Success Banner */
@media (max-width: 640px) {
    .success-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .success-banner>div {
        width: 100%;
        justify-content: space-between;
    }

    .success-banner .success-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .success-banner a,
    .success-banner button {
        flex: 1;
        justify-content: center;
    }
}

/* Card Header Responsiveness */
.card-header-responsive {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

@media (max-width: 640px) {
    .card-header-responsive {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .card-header-responsive h3 {
        font-size: 15px;
        line-height: 1.4;
        word-break: break-word;
    }

    .card-header-responsive span {
        align-self: flex-start;
    }
}

/* Mobile Responsive Tables */
@media (max-width: 640px) {
    .dynamic-data-key {
        width: 40%;
        padding: 0.5rem;
        font-size: 0.7rem;
        white-space: normal;
    }

    .dynamic-data-value {
        width: 60%;
        padding: 0.5rem;
        font-size: 0.8rem;
        word-break: break-word;
    }

    .merge-card {
        padding: 16px;
    }
}