:root {
    --bg: #f8f7f4;
    --surface: #ffffff;
    --surface-alt: #f1efe9;
    --text: #141413;
    --text-muted: #5c5b57;
    --border: #e4e1d8;
    --accent: #3730a3;
    --accent-hover: #312e81;
    --accent-soft: #eef2ff;
    --emerald: #047857;
    --emerald-soft: #ecfdf5;
    --amber: #b45309;
    --amber-soft: #fffbeb;
    --rose: #be123c;
    --rose-soft: #fff1f2;
    --radius: 12px;
    --shadow-sm: 0 1px 3px rgba(20, 20, 19, 0.05);
    --shadow-md: 0 8px 24px rgba(20, 20, 19, 0.07);
}

[data-theme="dark"] {
    --bg: #111110;
    --surface: #1b1b19;
    --surface-alt: #242421;
    --text: #f3f2ee;
    --text-muted: #a3a19a;
    --border: #32312d;
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --accent-soft: #1e1b4b;
    --emerald: #10b981;
    --emerald-soft: #064e3b;
    --amber: #f59e0b;
    --amber-soft: #451a03;
    --rose: #fb7185;
    --rose-soft: #4c0519;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Top Navigation */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    max-width: 1260px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none !important;
    color: var(--text);
}

.brand-mark {
    width: 36px;
    height: 36px;
    background: var(--text);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.03em;
}

.brand-title {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.brand-sub {
    font-size: 0.73rem;
    color: var(--text-muted);
    display: block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.nav-link {
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none !important;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-link:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.nav-link.active {
    background: var(--text);
    color: #fff;
}

.badge-count {
    background: var(--rose);
    color: #fff;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 99px;
    font-weight: 700;
}

/* Container & Layout */
.container {
    max-width: 1260px;
    margin: 0 auto;
    padding: 1.75rem 1.5rem 4rem;
}

.flash {
    padding: 0.9rem 1.15rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-weight: 500;
    font-size: 0.92rem;
    border: 1px solid transparent;
}

.flash-success {
    background: var(--emerald-soft);
    color: var(--emerald);
    border-color: #a7f3d0;
}

.flash-error {
    background: var(--rose-soft);
    color: var(--rose);
    border-color: #fecdd3;
}

/* Hero / Header Banner */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin: 0 0 0.25rem 0;
}

.page-subtitle {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.95rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-decoration: none !important;
    transition: all 0.15s ease;
}

.btn:hover {
    background: var(--surface-alt);
}

.btn-primary {
    background: var(--text);
    color: #fff;
    border-color: var(--text);
}

.btn-primary:hover {
    background: #2e2e2c;
    color: #fff;
}

.btn-accent {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-accent:hover {
    background: var(--accent-hover);
    color: #fff;
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-active-going {
    background: var(--emerald);
    color: #fff;
    border-color: var(--emerald);
}

.btn-active-interested {
    background: var(--amber);
    color: #fff;
    border-color: var(--amber);
}

/* Cards & Grids */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem;
    box-shadow: var(--shadow-sm);
}

.exhibition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.25rem;
}

.exhibition-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.exhibition-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbc6b8;
}

.exhibition-card.matched-card {
    border-top: 3px solid var(--accent);
}

.ex-museum-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.45rem;
}

.ex-title {
    font-size: 1.18rem;
    font-weight: 800;
    line-height: 1.3;
    margin: 0 0 0.35rem 0;
    color: var(--text);
}

.ex-subtitle {
    font-size: 0.88rem;
    font-weight: 600;
    color: #44433f;
    margin: 0 0 0.6rem 0;
}

.ex-dates {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-alt);
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.ex-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0 0 0.9rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Pills & Tags */
.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.73rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 99px;
    background: var(--surface-alt);
    color: var(--text);
}

.pill-match {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid #c7d2fe;
}

.pill-artist {
    background: #fef3c7;
    color: #92400e;
}

.pill-ending {
    background: var(--rose-soft);
    color: var(--rose);
    font-weight: 700;
}

.score-badge {
    background: var(--accent);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
}

/* Filter Bar & Tabs */
.tabs-bar {
    display: flex;
    gap: 0.4rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
    margin-bottom: 1.15rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.45rem 0.95rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-muted);
    background: transparent;
    text-decoration: none !important;
}

.tab-btn:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.tab-btn.active {
    background: var(--text);
    color: #fff;
}

.filter-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1.1rem;
    margin-bottom: 1.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.input, select, textarea {
    padding: 0.52rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}

.input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent);
    border-color: transparent;
}

/* Onboarding Wizard */
.wizard-steps {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.wizard-step-indicator {
    flex: 1;
    min-width: 140px;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.wizard-step-indicator.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.selectable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.75rem;
}

.choice-card {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.8rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
    transition: all 0.12s ease;
    user-select: none;
}

.choice-card:hover {
    border-color: #9ca3af;
}

.choice-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.choice-card input[type="checkbox"] {
    margin-top: 0.22rem;
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

.choice-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
}

.choice-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Community Social Footer on Exhibition Cards */
.community-strip {
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px dashed var(--border);
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.data-table th, .data-table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

[data-theme="dark"] .input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--surface);
    color: var(--text);
}

/* Interactive SVG European Museum & Perimeter Map */
.map-container {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.europe-radar-map {
    width: 100%;
    height: auto;
    max-height: 430px;
    display: block;
}

.map-grid-line {
    stroke: var(--border);
    stroke-width: 0.75;
    stroke-dasharray: 4 4;
}

.map-country-label {
    fill: var(--text-muted);
    opacity: 0.28;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.14em;
    pointer-events: none;
}

.map-perimeter-circle {
    fill: rgba(79, 70, 229, 0.10);
    stroke: var(--accent);
    stroke-width: 1.75;
    stroke-dasharray: 5 3;
}

.map-perimeter-label {
    fill: var(--accent);
    font-size: 11px;
    font-weight: 800;
}

.map-pin {
    fill: #64748b;
    stroke: var(--surface);
    stroke-width: 1.5;
    transition: transform 0.15s ease, r 0.15s ease;
    cursor: pointer;
}

.map-pin-active {
    fill: #0284c7;
}

.map-pin-followed {
    fill: var(--accent);
}

.map-pin-link:hover .map-pin {
    stroke-width: 2.5;
    filter: brightness(1.15);
}

.map-city-label {
    fill: var(--text);
    font-size: 9.5px;
    font-weight: 700;
    pointer-events: none;
    opacity: 0.82;
}

.map-legend {
    display: flex;
    gap: 1.15rem;
    align-items: center;
    padding: 0.55rem 0.9rem;
    border-top: 1px solid var(--border);
    font-size: 0.76rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 4px;
}

.legend-followed { background: var(--accent); }
.legend-active { background: #0284c7; }
.legend-other { background: #64748b; }

/* Floating Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast-item {
    background: var(--text);
    color: var(--surface);
    padding: 0.7rem 1.1rem;
    border-radius: 10px;
    font-size: 0.86rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.2s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media print {
    .topbar, .no-print, .tabs-bar, form button {
        display: none !important;
    }
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .card, .exhibition-card {
        box-shadow: none !important;
        break-inside: avoid;
    }
}

@media (max-width: 768px) {
    .exhibition-grid {
        grid-template-columns: 1fr;
    }
    .topbar-inner {
        padding: 0.75rem 1rem;
    }
    .container {
        padding: 1.25rem 1rem 3rem;
    }
}
