/**
 * Gallery Second - Modern Lightbox Styles (Light Theme)
 */

/* ===================================
   Lightbox Container
   =================================== */
.gs-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gs-lightbox.active {
    display: flex;
}

/* Light blurred backdrop — original style */
.gs-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: gs-fade-in 0.3s ease;
}

@keyframes gs-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===================================
   Close Button
   =================================== */
.gs-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    z-index: 20;
    background: none;
    border: none;
    color: #1e293b;
    font-size: 2.5rem;
    cursor: pointer;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.25s ease;
    line-height: 1;
}

.gs-lightbox-close:hover {
    color: #0067C1;
    transform: scale(1.1) rotate(90deg);
}

/* ===================================
   Category Tabs Bar
   =================================== */
.gs-category-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 15;
    padding: 1.2rem 4rem;
    display: flex;
    justify-content: center;
}

.gs-category-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 100px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.gs-category-tabs::-webkit-scrollbar {
    display: none;
}

.gs-tab {
    background: transparent;
    border: 1px solid transparent;
    color: #64748b;
    padding: 0.55rem 1.4rem;
    border-radius: 100px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    font-family: inherit;
}

.gs-tab:hover {
    background: rgba(0, 103, 193, 0.08);
    color: #0067C1;
}

.gs-tab.active {
    background: #0067C1;
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(0, 103, 193, 0.3);
}

/* ===================================
   Image Viewport (dual-slide system)
   Top padding = space for tabs (~60px)
   Bottom padding = space for thumbs (~70px)
   =================================== */
.gs-viewport {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 70px 80px 80px;
    box-sizing: border-box;
}

.gs-slide {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: inherit;
    box-sizing: border-box;
    will-change: transform, opacity;
}

.gs-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    user-select: none;
    -webkit-user-drag: none;
    background: #fff;
    padding: 8px;
}

/* Slide states */
.gs-slide-active {
    transform: translateX(0);
    opacity: 1;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.4s ease;
}

.gs-slide-incoming {
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.4s ease;
}

.gs-slide.slide-out-left {
    transform: translateX(-100%);
    opacity: 0;
}

.gs-slide.slide-out-right {
    transform: translateX(100%);
    opacity: 0;
}

.gs-slide.slide-in-from-right {
    transform: translateX(100%);
    opacity: 0;
}

.gs-slide.slide-in-from-left {
    transform: translateX(-100%);
    opacity: 0;
}

.gs-slide.slide-in-center {
    transform: translateX(0);
    opacity: 1;
}

.gs-slide.dragging {
    transition: none !important;
}

/* ===================================
   Navigation Arrows — white, like original
   =================================== */
.gs-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 15;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #333;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    user-select: none;
}

.gs-nav svg {
    width: 28px;
    height: 28px;
}

.gs-nav:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.gs-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.gs-nav-prev {
    left: 1.5rem;
}

.gs-nav-next {
    right: 1.5rem;
}

/* ===================================
   Caption Bar — HIDDEN
   =================================== */
.gs-caption-bar {
    display: none;
}

/* ===================================
   Thumbnail Strip (light theme)
   =================================== */
.gs-thumbs-wrap {
    position: absolute;
    bottom: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    max-width: 80vw;
    overflow: hidden;
}

.gs-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
    scroll-behavior: smooth;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.gs-thumbs::-webkit-scrollbar {
    display: none;
}

.gs-thumb {
    flex: 0 0 auto;
    width: 64px;
    height: 44px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.45;
    border: 2px solid transparent;
    transition: all 0.25s ease;
}

.gs-thumb:hover {
    opacity: 0.85;
}

.gs-thumb.active {
    opacity: 1;
    border-color: #0067C1;
    box-shadow: 0 0 6px rgba(0, 103, 193, 0.3);
}

.gs-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===================================
   Counter Badge
   =================================== */
.gs-counter-badge {
    position: absolute;
    bottom: 1.2rem;
    right: 1.5rem;
    z-index: 15;
    color: #64748b;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.4rem 1rem;
    border-radius: 100px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* ===================================
   Mobile Responsive
   =================================== */
@media (max-width: 768px) {
    .gs-category-bar {
        padding: 0.5rem 3rem 0.5rem 3.2rem;
        justify-content: flex-start;
        overflow: visible;
    }

    .gs-category-tabs {
        flex-wrap: nowrap;
        justify-content: flex-start;
        border-radius: 12px;
        overflow-x: auto;
        max-width: calc(100vw - 6.2rem);
        gap: 0.3rem;
        padding: 0.2rem;
    }

    .gs-tab {
        font-size: 0.78rem;
        padding: 0.4rem 0.85rem;
        flex-shrink: 0;
    }

    .gs-viewport {
        padding: 55px 8px 70px;
    }

    .gs-nav {
        width: 42px;
        height: 42px;
    }

    .gs-nav svg {
        width: 20px;
        height: 20px;
    }

    .gs-nav-prev {
        left: 0.3rem;
    }

    .gs-nav-next {
        right: 0.3rem;
    }

    .gs-lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
        font-size: 2rem;
        width: 40px;
        height: 40px;
    }

    .gs-thumbs-wrap {
        bottom: 0.5rem;
        max-width: 70vw;
    }

    .gs-thumb {
        width: 44px;
        height: 30px;
    }

    .gs-counter-badge {
        bottom: 0.6rem;
        right: 0.8rem;
        font-size: 0.78rem;
    }
}

/* Very small screens */
@media (max-width: 420px) {
    .gs-category-bar {
        padding: 0.5rem 2.5rem 0.5rem 3rem;
    }

    .gs-category-tabs {
        max-width: calc(100vw - 5.5rem);
        gap: 0.2rem;
    }

    .gs-tab {
        font-size: 0.72rem;
        padding: 0.35rem 0.7rem;
    }

    .gs-viewport {
        padding: 50px 6px 65px;
    }
}

/* ===================================
   Landscape Mobile
   =================================== */
@media (max-width: 1024px) and (orientation: landscape) {
    .gs-viewport {
        padding: 50px 60px 15px;
    }

    .gs-category-bar {
        padding: 0.5rem 3.5rem;
    }

    .gs-category-tabs {
        flex-wrap: nowrap;
    }

    .gs-tab {
        font-size: 0.78rem;
        padding: 0.3rem 0.7rem;
    }

    .gs-thumbs-wrap {
        display: none;
    }

    .gs-nav {
        width: 42px;
        height: 42px;
    }

    .gs-nav svg {
        width: 20px;
        height: 20px;
    }
}

/* ===================================
   Mode Toggle Button (grid/single)
   =================================== */
.gs-mode-toggle {
    position: absolute;
    top: 1rem;
    left: 1.5rem;
    z-index: 20;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #333;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gs-mode-toggle:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===================================
   Grid View
   =================================== */
.gs-grid-view {
    position: absolute;
    inset: 0;
    z-index: 12;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 70px 1.5rem 1.5rem;
    box-sizing: border-box;
}

.gs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
}

.gs-grid-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    aspect-ratio: 16 / 10;
}

.gs-grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gs-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gs-grid-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.4rem 0.7rem;
    background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Grid mode: adjust mode toggle button and close in grid */
.gs-lightbox.gs-in-grid .gs-mode-toggle {
    background: #0067C1;
    color: #fff;
    border-color: transparent;
}

@media (max-width: 768px) {
    .gs-mode-toggle {
        top: 0.5rem;
        left: 0.5rem;
        width: 40px;
        height: 40px;
    }

    .gs-grid-view {
        padding: 55px 0.6rem 0.6rem;
    }

    .gs-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .gs-grid-item {
        border-radius: 8px;
    }
}

@media (max-width: 420px) {
    .gs-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
}

/* ===================================
   Loading Spinner
   =================================== */
.gs-slide img.loading {
    opacity: 0;
}

.gs-viewport::after {
    content: '';
    position: absolute;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #333;
    border-radius: 50%;
    animation: gs-spin 0.7s linear infinite;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 5;
}

.gs-viewport.is-loading::after {
    opacity: 1;
}

@keyframes gs-spin {
    to { transform: rotate(360deg); }
}
