/* =================================================================
   MODAL PROFESIONAL PARA PDFs - FUNDECIMA
   ================================================================= */

/* Overlay oscuro */
.pdf-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: pdfModalFadeIn 0.3s ease;
}

@keyframes pdfModalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Contenedor del Modal */
.pdf-modal {
    background: var(--lm-white, #ffffff);
    border-radius: var(--lm-radius-lg, 16px);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.pdf-modal-show {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Estado Maximizado */
.pdf-modal-maximized {
    max-width: 100%;
    width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    height: calc(100vh - 40px);
    border-radius: var(--lm-radius-md, 12px);
}

/* Header del Modal */
.pdf-modal-header {
    background: var(--lm-gradient-primary, linear-gradient(135deg, #1e3a8a 0%, #059669 100%));
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-shrink: 0;
    border-bottom: 3px solid rgba(255, 255, 255, 0.1);
}

.pdf-modal-title-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
}

.pdf-modal-icon {
    font-size: 1.8rem;
    color: var(--lm-white, #ffffff);
    flex-shrink: 0;
    animation: pdfIconPulse 2s ease-in-out infinite;
}

@keyframes pdfIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.pdf-modal-title-info {
    flex: 1;
    min-width: 0;
}

.pdf-modal-title-info h3 {
    color: var(--lm-white, #ffffff);
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-modal-subtitle {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 2px;
}

/* Botones del Header */
.pdf-modal-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.pdf-modal-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    color: var(--lm-white, #ffffff);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--lm-transition-fast, 0.2s ease);
    font-size: 0.95rem;
    padding: 0;
}

.pdf-modal-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.pdf-modal-btn:active {
    transform: translateY(0);
}

.pdf-modal-btn-close:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.pdf-modal-btn-download:hover {
    background: var(--lm-green-primary, #059669);
    border-color: var(--lm-green-primary, #059669);
}

.pdf-modal-btn-maximize:hover {
    background: var(--lm-blue-light, #3b82f6);
    border-color: var(--lm-blue-light, #3b82f6);
}

/* Barra de progreso decorativa */
.pdf-modal-progress-bar {
    height: 3px;
    background: var(--lm-gray-200, #e9ecef);
    flex-shrink: 0;
    overflow: hidden;
}

.pdf-modal-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--lm-gradient-primary, linear-gradient(135deg, #1e3a8a 0%, #059669 100%));
    animation: pdfProgress 1.5s ease forwards;
}

@keyframes pdfProgress {
    to {
        width: 100%;
    }
}

/* Cuerpo del Modal */
.pdf-modal-body {
    flex: 1;
    position: relative;
    background: var(--lm-gray-100, #f5f7fa);
    overflow: hidden;
    min-height: 500px;
}

.pdf-modal-body iframe {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pdf-modal-maximized .pdf-modal-body iframe {
    min-height: calc(100vh - 250px);
}

/* Loading Spinner */
.pdf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 10;
}

.pdf-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--lm-gray-200, #e9ecef);
    border-top-color: var(--lm-blue-primary, #1e3a8a);
    border-radius: 50%;
    animation: pdfSpin 0.8s linear infinite;
}

@keyframes pdfSpin {
    to {
        transform: rotate(360deg);
    }
}

.pdf-loading p {
    color: var(--lm-gray-700, #495057);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Footer del Modal */
.pdf-modal-footer {
    background: var(--lm-gray-50, #fafafa);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--lm-gray-200, #e9ecef);
    flex-shrink: 0;
}

.pdf-modal-footer-info {
    display: flex;
    gap: 20px;
    font-size: 0.8rem;
    color: var(--lm-gray-700, #495057);
}

.pdf-modal-footer-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pdf-modal-footer-info i {
    color: var(--lm-green-primary, #059669);
}

.pdf-footer-btn {
    background: var(--lm-gradient-primary, linear-gradient(135deg, #1e3a8a 0%, #059669 100%));
    color: var(--lm-white, #ffffff);
    border: none;
    padding: 8px 20px;
    border-radius: var(--lm-radius-full, 50px);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--lm-transition-normal, 0.3s ease);
    font-family: var(--lm-font-primary, 'Poppins', sans-serif);
}

.pdf-footer-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--lm-shadow-md, 0 4px 16px rgba(30, 58, 138, 0.12));
}

/* Indicador de visualización en tarjetas */
.tarjeta-view-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: var(--acc, #4f46e5);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tarjeta-documento:hover .tarjeta-view-indicator {
    opacity: 1;
    transform: scale(1);
}

.tarjeta-view-indicator i {
    font-size: 0.8rem;
}

/* =================================================================
   RESPONSIVE
   ================================================================= */

@media (max-width: 768px) {
    .pdf-modal {
        max-width: 100%;
        max-height: 95vh;
    }

    .pdf-modal-header {
        padding: 14px 16px;
        flex-wrap: wrap;
    }

    .pdf-modal-title-info h3 {
        font-size: 0.95rem;
    }

    .pdf-modal-btn {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }

    .pdf-modal-footer {
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
    }

    .pdf-modal-footer-info {
        flex-direction: column;
        gap: 6px;
        font-size: 0.75rem;
    }

    .pdf-modal-body {
        min-height: 400px;
    }

    .pdf-modal-body iframe {
        min-height: 400px;
    }

    .tarjeta-view-indicator {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 480px) {
    .pdf-modal-overlay {
        padding: 10px;
    }

    .pdf-modal-maximized {
        width: calc(100vw - 20px);
        height: calc(100vh - 20px);
    }

    .pdf-modal-subtitle {
        display: none;
    }
}

/* =================================================================
   ACCESIBILIDAD - Reducir movimiento
   ================================================================= */
@media (prefers-reduced-motion: reduce) {
    .pdf-modal,
    .pdf-modal-btn,
    .tarjeta-view-indicator {
        transition: none;
    }

    .pdf-modal-icon,
    .pdf-loading-spinner {
        animation: none;
    }

    .pdf-modal-progress-fill {
        animation: none;
        width: 100%;
    }
}