:root {
    --bg: #FBF7ED;
    --panel: #ffffff;
    --panel-subtle: #FEFCF6;
    --line: #E8E0D0;
    --text: #101828;
    --muted: #667085;
    --accent: #7A1B2D;
    --accent-dark: #5C1422;
    --accent-light: #F5ECD4;
    --gold: #C8A951;
    --gold-dark: #A68B3C;
    --danger: #c23939;
    --success: #1d8f59;
    --shadow: 0 14px 32px rgba(90, 20, 34, 0.07);
    --shadow-soft: 0 6px 18px rgba(90, 20, 34, 0.05);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(180deg, var(--accent-light) 0%, var(--bg) 280px);
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-dark);
}

img {
    max-width: 100%;
    display: block;
}

button,
.button-link,
input,
select {
    font: inherit;
}

button,
.button-link {
    border: none;
    border-radius: 999px;
    background: var(--gold);
    color: #fff;
    cursor: pointer;
    padding: 0.82rem 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    font-weight: 600;
}

button:hover,
.button-link:hover {
    background: var(--gold-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(200, 169, 81, 0.28);
}

.button-link.secondary {
    background: var(--accent-light);
    color: var(--accent);
}

.button-link.secondary:hover {
    background: #f0dfe3;
    box-shadow: none;
}

.button-link.danger {
    background: transparent;
    color: var(--danger);
    padding: 0;
}

input,
select {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: rgba(122, 27, 45, 0.4);
    box-shadow: 0 0 0 4px rgba(122, 27, 45, 0.1);
}

label span,
legend {
    display: block;
    font-weight: 600;
    margin-bottom: 0.45rem;
    color: var(--muted);
}

.shell {
    width: min(1240px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1rem 0 3rem;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0 1.25rem;
}

.brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.tagline {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.nav {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

.nav a {
    color: var(--muted);
    padding: 0.7rem 0.95rem;
    border-radius: 999px;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav a:hover {
    color: var(--accent);
    background: var(--accent-light);
}

.content {
    display: grid;
    gap: 1rem;
}

.hero,
.panel,
.stat-card {
    background: var(--panel);
    border: 1px solid rgba(232, 221, 224, 0.75);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero,
.panel {
    padding: 1.35rem;
}

.panel-soft {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-soft);
}

.panel.narrow {
    max-width: 520px;
    margin: 0 auto;
}

.panel-header,
.toolbar,
.filters,
.share-form,
.actions,
.wrap {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.panel-header-tight {
    margin-bottom: 1rem;
}

.stack {
    display: grid;
    gap: 1rem;
}

.stats-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
    padding: 1.25rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    display: block;
    color: var(--accent);
}

.stat-label,
.muted {
    color: var(--muted);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.2rem;
}

.gallery-grid.compact {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(232, 221, 224, 0.85);
    border-radius: 22px;
    position: relative;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    box-shadow: 0 4px 14px rgba(90, 20, 34, 0.04);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 30px rgba(90, 20, 34, 0.1);
    border-color: rgba(200, 169, 81, 0.35);
}

.card a {
    color: inherit;
}

.card-media {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 20px;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.4)),
        linear-gradient(135deg, var(--accent-light) 0%, #f8f6f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    cursor: pointer;
}

.card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
}

.card-body {
    padding: 1rem;
    display: grid;
    gap: 0.35rem;
}

.card-title {
    font-size: 1rem;
    line-height: 1.45;
}

.card-meta {
    color: var(--muted);
    font-size: 0.94rem;
}

.selectable {
    padding: 1rem;
}

.select-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 2;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.select-badge input {
    width: auto;
    margin: 0;
    accent-color: var(--accent);
}

.alert {
    padding: 1rem 1.2rem;
    border-radius: 14px;
    border: 1px solid transparent;
    margin-bottom: 0.5rem;
}

.alert-success {
    background: #ebf9f1;
    border-color: #b8e5c7;
    color: #13643d;
}

.alert-error {
    background: #fff0f0;
    border-color: #f5c5c5;
    color: #8a2020;
}

.split-panel {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(280px, 420px) 1fr;
}

.checkbox-grid {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem;
    display: grid;
    gap: 0.75rem;
}

.checkbox-item {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.checkbox-item input {
    width: auto;
    accent-color: var(--accent);
}

.preview-box,
.image-stage {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.25)),
        linear-gradient(135deg, var(--accent-light) 0%, #f8f6f7 100%);
    border: 1px solid var(--line);
    border-radius: 24px;
    overflow: hidden;
}

.preview-box img,
.image-stage img {
    width: 100%;
    max-height: 560px;
    object-fit: contain;
}

.list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.8rem;
}

.list li {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.9rem 0.75rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--accent);
    font-weight: 700;
}

.thumb-mini {
    width: 90px;
    height: 90px;
    object-fit: contain;
    border-radius: 10px;
    background: #FAF6EC;
}

.image-detail {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 1.75rem;
    align-items: start;
}

.image-stage-wrap {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
}

.image-stage {
    min-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.detail-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.back-link {
    color: var(--muted);
    font-weight: 600;
}

.back-link:hover {
    color: var(--accent);
}

.image-nav {
    display: flex;
    gap: 0.75rem;
}

.nav-arrow {
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(232, 221, 224, 0.95);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    line-height: 1;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.nav-arrow:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: rgba(200, 169, 81, 0.4);
    color: var(--accent);
}

.nav-arrow.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.detail-sidebar h1,
.gallery-intro h1 {
    margin: 0;
    letter-spacing: -0.03em;
}

.detail-sidebar {
    display: grid;
    gap: 1rem;
}

.gallery-shell {
    display: grid;
    gap: 1rem;
}

.gallery-intro {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    padding: 0.5rem 0 0.25rem;
}

.gallery-intro h1 {
    font-size: clamp(1.9rem, 3vw, 2.7rem);
}

.eyebrow {
    margin: 0 0 0.55rem;
    color: var(--gold);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
}

.section-copy {
    margin: 0.6rem 0 0;
    color: var(--muted);
    max-width: 60ch;
    line-height: 1.6;
}

.gallery-count {
    min-width: 150px;
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: var(--accent-light);
    border: 1px solid rgba(232, 221, 224, 0.85);
    display: grid;
    gap: 0.2rem;
    box-shadow: var(--shadow-soft);
}

.gallery-count strong {
    font-size: 1.9rem;
    letter-spacing: -0.04em;
    color: var(--accent);
}

.gallery-count span {
    color: var(--muted);
}

.filters-inline {
    padding: 0.35rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(232, 221, 224, 0.85);
    box-shadow: var(--shadow-soft);
    align-items: end;
}

.field {
    min-width: 0;
}

.field-search {
    flex: 1 1 320px;
}

.field-category {
    flex: 0 1 240px;
}

.filters-inline .field {
    padding: 0.55rem 0.6rem;
}

.filters-inline button {
    margin: 0.45rem;
}

.gallery-grid-public .image-link {
    display: grid;
    gap: 0.95rem;
    height: 100%;
}

.empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
}

.empty-state h3 {
    margin: 0 0 0.35rem;
    color: var(--text);
}

.meta-list {
    display: grid;
    gap: 0.9rem;
    margin: 1rem 0;
}

.meta-list dt {
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: var(--accent);
}

.meta-list dd {
    margin: 0;
    color: var(--muted);
}

.share-result {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 18px;
    background: var(--accent-light);
    border: 1px solid rgba(200, 169, 81, 0.25);
}

.share-result input {
    background: #fff;
}

/* ====== Image Action Menu (Popup on click) ====== */

.image-action-menu {
    position: absolute;
    z-index: 20;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(90, 20, 34, 0.14);
    padding: 0.5rem;
    min-width: 200px;
    display: none;
    animation: menuFadeIn 0.18s ease;
}

.image-action-menu.is-open {
    display: block;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.image-action-menu button {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
    box-shadow: none;
    transform: none;
}

.image-action-menu button:hover {
    background: var(--accent-light);
    color: var(--accent);
    box-shadow: none;
    transform: none;
}

.image-action-menu button .menu-icon {
    font-size: 1.15rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

/* ====== Floating Selection Bar ====== */

.floating-bar {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    z-index: 100;
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    padding: 0.7rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 12px 40px rgba(90, 20, 34, 0.3);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.floating-bar.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.floating-bar .bar-count {
    font-weight: 700;
    white-space: nowrap;
    padding: 0 0.5rem;
}

.floating-bar .bar-divider {
    width: 1px;
    height: 1.5rem;
    background: rgba(255, 255, 255, 0.3);
}

.floating-bar button {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    box-shadow: none;
    transform: none;
}

.floating-bar button:hover {
    background: var(--gold);
    box-shadow: none;
    transform: none;
}

.floating-bar .bar-close {
    background: rgba(255, 255, 255, 0.12);
    padding: 0.55rem 0.75rem;
    font-size: 1.1rem;
    line-height: 1;
}

/* ====== Share Page (full-size view) ====== */

.share-gallery {
    display: grid;
    gap: 2rem;
}

.share-image-item {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.share-image-item img {
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.25)),
        linear-gradient(135deg, var(--accent-light) 0%, #f8f6f7 100%);
}

.share-image-info {
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
}

.share-image-info .image-meta {
    display: grid;
    gap: 0.25rem;
}

.share-image-info .image-meta strong {
    font-size: 1.1rem;
}

.share-image-info .image-meta span {
    color: var(--muted);
    font-size: 0.95rem;
}

.share-image-info .button-link {
    flex-shrink: 0;
}

/* ====== Notification Toast ====== */

.toast-notification {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 200;
    background: var(--accent);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 8px 24px rgba(90, 20, 34, 0.25);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.toast-notification.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 860px) {
    .split-panel,
    .image-detail {
        grid-template-columns: 1fr;
    }

    .site-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .gallery-intro,
    .detail-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .image-stage-wrap {
        grid-template-columns: 1fr;
    }

    .image-nav-side {
        display: none;
    }

    .filters-inline {
        border-radius: 20px;
    }

    .floating-bar {
        left: 1rem;
        right: 1rem;
        transform: translateX(0) translateY(120%);
        border-radius: 20px;
        justify-content: center;
    }

    .floating-bar.is-visible {
        transform: translateX(0) translateY(0);
    }
}

@media (max-width: 640px) {
    .shell {
        width: min(100% - 1rem, 1240px);
    }

    .panel,
    .hero {
        padding: 1rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .image-stage {
        min-height: 320px;
    }

    .floating-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.6rem 0.8rem;
    }
}
