/* Gallery admin + public styles */

.gallery-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.gallery-filters,
.public-filters,
.bulk-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    margin: 0.75rem 0 1.25rem;
}

.gallery-filters input[type="search"],
.gallery-filters select,
.public-filters input[type="search"],
.public-filters select,
.bulk-bar select {
    min-width: 10rem;
}

.gallery-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.gallery-card {
    border: 1px solid var(--line, #d9e2ec);
    border-radius: 0.75rem;
    overflow: hidden;
    background: #fff;
    position: relative;
}

.gallery-select {
    position: absolute;
    top: 0.55rem;
    left: 0.55rem;
    z-index: 2;
    background: rgba(255,255,255,0.9);
    border-radius: 0.35rem;
    padding: 0.15rem 0.3rem;
}

.gallery-thumb {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #edf2f7;
    position: relative;
}

.gallery-thumb img,
.detail-image,
.edit-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.detail-image,
.edit-preview img {
    height: auto;
    max-height: 520px;
    object-fit: contain;
    background: #0f172a;
}

.featured-badge {
    position: absolute;
    right: 0.5rem;
    bottom: 0.5rem;
    background: #0f8a95;
    color: #fff;
    font-size: 0.72rem;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
}

.gallery-card-body {
    padding: 0.75rem;
}

.gallery-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0.45rem;
}

.gallery-card-actions a,
.linkish {
    background: none;
    border: 0;
    padding: 0;
    color: var(--teal, #0f8a95);
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
}

.dropzone {
    border: 2px dashed #9fb3c8;
    border-radius: 0.85rem;
    padding: 2rem 1rem;
    text-align: center;
    background: #f8fafc;
    margin-bottom: 1rem;
    position: relative;
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.dropzone.dragover {
    border-color: #0f8a95;
    background: #e6fffa;
}

.upload-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.upload-preview-grid img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.danger-form {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line, #d9e2ec);
}

.masonry-grid {
    columns: 3 260px;
    column-gap: 1rem;
}

.masonry-item {
    break-inside: avoid;
    margin: 0 0 1rem;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line, #d9e2ec);
    cursor: zoom-in;
}

.masonry-item img {
    width: 100%;
    height: auto;
    display: block;
}

.masonry-item figcaption {
    padding: 0.65rem 0.75rem 0.85rem;
}

.masonry-item figcaption span {
    display: block;
    color: #627d98;
    font-size: 0.85rem;
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(7, 18, 32, 0.92);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.lightbox[hidden] {
    display: none !important;
}

.lightbox img {
    max-width: min(1100px, 92vw);
    max-height: 78vh;
    object-fit: contain;
}

.lightbox p {
    color: #fff;
    margin-top: 0.75rem;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 999px;
    background: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 720px) {
    .masonry-grid {
        columns: 1;
    }
}

.home-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.home-gallery-card {
    border: 1px solid var(--line, #d9e2ec);
    border-radius: 0.85rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 38, 64, 0.06);
}

.home-gallery-thumb {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    position: relative;
    background: #edf2f7;
}

.home-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.home-gallery-card:hover img {
    transform: scale(1.04);
}

.home-gallery-copy {
    padding: 0.85rem 0.95rem 1rem;
}

.home-gallery-copy h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.home-gallery-copy p {
    margin: 0;
    color: #627d98;
    font-size: 0.88rem;
}

.home-gallery-grid--sparse {
    grid-template-columns: repeat(auto-fill, minmax(280px, 360px));
}

.home-gallery-note,
.home-gallery-empty {
    margin-top: 1.1rem;
}

.home-gallery-note p,
.home-gallery-empty p {
    margin-bottom: 0.85rem;
}
