/**
 * Module: Gallery (Thư viện ảnh)
 * Scope: .school-gallery
 * Đồng bộ phong cách với List V2 và Leadership
 */

.school-gallery {
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 28px 0;
    font-family: inherit;
    color: #0c2340;
}

.school-gallery *,
.school-gallery *::before,
.school-gallery *::after {
    box-sizing: border-box;
}

/* ==================================================
   1. HEADER MODULE (Đồng bộ gradient với List V2)
   ================================================== */
.school-gallery__header {
    background: linear-gradient(135deg, #047857 0%, #008751 55%, #059669 100%);
    border-radius: 16px;
    padding: 18px 24px;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 135, 81, 0.15);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.school-gallery__header::after {
    content: "";
    position: absolute;
    right: -10px;
    top: -20px;
    width: 160px;
    height: 130px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 10%, transparent 70%);
    pointer-events: none;
}

.school-gallery__header-content {
    position: relative;
    z-index: 1;
}

.school-gallery__header-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.school-gallery__header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    flex-shrink: 0;
}

.school-gallery__title {
    margin: 0;
    padding: 0;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.6px;
    line-height: 1.25;
    text-transform: uppercase;
}

.school-gallery__subtitle {
    margin: 6px 0 0 34px;
    padding: 0;
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.88);
    font-weight: 400;
    line-height: 1.4;
}

/* ==================================================
   2. FILTER TABS (Danh mục album)
   ================================================== */
.school-gallery__tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    padding: 2px 0;
}

.school-gallery__tab-btn {
    appearance: none;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    line-height: 1.3;
}

.school-gallery__tab-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #cbd5e1;
}

.school-gallery__tab-btn.is-active {
    background: #008751;
    color: #ffffff;
    border-color: #008751;
    box-shadow: 0 2px 8px rgba(0, 135, 81, 0.28);
}

.school-gallery__tab-count {
    display: inline-block;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
}

.school-gallery__tab-btn.is-active .school-gallery__tab-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* ==================================================
   3. ALBUM GRID (3 cột Desktop / 2 Tablet / 1 Mobile)
   ================================================== */
.school-gallery__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

@media (max-width: 900px) {
    .school-gallery__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
}

@media (max-width: 600px) {
    .school-gallery__grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .school-gallery__subtitle {
        margin-left: 0;
        margin-top: 8px;
    }
}

/* ==================================================
   4. ALBUM CARD
   ================================================== */
.school-gallery__card {
    background: #ffffff;
    border: 1.5px solid #e8e8e8;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease, opacity 0.25s ease;
    position: relative;
}

.school-gallery__card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09);
    transform: translateY(-4px);
}

.school-gallery__card.is-hidden {
    display: none !important;
}

/* Cover Wrapper */
.school-gallery__cover-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #f1f5f9;
}

.school-gallery__cover-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.school-gallery__cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.school-gallery__card:hover .school-gallery__cover-img {
    transform: scale(1.06);
}

/* Placeholder khi chưa có ảnh */
.school-gallery__cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

/* Badge số ảnh (Floating pill trên ảnh) */
.school-gallery__badge-count {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(12, 35, 64, 0.82);
    color: #ffffff;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 2;
    pointer-events: none;
}

.school-gallery__badge-count svg {
    flex-shrink: 0;
}

/* Badge danh mục (Floating trên góc trái) */
.school-gallery__badge-cat {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #008751;
    color: #ffffff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    z-index: 2;
    pointer-events: none;
}

/* Card Body */
.school-gallery__card-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

.school-gallery__card-title {
    margin: 0 0 10px 0;
    padding: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: #0c2340;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.school-gallery__card-title a {
    color: #0c2340;
    text-decoration: none;
    transition: color 0.2s ease;
}

.school-gallery__card-title a:hover {
    color: #008751;
}

.school-gallery__card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    font-size: 12.5px;
    color: #64748b;
}

.school-gallery__date {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.school-gallery__date svg {
    flex-shrink: 0;
    color: #94a3b8;
}

.school-gallery__view-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #008751;
    font-weight: 600;
    font-size: 12px;
    text-decoration: none;
    transition: transform 0.2s ease, color 0.2s ease;
}

.school-gallery__card:hover .school-gallery__view-more {
    transform: translateX(3px);
    color: #047857;
}

/* ==================================================
   5. EMPTY STATE
   ================================================== */
.school-gallery__empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: 16px;
    color: #64748b;
}

.school-gallery__empty-icon {
    margin-bottom: 12px;
    color: #94a3b8;
}

.school-gallery__empty-text {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

/* ==================================================
   6. SINGLE ALBUM DETAIL PAGE
   ================================================== */
.album-single {
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 32px 0;
}

/* Header Single Album */
.album-single__header {
    background: linear-gradient(135deg, #047857 0%, #008751 55%, #059669 100%);
    border-radius: 16px;
    padding: 18px 24px;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 135, 81, 0.15);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.album-single__header::after {
    content: "";
    position: absolute;
    right: -10px;
    top: -20px;
    width: 160px;
    height: 130px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 10%, transparent 70%);
    pointer-events: none;
}

.album-single__header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.album-single__header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    flex-shrink: 0;
}

.album-single__title {
    margin: 0;
    padding: 0;
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
    line-height: 1.3;
    text-transform: uppercase;
}

.album-single__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    z-index: 1;
}

.album-single__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.album-single__meta-item svg {
    flex-shrink: 0;
    opacity: 0.85;
}

.album-single__meta-sep {
    opacity: 0.6;
}

.album-single__cat-tag {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Back Button */
.album-single__back-wrap {
    margin-bottom: 16px;
}

.album-single__back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #008751;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    transition: transform 0.2s ease, color 0.2s ease;
}

.album-single__back-link:hover {
    color: #047857;
    transform: translateX(-3px);
}

/* ==================================================
   7. SINGLE ALBUM GRID
   ================================================== */
.album-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .album-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
}

@media (max-width: 520px) {
    .album-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 380px) {
    .album-grid {
        grid-template-columns: 1fr;
    }
}

.album-grid__item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    cursor: zoom-in;
    aspect-ratio: 4 / 3;
    border: 1px solid #e8e8e8;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    box-sizing: border-box;
}

.album-grid__item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.album-grid__thumb-wrap {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.album-grid__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.album-grid__item:hover .album-grid__img {
    transform: scale(1.04);
}

.album-grid__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.22s ease;
    pointer-events: none;
}

.album-grid__item:hover .album-grid__overlay {
    opacity: 1;
}

.album-grid__zoom-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #0c2340;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.85);
    transition: transform 0.22s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.album-grid__item:hover .album-grid__zoom-icon {
    transform: scale(1);
}

/* ==================================================
   8. LIGHTBOX MODAL
   ================================================== */
.album-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    user-select: none;
}

.album-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

/* Lightbox Header / Controls Bar */
.album-lightbox__topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
}

.album-lightbox__counter {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.album-lightbox__close {
    appearance: none;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #ffffff;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.album-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

/* Lightbox Stage (Image Container) */
.album-lightbox__stage {
    position: relative;
    max-width: 92vw;
    max-height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.album-lightbox__img {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: opacity 0.2s ease;
    display: block;
}

.album-lightbox__img.is-loading {
    opacity: 0.3;
}

/* Nav Buttons */
.album-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.album-lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-50%) scale(1.08);
}

.album-lightbox__nav--prev {
    left: 20px;
}

.album-lightbox__nav--next {
    right: 20px;
}

@media (max-width: 600px) {
    .album-lightbox__nav {
        width: 44px;
        height: 44px;
    }
    .album-lightbox__nav--prev {
        left: 10px;
    }
    .album-lightbox__nav--next {
        right: 10px;
    }
    .album-lightbox__topbar {
        padding: 0 16px;
        height: 54px;
    }
}

/* Spinner Loader */
.album-lightbox__loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.album-lightbox__spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: albumLightboxSpin 0.75s infinite linear;
}

@keyframes albumLightboxSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
