/* =========================================
   Bihar Vihaan - Premium Gallery Styles
   ========================================= */

body.gallery-page {
    background-color: var(--bg);
    color: var(--text);
}

/* Hero Section */
.gallery-hero {
    position: relative;
    padding: 100px 0 70px;
    color: var(--text);
    text-align: center;
    margin-bottom: 40px;
    background: linear-gradient(135deg, rgba(255, 237, 213, 0.5) 0%, rgba(255, 251, 245, 0.6) 30%, rgba(255, 255, 255, 0.7) 50%, rgba(240, 253, 250, 0.5) 70%, rgba(207, 250, 254, 0.4) 100%);
    overflow: hidden;
}

.gallery-hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 100%);
    pointer-events: none;
}

/* Banner Image Mode */
.gallery-hero--banner {
    background: #111;
    padding: 140px 0 100px;
    min-height: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-hero-bg-img {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.gallery-hero-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.25) 50%, rgba(0,0,0,0.55) 100%);
    z-index: 1;
    pointer-events: none;
}

.gallery-hero--banner .gallery-hero-content {
    z-index: 2;
}

.gallery-hero--banner .gallery-hero-content h1 {
    color: #fff;
    text-shadow: 0 2px 16px rgba(0,0,0,0.5);
}

.gallery-hero--banner .gallery-hero-content p {
    color: rgba(255,255,255,0.9);
    text-shadow: 0 1px 8px rgba(0,0,0,0.4);
}

.gallery-hero--banner .gallery-search-form .form-control {
    background: rgba(255,255,255,0.92);
    border: none;
}

.gallery-hero--banner .gallery-search-form .btn {
    background: var(--accent, #FF9933);
    color: #fff;
    border: none;
}

.gallery-hero--banner .gallery-search-form .btn:hover {
    background: #e68a2e;
}

.gallery-hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.gallery-hero h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text);
    text-shadow: none;
}

.gallery-hero p {
    font-size: 1.15rem;
    margin-bottom: 28px;
    color: var(--text-secondary);
    opacity: 1;
}

@media (max-width: 768px) {
    .gallery-hero {
        padding: 70px 0 50px;
    }
    .gallery-hero--banner {
        padding: 100px 0 70px;
        min-height: 360px;
    }
    .gallery-hero h1 {
        font-size: 2.2rem;
    }
    .gallery-hero p {
        font-size: 1rem;
    }
}

.gallery-search {
    position: relative;
    max-width: 600px;
    margin: 0 auto 30px;
}

.gallery-search input {
    width: 100%;
    padding: 15px 25px;
    border-radius: 50px;
    border: 2px solid transparent;
    font-size: 1.1rem;
    background: rgba(255,255,255,0.95);
    transition: all 0.3s;
}

.gallery-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(255, 153, 51, 0.5);
}

/* Buttons */
.btn-gallery-primary {
    background-color: var(--accent);
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
}
.btn-gallery-primary:hover {
    background-color: #e68a2e;
    transform: translateY(-2px);
    color: white;
}

.btn-gallery-outline {
    background-color: transparent;
    color: white;
    border: 2px solid white;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s;
}
.btn-gallery-outline:hover {
    background-color: var(--surface);
    color: var(--primary);
}

/* Filters */
.gallery-filters {
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px 20px;
    margin-bottom: 30px;
    scrollbar-width: none;
}
.gallery-filters::-webkit-scrollbar { display: none; }

.filter-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 20px;
    border-radius: 30px;
    margin-right: 10px;
    font-weight: 500;
    transition: all 0.3s;
}

.filter-btn.active, .filter-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Masonry Grid using CSS Multi-column */
.masonry-grid {
    column-count: 4;
    column-gap: 20px;
    padding: 0 20px;
}

/* Breakpoints */
@media (max-width: 1200px) { .masonry-grid { column-count: 3; } }
@media (max-width: 900px) { .masonry-grid { column-count: 2; } }
@media (max-width: 576px) { .masonry-grid { column-count: 1; padding: 0 10px; } }

.masonry-item {
    break-inside: avoid;
    margin-bottom: 20px;
    background: var(--surface);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.masonry-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.1);
}

.masonry-item img {
    width: 100%;
    display: block;
    transition: transform 0.5s ease;
}

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

.masonry-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
}

.masonry-item:hover .masonry-overlay {
    opacity: 1;
}

.masonry-content {
    color: white;
}

.masonry-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.masonry-location {
    font-size: 0.9rem;
    color: #e2e8f0;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.badge-category {
    position: absolute;
    top: 15px; left: 15px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(5px);
}

.masonry-actions {
    position: absolute;
    top: 15px; right: 15px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.masonry-item:hover .masonry-actions {
    opacity: 1;
    transform: translateY(0);
}

.action-btn {
    width: 35px; height: 35px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    color: var(--text);
    display: flex; align-items: center; justify-content: center;
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.action-btn:hover {
    background: var(--accent);
    color: white;
}

/* Lightbox Modal (Glassmorphism) */
.lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    background: var(--surface);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    flex-direction: row;
}

@media (max-width: 900px) {
    .lightbox-content {
        flex-direction: column;
        max-width: 95%;
    }
}

.lightbox-img-container {
    flex: 2;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lightbox-img-container img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-sidebar {
    flex: 1;
    min-width: 350px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.lightbox-close {
    position: absolute;
    top: 20px; right: 20px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px; height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.4);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    width: 50px; height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.4); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* Lightbox Counter */
.lightbox-counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.65);
    color: #fff;
    padding: 5px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    pointer-events: none;
    user-select: none;
}

/* Lightbox Action Buttons */
.lightbox-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.lb-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--surface, #fff);
    color: var(--text, #1a202c);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.lb-action-btn:hover {
    background: var(--primary, #0B3D91);
    color: #fff;
    border-color: var(--primary, #0B3D91);
}

.lb-action-btn i {
    font-size: 0.95rem;
}

/* Toast Notification */
.lb-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1a202c;
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.lb-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Mobile lightbox tweaks */
@media (max-width: 900px) {
    .lightbox-sidebar {
        min-width: unset;
        padding: 20px;
        max-height: 35vh;
        overflow-y: auto;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .lightbox-prev { left: 10px; }
    .lightbox-next { right: 10px; }

    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }

    .lightbox-actions {
        flex-direction: column;
    }

    .lb-action-btn {
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .lightbox-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }

    .lightbox-img-container img {
        max-height: 55vh;
    }

    .lightbox-sidebar {
        padding: 16px;
        max-height: 40vh;
    }

    .lightbox-counter {
        bottom: 10px;
        font-size: 0.8rem;
    }
}

/* Loader */
.loading-spinner {
    text-align: center;
    padding: 40px;
    display: none;
}
.loading-spinner.active {
    display: block;
}
.spinner-border {
    color: var(--accent);
}
