/* ============================================
   GALLERY PAGE
   ============================================ */

.gallery-page {
    width: 100%;
    overflow-x: clip;
}

.gallery-page section {
    padding: 32px 0;
    margin: 0;
    width: 100%;
}

/* ---- Toolbar ---- */
.gallery-toolbar {
    background: #fff;
    border-bottom: 1px solid var(--medium-gray);
    padding: 20px clamp(16px, 4vw, 48px) !important;
}

.gallery-toolbar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}

.gallery-search-form .form-control {
    border-radius: var(--radius-pill);
    border: 1px solid var(--medium-gray);
    padding: 9px 16px;
    font-size: 0.88rem;
    color: #000;
    background-color: #fff;
}

.gallery-search-form .form-control:focus {
    color: #000;
    border-color: var(--royal-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.gallery-search-form .form-control::placeholder {
    color: #6b7280;
}

.gallery-search-form .btn {
    border-radius: var(--radius-pill);
    padding: 9px 16px;
}

.gallery-category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.gallery-pill {
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--navy);
    background: var(--light-gray);
    border: 1px solid var(--medium-gray);
    text-decoration: none;
    transition: all 0.2s ease;
}

.gallery-pill:hover {
    background: var(--royal-blue-light);
    border-color: var(--royal-blue);
    color: var(--royal-blue);
}

.gallery-pill.active {
    background: var(--royal-blue);
    border-color: var(--royal-blue);
    color: #fff;
}

.gallery-staff-actions {
    display: flex;
    gap: 8px;
}

/* ---- Grid: 3 equal columns ---- */
.gallery-main {
    background: var(--light-gray);
    padding-bottom: 48px !important;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 0 clamp(16px, 4vw, 48px);
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1;
    box-shadow: var(--shadow-sm);
    background: #fff;
}

.gallery-item-btn {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
}

.gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.gallery-item:hover .gallery-thumb {
    transform: scale(1.04);
}

.gallery-staff-edit {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.8rem;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.gallery-item:hover .gallery-staff-edit {
    opacity: 1;
}

.gallery-staff-edit:hover {
    background: var(--royal-blue);
    color: #fff;
}

/* ---- Fullscreen viewer (image only, click to close) ---- */
.gallery-viewer {
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(15, 40, 71, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: zoom-out;
    animation: galleryViewerIn 0.2s ease;
}

.gallery-viewer[hidden] {
    display: none !important;
}

.gallery-viewer-img {
    max-width: min(96vw, 1200px);
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

@keyframes galleryViewerIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---- Empty state ---- */
.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 24px;
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px dashed var(--medium-gray);
}

.gallery-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--royal-blue-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.gallery-empty-icon i {
    font-size: 1.5rem;
    color: var(--royal-blue);
}

.gallery-empty h4 {
    color: var(--navy);
    font-size: 1.1rem;
    margin: 0;
}

/* ---- Pagination ---- */
.gallery-pagination {
    margin-top: 36px;
    padding: 0 clamp(16px, 4vw, 48px);
}

.gallery-pagination .pagination {
    gap: 6px;
}

.gallery-pagination .page-link {
    border-radius: var(--radius-sm);
    border: 1px solid var(--medium-gray);
    color: var(--navy);
    font-weight: 600;
    padding: 8px 14px;
}

.gallery-pagination .page-item.active .page-link {
    background: var(--royal-blue);
    border-color: var(--royal-blue);
}

/* ---- Responsive columns ---- */
@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .gallery-toolbar-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-search-form {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}
