/**
 * OrangeFiles - Modals Styles
 */
body.viewer-active .navbar {
    display: none !important;
}

body.viewer-active {
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    /* Solid Blackout v29.0 */
    backdrop-filter: none;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    overflow: hidden;
}

.lightbox-blur-bg {
    position: absolute;
    top: -50px;
    left: -50px;
    right: -50px;
    bottom: -50px;
    width: calc(100% + 100px);
    height: calc(100% + 100px);
    object-fit: cover;
    filter: blur(30px) brightness(0.6);
    opacity: 0.6;
    z-index: 0;
    pointer-events: none;
    user-select: none;
    transform: scale(1.1);
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    /* Changed from hidden to prevent clipping during pan (v32.1) */
    padding: 0;
    /* Full screen edge-to-edge */
    box-sizing: border-box;
}

.lightbox-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
    cursor: default;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
    user-select: none;
    -webkit-user-drag: none;
    z-index: 2;
    position: relative;
    /* Smooth transitions for zoom/rotate */
    will-change: transform;
    transform-origin: center center;
    /* Explicitly set origin */
}

.lightbox-caption {
    position: absolute;
    bottom: 110px;
    /* Floating above the controls */
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    backdrop-filter: blur(8px);
    z-index: 10;
    pointer-events: none;
    max-width: 90%;
    text-align: center;
    opacity: 0.8;
}

/* v32.0: Removed object-fit:none to prevent jumping. Transform scale handles the size. */
.lightbox.zoomed .lightbox-image {
    cursor: grab;
    /* max-width/height none removed to keep it consistent with 'contain' */
}

.lightbox.panning .lightbox-image {
    cursor: grabbing;
    transition: none;
    /* Instant feedback while panning */
}

.lightbox-close {
    position: fixed;
    top: 30px;
    right: 30px;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 2.2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lightbox-close:hover {
    transform: rotate(90deg) scale(1.1);
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.4);
}

.lightbox-controls {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    background: rgba(15, 23, 42, 0.5);
    padding: 12px 28px;
    border-radius: 100px;
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 2005;
    align-items: center;
    color: white;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 50px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 2000;
    transition: all 0.3s ease;
    border-radius: 20px;
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

.nav-btn:hover {
    background: rgba(15, 23, 42, 0.6);
    width: 60px;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Lightbox Loading Spinner */
.lightbox.lightbox-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -20px 0 0 -20px;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #FF512F;
    border-radius: 50%;
    animation: lightbox-spin 0.7s linear infinite;
    z-index: 5;
    pointer-events: none;
}

@keyframes lightbox-spin {
    to { transform: rotate(360deg); }
}

/* Lightbox image transition for smooth loading */
.lightbox-image {
    transition: opacity 0.25s ease;
}

/* Mobile nav buttons (bigger touch targets) */
@media (max-width: 768px) {
    .nav-btn {
        width: 44px;
        height: 70px;
        font-size: 1.5rem;
        border-radius: 16px;
    }

    .prev-btn {
        left: 8px;
    }

    .next-btn {
        right: 8px;
    }
}

/* UI Hiding Logic (v24.0) */
.lightbox.ui-hidden .lightbox-close,
.lightbox.ui-hidden .lightbox-controls,
.lightbox.ui-hidden .lightbox-caption,
.lightbox.ui-hidden .nav-btn {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 20px);
    /* For bottom elements */
}

.lightbox.ui-hidden .lightbox-close {
    transform: translate(20px, -20px);
}

.lightbox.ui-hidden .nav-btn.prev-btn {
    transform: translate(-20px, -50%);
}

.lightbox.ui-hidden .nav-btn.next-btn {
    transform: translate(20px, -50%);
}

.zoom-level {
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

.lightbox-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lightbox-btn:hover {
    transform: scale(1.2);
}

/* HTML5 Modals (Video/Audio/Doc) */
.video-modal,
.audio-modal,
.doc-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 1);
    /* Pure black for immersive video */
    backdrop-filter: blur(15px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 0;
    /* Full screen edge-to-edge */
    box-sizing: border-box;
}

.video-modal.active,
.audio-modal.active,
.doc-modal.active {
    display: flex;
}

.video-modal-close,
.doc-modal-close {
    position: fixed;
    top: 25px;
    right: 25px;
    background: rgba(0, 0, 0, 0.3);
    /* Consistently darker close for contrast */
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 2.2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 3100;
}

.video-modal-close:hover,
.doc-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
}

.video-modal-content {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.video-modal video {
    width: 100%;
    max-height: 100%;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.audio-player-card {
    background: white;
    padding: 40px;
    border-radius: 30px;
    width: 350px;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.audio-icon-large {
    font-size: 4rem;
    color: #FF512F;
    margin-bottom: 20px;
}

/* SweetAlert Mobile Responsiveness */
/* SweetAlert Luxury Compact Popup v13.0 */
.swal2-popup {
    width: 300px !important;
    padding: 20px 15px !important;
    border-radius: 24px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2) !important;
    box-sizing: border-box !important;
}

.swal2-icon {
    transform: scale(0.7) !important;
    margin: 10px auto -5px auto !important;
    border-width: 3px !important;
}

.swal2-title {
    font-size: 1.15rem !important;
    font-weight: 800 !important;
    color: #1e293b !important;
    margin: 10px 0 5px 0 !important;
    padding: 0 !important;
}

.swal2-html-container {
    font-size: 0.85rem !important;
    color: #64748b !important;
    margin: 5px 0 15px 0 !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
}

.swal2-actions {
    margin-top: 5px !important;
}

.swal2-confirm {
    background: linear-gradient(135deg, #FF512F 0%, #DD2476 100%) !important;
    font-weight: 800 !important;
    border-radius: 12px !important;
    font-size: 0.85rem !important;
    padding: 10px 30px !important;
    box-shadow: 0 4px 12px rgba(255, 81, 47, 0.2) !important;
    min-width: 100px;
}

.swal2-cancel {
    background: #f1f5f9 !important;
    color: #64748b !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    font-size: 0.8rem !important;
    padding: 10px 20px !important;
}

@media (max-width: 480px) {
    .swal2-popup {
        width: 290px !important;
        padding: 18px 12px !important;
    }
}

/* Locked Account Overlay */
.locked-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(15px);
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.4s ease;
}

.locked-card {
    background: rgba(255, 255, 255, 0.85);
    /* Semi-transparent */
    backdrop-filter: blur(12px);
    padding: 45px 35px;
    border-radius: 35px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.6);
    animation: lockedPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.locked-icon {
    font-size: 3.5rem;
    margin-bottom: 25px;
    display: inline-block;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.locked-card h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 12px 0;
    letter-spacing: -0.5px;
}

.locked-card p {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 30px;
    font-weight: 500;
}

.reactivate-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #FF512F 0%, #DD2476 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(255, 81, 47, 0.2);
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.reactivate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(255, 81, 47, 0.3);
}

.btn-logout-locked {
    display: inline-block;
    padding: 12px 25px;
    background: #f1f5f9;
    color: #64748b;
    text-decoration: none;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.2s;
    margin-top: 15px;
}

.btn-logout-locked:hover {
    background: #e2e8f0;
    color: #1e293b;
}

@keyframes lockedPop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .locked-card {
        padding: 35px 25px;
    }

    .locked-card h2 {
        font-size: 1.5rem;
    }
}

/* Ensure SweetAlert2 is always on top of the locked overlay */
.swal2-container {
    z-index: 100000 !important;
}