/* =========================================
   GALLERY CMS
========================================= */

.gallery-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.gallery-tab {
    padding: 10px 18px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s ease;
}

.gallery-tab:hover {
    border-color: var(--gold);
}

.gallery-tab.active {
    background: var(--gold);
    color: #111;
    border-color: var(--gold);
}

.form-help {
    color: var(--muted);
    margin-bottom: 20px;
}

.form-group small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

.gallery-upload-preview {
    width: 280px;
    margin-top: 20px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.gallery-upload-preview img {
    display: block;
    width: 100%;
    height: auto;
}

.upload-actions {
    margin-top: 20px;
}

.upload-progress-container {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--surface);
    border-radius: 10px;
    overflow: hidden;
}

.upload-progress {
    height: 100%;
    width: 0;
    background: var(--gold);
    transition: width 0.15s ease;
}

.gallery-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 25px;
}

.gallery-heading p {
    color: var(--muted);
}

.gallery-count {
    color: var(--muted);
    white-space: nowrap;
}

.gallery-loading,
.gallery-empty {
    padding: 40px;
    text-align: center;
    color: var(--muted);
}

/* =========================================================
   GALLERY GRID
========================================================= */

/* =========================================================
   GALLERY IMAGE GRID
========================================================= */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
}


/* Individual image card */

.gallery-image-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}


/* Photograph */

.gallery-image-card > img {
    display: block;
    width: 100%;
    height: 240px;
    object-fit: cover;
}


/* Image information */

.gallery-image-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
}


/* Section name */

.gallery-image-section {
    color: var(--muted);
    font-size: 0.9rem;
}


/* =========================================================
   RESPONSIVE GALLERY
========================================================= */

@media (max-width: 1100px) {

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 700px) {

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-image-card > img {
        height: 260px;
    }

}


/* =========================================================
   DELETE BUTTON
========================================================= */

.btn-danger {
    border: 0;
    padding: 7px 12px;
    border-radius: 7px;
    cursor: pointer;
    background: #8b2f2f;
    color: white;
}

.btn-danger:hover {
    background: #a83b3b;
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* =========================================================
   HARD SAFETY RULES — prevent full-size blowout
   (applies even if parent CSS vars are missing)
========================================================= */

#galleryGrid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 14px !important;
    margin-top: 20px !important;
    width: 100% !important;
}

#galleryGrid .gallery-image-card {
    overflow: hidden !important;
    border-radius: 12px !important;
    background: #1e1e1e !important;
    border: 1px solid #2e2e2e !important;
    max-width: 100% !important;
}

#galleryGrid .gallery-image-card > img {
    display: block !important;
    width: 100% !important;
    height: 150px !important;
    max-height: 150px !important;
    object-fit: cover !important;
    object-position: center !important;
}

#galleryGrid .gallery-image-details {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 10px !important;
    gap: 8px !important;
}

@media (max-width: 1200px) {
    #galleryGrid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

@media (max-width: 900px) {
    #galleryGrid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 600px) {
    #galleryGrid { grid-template-columns: 1fr !important; }
    #galleryGrid .gallery-image-card > img { height: 180px !important; max-height: 180px !important; }
}