/* ─── AlwaysGreener — Redesign ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --accent: #34D399;
    --accent-light: #34D39918;
    --accent-mid: #34D39950;
    --accent-dark: #059669;
    --teal: #2DD4BF;
    --teal-light: #2DD4BF18;
    --bg: #0F1117;
    --card: #1A1D27;
    --card-hover: #222632;
    --border: #2A2E3A;
    --text: #E8ECF1;
    --text-mid: #8B92A0;
    --text-light: #555D6E;
    --dark: #0B0D12;
    --dark-card: #141720;
    --danger: #EF4444;
    --success: #34D399;
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-data: 'JetBrains Mono', monospace;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-pop: 0 12px 48px rgba(0,0,0,0.5);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Keep old var names for admin pages compatibility */
:root {
    --green: var(--accent);
    --green-dark: var(--accent-dark);
    --green-light: var(--accent-light);
    --green-mid: var(--accent-mid);
    --gold: #FBBF24;
    --bronze: #F59E0B;
    --font-brand: var(--font-heading);
    --bg-hover: var(--card-hover);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Scrollbars ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideOutRight { from { transform: translateX(0); } to { transform: translateX(100%); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes barFill { from { width: 0; } }
@keyframes pulseGlow { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.site-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 200;
    box-shadow: var(--shadow-sm);
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-mark {
    width: 34px; height: 34px; border-radius: var(--radius-xs);
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    color: var(--dark); font-family: var(--font-heading); font-size: 16px; font-weight: 700;
}
.logo-text { font-family: var(--font-heading); font-size: 15px; font-weight: 700; letter-spacing: -0.3px; }
.logo-sub { font-family: var(--font-body); font-size: 10px; color: var(--text-light); display: block; font-weight: 400; }

/* Toolbar right section */
.toolbar-right { display: flex; align-items: center; gap: 10px; }

/* Toolbar dropdown pills */
.toolbar-dropdown { position: relative; }
.toolbar-pill {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 20px;
    border: 1px solid var(--border); background: var(--card);
    font-family: var(--font-body); font-size: 12px; font-weight: 500;
    color: var(--text); cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.toolbar-pill:hover { border-color: var(--accent); }
.toolbar-pill svg { flex-shrink: 0; }
.toolbar-dropdown-menu {
    position: absolute; top: calc(100% + 6px); right: 0;
    min-width: 280px; max-height: 400px; overflow-y: auto;
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 300;
}
.toolbar-dropdown.open .toolbar-dropdown-menu {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.toolbar-dropdown.open .toolbar-pill { border-color: var(--accent); background: var(--accent-light); }
.dropdown-empty { padding: 16px; font-size: 12px; color: var(--text-light); text-align: center; }
.dropdown-item {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; text-decoration: none; color: var(--text);
    transition: background var(--transition);
    border-bottom: 1px solid var(--border);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--card-hover); }
.dropdown-rank {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--bg); font-family: var(--font-data);
    font-size: 10px; font-weight: 600; color: var(--text-mid);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dropdown-item:first-child .dropdown-rank { background: var(--accent); color: #fff; }
.dropdown-name { flex: 1; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-val { font-family: var(--font-data); font-size: 10px; color: var(--text-light); white-space: nowrap; }

.main-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    height: calc(100vh - 53px);
    gap: 0;
    background: var(--bg);
    overflow: hidden;
}

.sidebar {
    overflow-y: auto;
    padding: 12px;
    background: var(--bg);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.map-area {
    display: flex;
    flex-direction: column;
    padding: 12px 12px 12px 0;
    gap: 10px;
    overflow: hidden;
}

/* ─── Sidebar Cards ──────────────────────────────────────────────────────── */
.sidebar-card {
    background: rgba(26, 29, 39, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255,255,255,0.06);
    animation: slideUp var(--transition) both;
}
.sidebar-card h3 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}
.sidebar-card .subtitle {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 14px;
}

/* ─── Category Tabs ──────────────────────────────────────────────────────── */
.cat-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 14px;
    scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    font-family: var(--font-body);
    font-size: 12px; font-weight: 500;
    color: var(--text-mid);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}
.cat-tab svg { width: 14px; height: 14px; stroke-width: 2; }
.cat-tab:hover { background: var(--card-hover); color: var(--text); }
.cat-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.cat-tab.active svg { stroke: #fff; }

/* ─── Sliders ────────────────────────────────────────────────────────────── */
.cat-header {
    width: 100%;
    display: flex; align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--card);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text);
    margin-bottom: 0;
    transition: background var(--transition);
    text-align: left;
}
.cat-header:hover { background: var(--card-hover); }
.cat-header .cat-icon {
    width: 32px; height: 32px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-light); border-radius: var(--radius-xs);
}
.cat-header .cat-icon svg { width: 16px; height: 16px; color: var(--accent); }
.cat-header .cat-info { flex: 1; min-width: 0; }
.cat-header .cat-name {
    font-family: var(--font-heading); font-size: 13px; font-weight: 600;
    display: block; line-height: 1.2;
}
.cat-header .cat-sub {
    font-family: var(--font-body); font-weight: 400; font-size: 10px; color: var(--text-light);
    display: block; margin-top: 1px;
}
.cat-header .cat-arrow {
    flex-shrink: 0; font-size: 11px; color: var(--text-light);
    transition: transform var(--transition);
}
.cat-header .cat-arrow.open { transform: rotate(180deg); }
.cat-body {
    padding: 12px 14px 4px;
    background: var(--card);
    margin-bottom: 6px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    border: none;
}

.slider-row { margin-bottom: 16px; }
.slider-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.slider-label span:first-child { font-size: 12px; font-weight: 500; color: var(--text); }
.slider-val { font-family: var(--font-data); font-size: 11px; font-weight: 600; color: var(--text-light); min-width: 28px; text-align: right; transition: color var(--transition); }
.slider-val.active { color: var(--accent); }

input[type=range] {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 6px; border-radius: 3px;
    background: var(--border); outline: none; cursor: pointer;
    transition: background var(--transition);
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
    background: var(--accent); border: 2.5px solid #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,0.15);
    cursor: pointer; transition: transform 0.15s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type=range]::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--accent); border: 2.5px solid #fff; cursor: pointer;
}

.reset-btn {
    display: block; width: 100%; padding: 10px; margin-top: 10px;
    background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: var(--font-body); font-size: 12px; font-weight: 500; color: var(--text-light);
    cursor: pointer; transition: all var(--transition);
}
.reset-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ─── Population Filter ──────────────────────────────────────────────────── */
.pop-filter { position: relative; }
.pop-range-wrap {
    position: relative; height: 6px; margin: 12px 0 8px;
    background: var(--border); border-radius: 3px;
}
.pop-slider {
    position: absolute; top: -5px; left: 0; width: 100%;
    -webkit-appearance: none; appearance: none;
    background: transparent; pointer-events: none;
    height: 16px; margin: 0;
}
.pop-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--accent); border: 2.5px solid var(--card);
    box-shadow: 0 1px 6px rgba(0,0,0,0.3);
    cursor: pointer; pointer-events: auto;
    position: relative; z-index: 2;
}
.pop-slider::-moz-range-thumb {
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--accent); border: 2.5px solid var(--card);
    cursor: pointer; pointer-events: auto;
}
.pop-ticks {
    display: flex; justify-content: space-between;
    font-family: var(--font-data); font-size: 9px; color: var(--text-light);
}

/* ─── Map Reset Button ────────────────────────────────────────────────────── */
.map-wrap { position: relative; flex: 1; min-height: 200px; transition: flex 0.4s ease; }
.map-wrap #map { position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: var(--radius); }
.map-reset-btn {
    position: absolute; top: 10px; right: 10px; z-index: 1000;
    width: 36px; height: 36px; border-radius: var(--radius-xs);
    background: var(--card); border: 1px solid var(--border);
    color: var(--text-mid); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition);
}
.map-reset-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ─── Map Clusters ───────────────────────────────────────────────────────── */
.ag-cluster {
    display: flex; align-items: center; justify-content: center;
}
.ag-cluster .cluster-inner {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-family: var(--font-data); font-weight: 700; color: var(--dark);
    box-shadow: 0 2px 10px rgba(52,211,153,0.4);
    transition: transform 0.2s;
}
.ag-cluster .cluster-inner:hover { transform: scale(1.1); }
.ag-cluster-small .cluster-inner { font-size: 12px; background: rgba(52,211,153,0.85); }
.ag-cluster-medium .cluster-inner { font-size: 13px; background: rgba(45,212,191,0.85); }
.ag-cluster-large .cluster-inner { font-size: 14px; background: rgba(52,211,153,0.95); }
/* Override default markercluster styles */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: none !important; }
.marker-cluster div { background: none !important; }

/* ─── Map ────────────────────────────────────────────────────────────────── */
#map { z-index: 1; }

/* Leaflet zoom controls */
.leaflet-control-zoom {
    border: none !important;
    border-radius: var(--radius-sm) !important;
    overflow: hidden;
    box-shadow: var(--shadow-md) !important;
}
.leaflet-control-zoom a {
    background: var(--card) !important;
    color: var(--text-mid) !important;
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 16px !important;
    transition: color 0.15s, background 0.15s;
}
.leaflet-control-zoom a:last-child { border-bottom: none !important; }
.leaflet-control-zoom a:hover {
    background: var(--card-hover) !important;
    color: var(--accent) !important;
}

/* Dark popup card style */
.leaflet-popup-content-wrapper {
    background: var(--dark) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-pop) !important;
    color: #fff !important;
    font-family: var(--font-body) !important;
}
.leaflet-popup-content { margin: 0 !important; }
.leaflet-popup-tip { background: var(--dark) !important; }
.leaflet-popup-close-button { color: #fff !important; opacity: 0.5; font-size: 18px !important; top: 8px !important; right: 10px !important; }
.leaflet-popup-close-button:hover { opacity: 1; }

/* ─── Dark Popup ─────────────────────────────────────────────────────────── */
.popup-dark {
    width: 300px; padding: 0; overflow: hidden; border-radius: var(--radius);
    animation: scaleIn 0.2s ease both;
}
.popup-dark-img { width: 100%; height: 130px; object-fit: cover; display: block; }
.popup-dark-body { padding: 16px; }
.popup-dark-name {
    font-family: var(--font-heading); font-size: 16px; font-weight: 700;
    color: #fff; letter-spacing: -0.3px;
}
.popup-dark-sub { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 2px; }
.popup-dark-tagline { font-size: 12px; color: rgba(255,255,255,0.7); font-style: italic; margin-top: 6px; }

/* Stats row in dark popup */
.popup-dark-stats {
    display: flex; gap: 1px; margin-top: 14px;
    background: rgba(255,255,255,0.08); border-radius: var(--radius-sm); overflow: hidden;
}
.popup-dark-stat {
    flex: 1; padding: 10px 8px; text-align: center;
    background: var(--dark-card);
}
.popup-dark-stat-val {
    font-family: var(--font-data); font-size: 16px; font-weight: 700; color: #fff;
}
.popup-dark-stat-label {
    font-size: 9px; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px;
}
.popup-dark-vibes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; }
.popup-dark-vibes .vibe-tag {
    background: rgba(52,211,153,0.15); color: var(--accent);
    font-size: 9px; padding: 3px 8px; border-radius: 12px;
}
.popup-dark-link {
    display: block; text-align: center; padding: 12px 16px; margin-top: 14px;
    font-family: var(--font-heading); font-size: 12px; font-weight: 600;
    color: var(--accent); text-decoration: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    transition: color var(--transition);
    cursor: pointer;
}
.popup-dark-link:hover { color: #fff; }

/* ─── Scorecard Panel (Below Map) ────────────────────────────────────────── */
.scorecard-panel {
    flex: 0;
    max-height: 0;
    overflow: hidden;
    background: var(--card);
    border-radius: var(--radius);
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), flex 0.4s ease;
}
.scorecard-panel.open {
    flex: 1.2;
    max-height: 55vh;
    overflow-y: auto;
}
/* When scorecard is open, shrink map */
.map-area.scorecard-active .map-wrap { flex: 0.8; min-height: 180px; }
.scorecard-panel .sc-inner { padding: 0 20px 20px; }
.scorecard-panel .sc-back {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 12px 20px;
    font-family: var(--font-heading); font-size: 13px; font-weight: 600;
    color: var(--text-mid); cursor: pointer; border: none; background: none;
    transition: color var(--transition);
}
.scorecard-panel .sc-back:hover { color: var(--text); }
.scorecard-panel .sc-back svg { width: 16px; height: 16px; }

.sc-hero-row {
    display: flex; align-items: flex-start; gap: 20px;
    padding: 16px 20px;
}
.sc-hero-row .sc-header {
    flex: 1; min-width: 0; padding: 0;
}
.sc-hero-row .sc-hero-img {
    width: 42%; max-width: 260px; flex-shrink: 0;
    object-fit: cover; display: block;
    border-radius: var(--radius-sm);
    margin: 0;
    max-height: 220px;
}
.sc-hero-row .sc-vibes { padding: 0; margin-top: 10px; }
.sc-header { padding: 16px 20px 12px; }
.sc-header h2 {
    font-family: var(--font-heading); font-size: 20px; font-weight: 700;
    letter-spacing: -0.4px; margin-bottom: 2px;
}
.sc-header .sc-sub { font-size: 12px; color: var(--text-mid); }
.sc-header .sc-tagline { font-size: 13px; color: var(--text-mid); font-style: italic; margin-top: 6px; }
.sc-header .sc-desc { font-size: 13px; line-height: 1.6; margin-top: 10px; color: var(--text); }
.sc-vibes { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 16px 16px; }

.sc-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 18px;
    margin: 0 12px 12px;
    box-shadow: var(--shadow-sm);
    animation: slideUp 0.3s ease both;
}
.sc-card-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.sc-card-header svg { width: 18px; height: 18px; color: var(--accent); }
.sc-card-header h3 {
    font-family: var(--font-heading); font-size: 13px; font-weight: 700; flex: 1;
    letter-spacing: -0.1px;
}
.sc-card-header span { font-size: 10px; color: var(--text-light); }

.sc-data-row {
    display: flex; align-items: center; gap: 8px; padding: 6px 0;
}
.sc-data-label { font-size: 12px; color: var(--text-mid); flex: 1; min-width: 0; }
.sc-data-bar { width: 60px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; flex-shrink: 0; }
.sc-data-bar-fill { height: 100%; border-radius: 2px; animation: barFill 0.6s ease both; }
.sc-data-val { font-family: var(--font-data); font-size: 11px; font-weight: 600; min-width: 40px; text-align: right; }
.sc-data-note { font-size: 10px; color: var(--text-light); font-style: italic; padding: 0 0 4px; line-height: 1.3; }

/* Score badge in scorecard */
.sc-score-badge {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; margin: 0 12px 12px;
    background: var(--dark); color: #fff;
    border-radius: var(--radius);
}
.sc-score-badge .grade {
    width: 48px; height: 48px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-heading); font-size: 24px; font-weight: 700;
    background: var(--accent); color: var(--dark);
}
.sc-score-badge .score-detail { flex: 1; }
.sc-score-badge .score-num { font-family: var(--font-data); font-size: 22px; font-weight: 700; }
.sc-score-badge .score-label { font-size: 11px; color: rgba(255,255,255,0.5); }
.sc-score-bar { height: 6px; background: rgba(255,255,255,0.15); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.sc-score-bar-fill { height: 100%; border-radius: 3px; background: var(--accent); animation: barFill 0.8s ease both; }

/* Video/Vote in scorecard */
.sc-video { margin: 0 12px 12px; border-radius: var(--radius); overflow: hidden; }
.sc-vote-card {
    margin: 0 12px 12px; padding: 18px;
    background: var(--card); border: 1px dashed var(--accent);
    border-radius: var(--radius); text-align: center;
}
.sc-vote-card h4 { font-family: var(--font-heading); font-size: 13px; margin-bottom: 6px; }
.sc-vote-card p { font-size: 11px; color: var(--text-mid); margin-bottom: 12px; }
.sc-full-link {
    display: block; text-align: center; padding: 14px;
    font-family: var(--font-heading); font-size: 12px; font-weight: 600;
    color: var(--accent); text-decoration: none;
    transition: color var(--transition);
}
.sc-full-link:hover { color: var(--text); }

/* ─── Vibe Tags ──────────────────────────────────────────────────────────── */
.vibe-tag {
    font-family: var(--font-data); font-size: 10px; padding: 3px 10px; border-radius: 12px;
    background: var(--accent-light); color: var(--accent-dark); font-weight: 600;
}

.vibe-tag-highlight {
    background: var(--accent); color: var(--dark); font-weight: 700;
}
.vibe-tag-rating {
    background: #FBBF2425; color: #FBBF24; font-weight: 700;
}

/* Rating in dropdown */
.dropdown-rating {
    font-family: var(--font-data); font-size: 10px; color: #FBBF24; font-weight: 600; white-space: nowrap;
}

/* ─── Rankings ───────────────────────────────────────────────────────────── */
.ranking-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0;
    cursor: pointer;
    transition: opacity var(--transition);
}
.ranking-item:hover { opacity: 0.7; }
.ranking-item + .ranking-item { border-top: 1px solid var(--border); }
.ranking-medal { width: 24px; text-align: center; font-size: 14px; }
.ranking-num { font-family: var(--font-data); font-size: 10px; color: var(--text-light); width: 24px; text-align: center; }
.ranking-info { flex: 1; min-width: 0; }
.ranking-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking-bar { height: 3px; background: var(--border); border-radius: 2px; margin-top: 4px; }
.ranking-bar-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.ranking-grade { font-family: var(--font-heading); font-size: 14px; font-weight: 700; width: 20px; text-align: center; }

/* ─── Leaderboard ────────────────────────────────────────────────────────── */
.lb-row {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0; text-decoration: none; color: var(--text);
    transition: opacity var(--transition);
}
.lb-row:hover { opacity: 0.7; }
.lb-row + .lb-row { border-top: 1px solid var(--border); }

/* ─── Location Detail Page ───────────────────────────────────────────────── */
.detail-content { max-width: 800px; margin: 0 auto; padding: 24px; }

.rpg-card {
    background: var(--card); border-radius: var(--radius);
    padding: 24px; margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.rpg-card h2 { font-family: var(--font-heading); font-size: 15px; font-weight: 700; margin-bottom: 16px; letter-spacing: -0.2px; }
.rpg-card h3 { font-family: var(--font-heading); font-size: 12px; color: var(--text-mid); margin: 16px 0 10px; }

.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.data-item { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.data-label { font-size: 12px; color: var(--text-mid); }
.data-value { font-family: var(--font-data); font-size: 12px; font-weight: 600; }
.data-bar { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin: 0 10px; }
.data-bar-fill { height: 100%; border-radius: 3px; }
.data-note { width: 100%; font-size: 10px; color: var(--text-light); font-style: italic; margin-top: 2px; line-height: 1.3; }

/* ─── Sentiment Gauge ────────────────────────────────────────────────────── */
.sentiment-section { display: flex; align-items: center; gap: 20px; margin: 16px 0 8px; }
.sentiment-gauge-wrap { flex: 1; }
.sentiment-gauge {
    position: relative; height: 14px; border-radius: 7px; overflow: visible;
    background: linear-gradient(90deg, #EF4444 0%, #F59E0B 25%, #FBBF24 50%, #2DD4BF 75%, #34D399 100%);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.12);
}
.sentiment-marker {
    position: absolute; top: 50%; width: 4px; height: 24px;
    background: #fff; border-radius: 2px;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    transition: left 0.5s ease;
}
.sentiment-labels {
    display: flex; justify-content: space-between; margin-top: 6px;
    font-family: var(--font-data); font-size: 9px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px;
}
.sentiment-score {
    font-family: var(--font-heading); font-size: 36px; font-weight: 700; line-height: 1; white-space: nowrap;
}
.sentiment-score span { font-size: 14px; color: var(--text-light); font-weight: 400; }

/* ─── Detail Page Hero Card ──────────────────────────────────────────────── */
.detail-hero-card { padding: 0; overflow: hidden; }
.detail-hero-img { width: 100%; height: 240px; object-fit: cover; display: block; }
.detail-hero-body { padding: 24px; }
.detail-hero-body h1 { font-family: var(--font-heading); font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.detail-hero-body .state { font-family: var(--font-data); color: var(--text-mid); font-size: 13px; margin-top: 2px; }
.detail-hero-body .tagline { font-size: 14px; color: var(--text-mid); font-style: italic; margin: 10px 0 14px; }
.detail-hero-body .desc { font-size: 14px; line-height: 1.7; max-width: 640px; }
.detail-vibes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.detail-quick-stats {
    display: flex; gap: 1px; margin-top: 20px;
    background: var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.quick-stat {
    flex: 1; padding: 14px 16px; text-align: center;
    background: var(--bg);
}
.quick-stat-val { font-family: var(--font-data); font-size: 18px; font-weight: 700; display: block; color: var(--accent); }
.quick-stat-label { font-size: 10px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; display: block; }

/* Legacy hero image class (keep for backwards compat) */
.detail-hero-image { width: 100%; max-height: 300px; overflow: hidden; }
.detail-hero-image img { width: 100%; height: 300px; object-fit: cover; display: block; }

/* ─── Video Embed ────────────────────────────────────────────────────────── */
.video-embed { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--radius-sm); margin-top: 12px; }
.video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

/* ─── Vote Card ──────────────────────────────────────────────────────────── */
.vote-card { background: linear-gradient(135deg, var(--card), rgba(52,211,153,0.05)); border: 1px dashed var(--accent); }
.vote-inner { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.vote-text { flex: 1; min-width: 200px; }
.vote-text h3 { font-family: var(--font-heading); font-size: 15px; font-weight: 700; margin: 0 0 6px; }
.vote-text p { font-size: 12px; color: var(--text-mid); margin: 0; }
.vote-action { text-align: center; }
.vote-btn {
    display: inline-block; padding: 10px 20px; font-family: var(--font-heading); font-size: 13px; font-weight: 700;
    background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.vote-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(212,168,67,0.3); }
.vote-btn.voted { background: var(--text-light); cursor: default; }
.vote-count { display: block; font-family: var(--font-data); font-size: 11px; color: var(--text-mid); margin-top: 6px; }

/* ─── Photo Gallery ──────────────────────────────────────────────────────── */
.photo-gallery, .sc-gallery {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 6px;
}
.gallery-img, .sc-gallery-img {
    width: 100%; height: 80px; object-fit: cover; display: block;
    border-radius: var(--radius-xs); cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
}
.gallery-img:hover, .sc-gallery-img:hover { opacity: 0.85; transform: scale(1.03); }

/* Lightbox */
.lightbox-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.9);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    animation: fadeIn 0.2s ease;
}
.lightbox-img {
    max-width: 90vw; max-height: 90vh;
    border-radius: var(--radius);
    object-fit: contain;
    box-shadow: 0 0 60px rgba(0,0,0,0.5);
    cursor: default;
}
.lightbox-close {
    position: absolute; top: 20px; right: 24px;
    background: none; border: none; color: #fff;
    font-size: 32px; cursor: pointer; opacity: 0.7;
    transition: opacity 0.2s;
}
.lightbox-close:hover { opacity: 1; }

/* ─── Comments ───────────────────────────────────────────────────────────── */
.comments-section { margin-top: 24px; }
.comment {
    background: var(--card); border-radius: var(--radius-sm);
    padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
}
.comment-meta { font-family: var(--font-data); font-size: 11px; color: var(--text-light); margin-bottom: 6px; }
.comment-author { font-weight: 600; color: var(--text); }
.comment-rating { color: var(--accent); }
.comment-body { font-size: 13px; line-height: 1.6; }

.comment-form { background: var(--card); border-radius: var(--radius); padding: 20px; margin-top: 16px; box-shadow: var(--shadow-sm); }
.comment-form h3 { font-family: var(--font-heading); font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.form-row input, .form-row textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: var(--font-body); font-size: 13px; background: var(--bg);
    transition: border-color var(--transition);
}
.form-row input:focus, .form-row textarea:focus { border-color: var(--accent); outline: none; }
.form-row textarea { min-height: 80px; resize: vertical; }
.form-row select {
    padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: var(--font-body); font-size: 13px; background: var(--bg);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-block; padding: 10px 20px; border: none; border-radius: var(--radius-sm);
    font-family: var(--font-heading); font-size: 12px; font-weight: 600; cursor: pointer;
    text-decoration: none; transition: all var(--transition);
}
.btn-green { background: var(--accent); color: #fff; }
.btn-green:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-mid); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 11px; }

/* ─── Flash Messages ─────────────────────────────────────────────────────── */
.flash {
    padding: 12px 20px; border-radius: var(--radius-sm); margin: 16px 24px; font-size: 13px;
    animation: slideUp 0.3s ease both;
}
.flash-success { background: rgba(52,211,153,0.15); color: var(--accent); }
.flash-error { background: rgba(239,68,68,0.15); color: #FCA5A5; }

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
.mobile-toggle {
    display: none; position: fixed; bottom: 20px; right: 20px; z-index: 200;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--dark); color: #fff; border: none; font-size: 20px; cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s;
}
.mobile-toggle:active { transform: scale(0.95); }

@media (max-width: 768px) {
    .main-layout { grid-template-columns: 1fr; }
    .map-area { padding: 8px; }
    .sidebar {
        position: fixed; bottom: 0; left: 0; right: 0; top: auto;
        width: 100%; max-height: 60vh; z-index: 150;
        border-radius: var(--radius) var(--radius) 0 0;
        transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -8px 40px rgba(0,0,0,0.3);
    }
    .sidebar::before {
        content: ''; display: block; width: 40px; height: 4px;
        background: var(--border); border-radius: 2px; margin: 8px auto 4px;
    }
    .sidebar.open { transform: translateY(0); }
    .mobile-toggle { display: flex; align-items: center; justify-content: center; }
    .toolbar-pill span { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
    .detail-hero { padding: 20px 16px; }
    .detail-content { padding: 16px; }
    .data-grid { grid-template-columns: 1fr; }
    .popup-dark { width: 260px; }
    .scorecard-panel.open { max-height: 50vh; }
}

/* ─── Admin ──────────────────────────────────────────────────────────────── */
.admin-layout { max-width: 900px; margin: 0 auto; padding: 24px; }
.admin-layout h1 { font-family: var(--font-heading); font-size: 20px; font-weight: 700; margin-bottom: 20px; color: var(--text); }
.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.admin-table th { font-family: var(--font-data); font-size: 11px; color: var(--text-light); text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--dark); }
.admin-table td { font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table a { color: var(--accent); }
.admin-actions { display: flex; gap: 6px; }

/* Admin form overrides for dark mode readability */
.admin-layout .form-row label { color: var(--text); }
.admin-layout .form-row input,
.admin-layout .form-row textarea,
.admin-layout .form-row select,
.admin-layout input[type="text"],
.admin-layout input[type="number"],
.admin-layout input[type="url"],
.admin-layout input[type="file"],
.admin-layout textarea,
.admin-layout select {
    background: var(--dark); color: var(--text); border: 1px solid var(--border);
    border-radius: var(--radius-xs); padding: 10px 12px;
    font-family: var(--font-body); font-size: 13px;
}
.admin-layout input::placeholder,
.admin-layout textarea::placeholder { color: var(--text-light); }
.admin-layout input:focus,
.admin-layout textarea:focus,
.admin-layout select:focus { border-color: var(--accent); outline: none; }
.admin-layout .rpg-card { background: var(--card); border: 1px solid var(--border); color: var(--text); }
.admin-layout .rpg-card h2 { color: var(--text); }
.admin-layout code { background: var(--dark); color: var(--accent); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* Admin header bar */
.admin-layout .site-header a { color: var(--text-mid); }

/* Admin tabs */
.admin-layout .flash { margin: 16px 0; }
