.media-lightbox {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    z-index: 2147483647 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.media-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-overlay {
    position: absolute !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.lightbox-container {
    position: relative;
    width: 98vw;
    height: 98dvh;
    z-index: 1;
}

.lightbox-media-container {
    width: 100%;
    height: calc(100dvh - 170px);
    max-height: 88dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-media {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.lightbox-close,
.lightbox-nav-btn {
    width: 50px;
    height: 50px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    backdrop-filter: blur(8px);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 20px;
    z-index: 2;
}

.lightbox-counter,
.lightbox-info,
.lightbox-navigation,
.lightbox-thumbnails {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.lightbox-counter {
    top: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.lightbox-navigation {
    top: 50%;
    width: 100%;
    padding: 0 20px;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.lightbox-nav-btn {
    font-size: 24px;
    pointer-events: auto;
}

.lightbox-close:hover,
.lightbox-nav-btn:hover {
    background: rgba(255, 255, 255, 0.32);
    border-color: rgba(255, 255, 255, 0.55);
    transform: scale(1.08);
}

.lightbox-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.lightbox-info {
    bottom: 120px;
    width: min(80vw, 720px);
    text-align: center;
    color: #fff;
}

.lightbox-info h3 {
    margin: 0 0 5px;
    font-size: 20px;
    font-weight: 600;
}

.lightbox-info p {
    margin: 0;
    opacity: 0.8;
    font-size: 14px;
}

.lightbox-thumbnails {
    bottom: 20px;
    display: flex;
    gap: 10px;
    max-width: 90%;
    padding: 10px;
    overflow-x: auto;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
}

.lightbox-thumbnail {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    padding: 0;
    position: relative;
}

.lightbox-thumbnail-image {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    object-fit: cover;
}

.lightbox-thumbnail:hover,
.lightbox-thumbnail.active {
    transform: scale(1.08);
    border-color: var(--tema-primario, #1e90ff);
}

.lightbox-thumbnail-video {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    background: linear-gradient(135deg, rgba(10, 20, 40, 0.95), rgba(30, 50, 80, 0.95));
}

.lightbox-thumbnail-video .video-mini-badge {
    position: absolute;
    bottom: 3px;
    right: 4px;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.lightbox-loading {
    color: #fff;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--tema-primario, #1e90ff);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@media (max-width: 768px) {
    .lightbox-container {
        width: 99vw;
        height: 99dvh;
    }

    .lightbox-close,
    .lightbox-nav-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }

    .lightbox-counter {
        font-size: 12px;
        padding: 6px 12px;
    }

    .lightbox-info {
        bottom: 105px;
    }

    .lightbox-info h3 {
        font-size: 16px;
    }

    .lightbox-info p {
        font-size: 12px;
    }

    .lightbox-thumbnail {
        width: 50px;
        height: 50px;
    }

    .lightbox-media-container {
        height: calc(100dvh - 190px);
        max-height: 82dvh;
    }
}

.lightbox-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.lightbox-thumbnails::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35);
}
