/* ==========================================================================
   Kwiscat Photo - Visionneuse d'images Lightbox
   Légère, autonome (Vanilla JS), responsive, support tactile et zoom
   ========================================================================== */

.kw-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
}

.kw-lightbox-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* Lightbox Topbar */
.kw-lightbox-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    color: #cccccc;
    font-size: 0.95rem;
    z-index: 10;
}

.kw-lightbox-counter {
    font-weight: 500;
    letter-spacing: 1px;
}

.kw-lightbox-title {
    color: #ffffff;
    font-weight: 600;
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.kw-lightbox-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.kw-lightbox-btn {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.kw-lightbox-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.kw-lightbox-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Main Viewing Area */
.kw-lightbox-content {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0 1rem 1rem;
}

.kw-lightbox-img-wrapper {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease-out;
}

.kw-lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    object-fit: contain;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.8);
    transition: opacity 0.2s ease;
}

.kw-lightbox-image.is-loading {
    opacity: 0.3;
}

/* Navigation Arrows */
.kw-lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    z-index: 20;
}

.kw-lightbox-arrow:hover {
    background: rgba(50, 50, 50, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.kw-lightbox-arrow svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.kw-lightbox-arrow.arrow-prev {
    left: 1.5rem;
}

.kw-lightbox-arrow.arrow-next {
    right: 1.5rem;
}

/* Spinner */
.kw-lightbox-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: kw-spin 0.8s linear infinite;
    display: none;
}

.kw-lightbox-spinner.is-active {
    display: block;
}

@keyframes kw-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (max-width: 768px) {
    .kw-lightbox-arrow {
        width: 40px;
        height: 40px;
    }
    .kw-lightbox-arrow.arrow-prev {
        left: 0.5rem;
    }
    .kw-lightbox-arrow.arrow-next {
        right: 0.5rem;
    }
    .kw-lightbox-topbar {
        padding: 0.75rem 1rem;
    }
    .kw-lightbox-title {
        display: none;
    }
}
