/* ============================================
   Orvia Hotels - Photo Gallery
   Prefix: .gl-*
   Two modes:
   1. Grid Gallery (white overlay, category tabs + thumbnail grid)
   2. Image Viewer (dark overlay, single image full-screen)
   ============================================ */

/* ── Grid Gallery Overlay ── */
.gl-gallery {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #fff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.gl-gallery.open {
    opacity: 1;
    visibility: visible;
}

/* ── Gallery Top Bar ── */
.gl-gallery-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 24px 0;
}

.gl-gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.gl-gallery-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.gl-gallery-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #374151;
    font-size: 16px;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

.gl-gallery-close:hover {
    background: #e5e7eb;
}

/* ── Category Tabs ── */
.gl-gallery-tabs {
    display: flex;
    gap: 8px;
    padding-bottom: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.gl-gallery-tabs::-webkit-scrollbar {
    display: none;
}

.gl-gallery-tab {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    text-transform: capitalize;
}

.gl-gallery-tab:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.gl-gallery-tab.active {
    color: var(--fe-accent, #c8956c);
    background: #fff;
    border-color: var(--fe-accent, #c8956c);
}

/* ── Gallery Body ── */
.gl-gallery-body {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ── Category Section ── */
.gl-category-section {
    margin-bottom: 32px;
}

.gl-category-label {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
    text-transform: capitalize;
}

/* ── Image Grid ── */
.gl-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.gl-grid-item {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #f3f4f6;
}

.gl-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gl-grid-item:hover img {
    transform: scale(1.05);
}

/* ── Single Image Viewer (dark overlay) ── */
.gl-viewer {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gl-viewer.open {
    opacity: 1;
    visibility: visible;
}

.gl-viewer-close {
    position: absolute;
    top: 16px;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    border: none;
    z-index: 10;
    transition: background 0.2s ease;
}

.gl-viewer-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.gl-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    border: none;
    z-index: 10;
    transition: background 0.2s ease;
}

.gl-viewer-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.gl-viewer-prev { left: 20px; }
.gl-viewer-next { right: 20px; }

.gl-viewer-counter {
    position: absolute;
    top: 20px;
    left: 24px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    z-index: 10;
}

.gl-viewer img {
    max-width: calc(100% - 160px);
    max-height: calc(100% - 80px);
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    transition: opacity 0.2s ease;
}

.gl-viewer img.loading {
    opacity: 0.3;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .gl-image-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 768px) {
    .gl-gallery-topbar {
        padding: 12px 16px 0;
    }

    .gl-gallery-body {
        padding: 16px;
    }

    .gl-image-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 6px;
    }

    .gl-grid-item {
        border-radius: 6px;
    }

    .gl-viewer img {
        max-width: calc(100% - 32px);
        max-height: calc(100% - 60px);
    }

    .gl-viewer-nav {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .gl-viewer-prev { left: 8px; }
    .gl-viewer-next { right: 8px; }

    .gl-gallery-tabs {
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .gl-image-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
