/**
 * PDF Modal Styles - Respiracción
 * 
 * Modal fullscreen para visualizar PDFs interactivos
 */

/* ===== PDF MODAL BUTTON (usando boton-perfecto style) ===== */
.pdf-modal-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: #E1C9A6;
    border: 2px solid #C8A87E;
    color: #2A3D4F;
    border-radius: 25px;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease-in-out, border-color 0.3s ease-in-out, color 0.3s ease-in-out;
    box-shadow: none;
    text-decoration: none;
    text-align: center;
}

.pdf-modal-trigger:hover {
    background: #C8A87E;
    border-color: #79afd2;
    color: #ffffff;
}

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

.pdf-modal-trigger__icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-modal-trigger__icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ===== PDF MODAL CONTAINER ===== */
.pdf-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
}

.pdf-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.pdf-modal-content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    background: #ffffff;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.pdf-modal-overlay.active .pdf-modal-content {
    transform: scale(1);
}

/* ===== PDF MODAL HEADER ===== */
.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: linear-gradient(135deg, #295a99 0%, #075985 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    position: relative;
    z-index: 20;
}

.pdf-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.pdf-modal-title__text {
    color: #ffffff !important;
}

.pdf-modal-title__icon {
    width: 32px;
    height: 32px;
    display: block;
}

.pdf-modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Generic modal button styles */
.pdf-modal-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 10px 16px !important;
    background: #E1C9A6 !important;
    border: 2px solid #C8A87E !important;
    color: #2A3D4F !important;
    border-radius: 25px !important;
    font-family: 'Montserrat', sans-serif !important;
    font-size: 14px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
    text-decoration: none !important;
    box-shadow: none !important;
    white-space: nowrap !important;
    line-height: 1 !important;
}

.pdf-modal-btn:hover {
    background: #C8A87E !important;
    border-color: #79afd2 !important;
    color: #ffffff !important;
}

.pdf-modal-btn svg {
    stroke: currentColor !important;
    width: 16px !important;
    height: 16px !important;
}

/* HIDE PRINT BY DEFAULT - Toggle via JS class */
.pdf-modal-btn--print {
    display: none !important;
}

.pdf-modal-btn--print.show-print {
    display: flex !important;
}

/* Close button - distinct style */
.pdf-modal-btn--close {
    padding: 10px 14px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
}

.pdf-modal-btn--close:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: white !important;
}

/* ===== DOWNLOAD DROPDOWN AREA ===== */
.pdf-modal-download-wrapper {
    position: relative;
    display: inline-block;
}

/* Always show dropdown arrow indicator */
.pdf-modal-download-wrapper .pdf-modal-btn--download {
    padding-right: 12px !important;
}

.pdf-modal-download-wrapper .pdf-modal-btn--download::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    margin-left: 6px;
    opacity: 0.7;
}

/* The actual dropdown menu */
.pdf-modal-download-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 12px;
    width: max-content;
    /* Fit content text */
    min-width: 250px;
    max-width: 320px;
    background: #ffffff;
    border-radius: 8px;
    /* Slightly rounded, not pills */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.pdf-modal-download-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown option buttons - CLEAN STYLE */
.pdf-modal-dropdown-option {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    padding: 14px 16px !important;
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    background: #ffffff !important;
    /* Force white background */
    color: #334155 !important;
    /* Dark slate text */
    font-family: 'Montserrat', sans-serif !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-align: left !important;
    cursor: pointer !important;
    border-radius: 0 !important;
    /* No rounded corners for list items */
    transition: background 0.1s !important;
    box-shadow: none !important;
}

.pdf-modal-dropdown-option:last-child {
    border-bottom: none !important;
}

.pdf-modal-dropdown-option:hover {
    background: #f8fafc !important;
    color: #0f172a !important;
}

.pdf-modal-dropdown-option svg {
    color: #64748b;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.pdf-modal-dropdown-option:hover svg {
    color: #3b82f6;
}

/* Highlight 'Complete' version slightly */
.pdf-modal-dropdown-option[data-version="complete"] {
    background: #fbfbfc !important;
}

.pdf-modal-dropdown-option[data-version="complete"] svg {
    color: #3b82f6;
    fill: none;
}

/* ===== PDF MODAL BODY ===== */
.pdf-modal-body {
    flex: 1;
    overflow: auto;
    background: #f3f4f6;
    -webkit-overflow-scrolling: touch;
    z-index: 10;
    position: relative;
}

.pdf-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ===== SPINNER ANIMATION ===== */
@keyframes pdf-modal-spin {
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: pdf-modal-spin 1s linear infinite;
    transform-origin: center;
}

/* ===== LOADING STATE ===== */
.pdf-modal-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    z-index: 10;
}

.pdf-modal-loading__spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #3A97D4;
    border-radius: 50%;
    animation: pdf-modal-spin 0.8s linear infinite;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .pdf-modal-header {
        padding: 10px 16px;
    }

    .pdf-modal-title {
        font-size: 14px;
    }

    .pdf-modal-title__icon {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }

    .pdf-modal-btn {
        padding: 6px 12px !important;
        font-size: 12px !important;
    }

    .pdf-modal-trigger {
        width: 100%;
        justify-content: center;
        padding: 16px 20px;
    }

    .pdf-modal-download-dropdown {
        right: -50px;
        /* Shift slightly on mobile */
    }
}

/* Dark Mode Overrides */
@media (prefers-color-scheme: dark) {
    .pdf-modal-body {
        background: #1e293b;
    }

    .pdf-modal-download-dropdown {
        background: #1e293b;
        border-color: #334155;
    }

    .pdf-modal-dropdown-option {
        background: #1e293b !important;
        color: #e2e8f0 !important;
        border-bottom-color: #334155 !important;
    }

    .pdf-modal-dropdown-option:hover {
        background: #334155 !important;
    }
}