/* Shared gallery styles */
.gallery-section,
.featured-gallery-section {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    padding: 28px;
}

.gallery-section {
    margin: 0 0 40px;
}

.gallery-section-header,
.featured-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.gallery-section-title-wrap h3,
.featured-gallery-header h2 {
    margin: 0;
    color: var(--text-dark, #212121);
}

.gallery-section-title-wrap p,
.featured-gallery-header p {
    margin: 8px 0 0;
    color: #666;
}

.gallery-count-badge,
.gallery-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(44, 95, 45, 0.08);
    border: 1px solid rgba(44, 95, 45, 0.18);
    color: #2c5f2d;
    font-weight: 700;
    font-size: 0.92rem;
}

.gallery-role-badge {
    background: rgba(25, 118, 210, 0.08);
    border-color: rgba(25, 118, 210, 0.18);
    color: #0d47a1;
}

.gallery-upload-panel {
    margin-bottom: 24px;
    padding: 20px;
    border: 1px solid #e5ebe5;
    border-radius: 16px;
    background: linear-gradient(180deg, #fbfdfb 0%, #f5f8f5 100%);
}

.gallery-upload-form {
    display: grid;
    gap: 16px;
}

.gallery-upload-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.gallery-upload-field {
    display: grid;
    gap: 6px;
}

.gallery-upload-field label {
    color: #2b2b2b;
    font-weight: 700;
}

.gallery-upload-field input,
.gallery-upload-field textarea {
    width: 100%;
    border: 1px solid #d5ddd5;
    border-radius: 10px;
    padding: 11px 12px;
    font: inherit;
    color: #202020;
    background: #fff;
}

.gallery-upload-field textarea {
    resize: vertical;
    min-height: 90px;
}

.gallery-upload-field input:focus,
.gallery-upload-field textarea:focus {
    outline: 2px solid rgba(44, 95, 45, 0.16);
    border-color: #2c5f2d;
}

.gallery-upload-field--full {
    grid-column: 1 / -1;
}

.gallery-dropzone {
    position: relative;
    border: 2px dashed rgba(44, 95, 45, 0.35);
    border-radius: 16px;
    background: #fff;
    padding: 28px 20px;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.gallery-dropzone.is-dragover,
.gallery-dropzone:hover {
    border-color: #2c5f2d;
    background: #f7fbf7;
    transform: translateY(-1px);
}

.gallery-dropzone-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.gallery-dropzone strong {
    display: block;
    color: #223;
    font-size: 1.05rem;
}

.gallery-dropzone span {
    display: block;
    color: #666;
    margin-top: 4px;
}

.gallery-dropzone small {
    display: block;
    color: #7a7a7a;
    margin-top: 8px;
}

.gallery-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.gallery-upload-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.gallery-upload-hint {
    color: #666;
    font-size: 0.95rem;
}

.gallery-upload-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.gallery-btn {
    border: none;
    border-radius: 10px;
    padding: 11px 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.gallery-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.gallery-btn-primary {
    background: #2c5f2d;
    color: #fff;
}

.gallery-btn-primary:hover {
    background: #234c24;
}

.gallery-btn-secondary {
    background: #eef2ee;
    color: #2b2b2b;
}

.gallery-btn-secondary:hover {
    background: #dfe7df;
}

.gallery-btn:disabled {
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.65;
}

.gallery-upload-preview {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 12px;
}

.gallery-upload-preview.has-files {
    display: grid;
}

.gallery-preview-card {
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 14px;
    overflow: hidden;
}

.gallery-preview-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.gallery-video-tile {
    background: #111;
}

.gallery-preview-meta {
    padding: 10px;
    color: #555;
    font-size: 0.82rem;
    line-height: 1.35;
}

.gallery-gate-message,
.gallery-empty-state {
    margin: 0 0 20px;
    padding: 16px 18px;
    border-radius: 14px;
    background: #f5f7f5;
    color: #4d4d4d;
    border: 1px solid #e4e8e4;
}

.gallery-grid,
.featured-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}

.gallery-card,
.featured-gallery-card {
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

.gallery-photo-link,
.featured-gallery-photo {
    display: block;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.gallery-photo-image,
.featured-gallery-image {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #edf1ed;
}

.gallery-photo-link.is-video::after,
.featured-gallery-photo.is-video::after {
    content: '▶';
    position: absolute;
    inset: auto 12px 12px auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 0.95rem;
    pointer-events: none;
}

.gallery-media-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.68);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    pointer-events: none;
}

.gallery-card-body,
.featured-gallery-card-body {
    padding: 12px 14px 14px;
}

.gallery-card-actions {
    margin-top: 10px;
}

.gallery-edit-toggle {
    width: 100%;
}

.gallery-card-body strong,
.featured-gallery-card-body strong {
    display: block;
    color: #202020;
    margin-bottom: 4px;
}

.gallery-card-body span,
.featured-gallery-card-body span,
.featured-gallery-card-body time {
    color: #6a6a6a;
    font-size: 0.92rem;
}

.gallery-card-body time,
.featured-gallery-card-body time {
    display: inline-block;
    margin-top: 6px;
}

.gallery-card-description,
.featured-gallery-description {
    margin: 0 0 8px;
    color: #555;
    font-size: 0.92rem;
    line-height: 1.45;
}

.gallery-metadata-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.gallery-editor-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.72);
}

.gallery-editor-modal.is-open {
    display: flex;
}

.gallery-editor-dialog {
    position: relative;
    width: min(760px, 100%);
    max-height: min(88vh, 920px);
    overflow: auto;
    background: #fff;
    border-radius: 18px;
    padding: 26px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
}

.gallery-editor-dialog h3 {
    margin: 0 0 18px;
    color: #223;
}

.gallery-editor-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 999px;
    background: #eef2ee;
    color: #223;
    font-size: 1.4rem;
    cursor: pointer;
}

.gallery-editor-form {
    display: grid;
    gap: 14px;
}

.featured-gallery-section {
    margin: 0 0 40px;
    background: linear-gradient(135deg, #f7faf7 0%, #eef4ee 100%);
}

.featured-gallery-link {
    font-weight: 700;
    color: #2c5f2d;
    text-decoration: none;
}

.featured-gallery-link:hover {
    text-decoration: underline;
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    padding: 24px;
}

.gallery-lightbox.is-open {
    display: flex;
}

.gallery-lightbox-dialog {
    position: relative;
    max-width: min(1100px, 92vw);
    max-height: 92vh;
    display: grid;
    gap: 12px;
}

.gallery-lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 18px;
    background: #111;
    object-fit: contain;
}

.gallery-lightbox-video {
    display: none;
    max-width: 100%;
    max-height: 80vh;
    border-radius: 18px;
    background: #111;
}

.gallery-lightbox-caption {
    color: #fff;
    text-align: center;
    font-size: 0.95rem;
}

.gallery-lightbox-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
}

.gallery-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.gallery-page-hero {
    padding: 3.5rem 0 2rem;
}

.gallery-page-hero h1 {
    margin: 0 0 0.75rem;
    color: var(--text-dark, #212121);
}

.gallery-page-intro {
    max-width: 760px;
    color: #596159;
    font-size: 1.05rem;
}

.gallery-page-stats {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.gallery-page-stat {
    background: #fff;
    border: 1px solid rgba(44, 95, 45, 0.1);
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}

.gallery-page-stat strong {
    display: block;
    color: #203320;
    margin-bottom: 4px;
}

.gallery-page-stat span {
    color: #667066;
    font-size: 0.92rem;
}

.gallery-shell {
    padding-bottom: 3rem;
}

@media (max-width: 768px) {
    .gallery-section,
    .featured-gallery-section {
        padding: 20px;
    }

    .gallery-grid,
    .featured-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-upload-actions {
        align-items: stretch;
    }

    .gallery-upload-buttons {
        width: 100%;
    }

    .gallery-btn {
        flex: 1;
    }

    .gallery-page-hero {
        padding-top: 2.5rem;
    }
}

@media (max-width: 520px) {
    .gallery-grid,
    .featured-gallery-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .gallery-lightbox {
        padding: 12px;
    }
}
