/* ============================================
   MODAL VIEWERS - PDF & IMAGE GALLERY
   Visualizadores responsivos para mobile e desktop
   ============================================ */

/* ============================================
   MODAL BASE
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 32px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   PDF VIEWER
   ============================================ */

.pdf-viewer-container {
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.pdf-viewer-header {
    background: #2d3748;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pdf-viewer-title {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pdf-viewer-actions {
    display: flex;
    gap: 10px;
}

.pdf-viewer-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.pdf-viewer-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.pdf-viewer-iframe {
    width: 100%;
    height: calc(100% - 60px);
    border: none;
}

/* ============================================
   IMAGE GALLERY
   ============================================ */

.image-gallery-container {
    position: relative;
    width: 90%;
    max-width: 1400px;
    height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-main-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.gallery-main-image.zoomed {
    cursor: zoom-out;
    transform: scale(1.5);
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 32px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.gallery-nav.prev {
    left: 20px;
}

.gallery-nav.next {
    right: 20px;
}

.gallery-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gallery-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
}

.gallery-thumbnails {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    max-width: 90%;
    overflow-x: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

.gallery-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
    border: 2px solid transparent;
}

.gallery-thumbnail:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.gallery-thumbnail.active {
    opacity: 1;
    border-color: white;
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 768px) {
    .pdf-viewer-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .pdf-viewer-header {
        padding: 12px 15px;
    }

    .pdf-viewer-title {
        font-size: 14px;
    }

    .pdf-viewer-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .modal-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .image-gallery-container {
        width: 100%;
        height: 100vh;
    }

    .gallery-main-image {
        max-height: 70vh;
    }

    .gallery-nav {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .gallery-nav.prev {
        left: 10px;
    }

    .gallery-nav.next {
        right: 10px;
    }

    .gallery-thumbnails {
        bottom: 60px;
        padding: 8px;
    }

    .gallery-thumbnail {
        width: 60px;
        height: 60px;
    }

    .gallery-counter {
        bottom: 15px;
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* ============================================
   TOUCH GESTURES (Mobile)
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    .gallery-main-image {
        touch-action: pan-x pan-y pinch-zoom;
    }
}

/* ============================================
   LOADING STATE
   ============================================ */

.viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    text-align: center;
}

.viewer-loading::after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 20px auto 0;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}