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

body {
    font-family: 'DM Sans', -apple-system, sans-serif;
    background: #0e1525;
    color: #e0e4ec;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: #e0e4ec; text-decoration: none; }
a:hover { color: #fff; }

/* ── Nav ────────────────────────────────────────────────────── */
nav {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 20px 32px;
    border-bottom: 1px solid #1c2a42;
    background: #0e1525;
    position: sticky;
    top: 0;
    z-index: 50;
}

nav .logo {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: 20px;
    letter-spacing: -0.3px;
    color: #e0e4ec;
}

nav a.nav-link {
    font-size: 14px;
    color: #6b7a94;
    font-weight: 500;
    transition: color 0.15s;
}

nav a.nav-link:hover,
nav a.nav-link.active {
    color: #5dbd72;
}

/* ── Layout ─────────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.section-title {
    font-family: 'DM Serif Display', serif;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.5px;
    color: #6b7a94;
    margin-bottom: 16px;
    margin-top: 40px;
}

.section-title:first-child { margin-top: 0; }

/* ── Stat Cards ─────────────────────────────────────────────── */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.card {
    background: #152038;
    border: 1px solid #1c2a42;
    border-radius: 16px;
    padding: 20px 24px;
}

.card .label {
    font-size: 12px;
    color: #6b7a94;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 500;
}

.card .value {
    font-family: 'DM Serif Display', serif;
    font-size: 28px;
    font-weight: 400;
    letter-spacing: -0.5px;
    color: #e0e4ec;
}

.card .change {
    font-size: 13px;
    margin-top: 6px;
    font-weight: 500;
}

.card .change.up { color: #5dbd72; }
.card .change.down { color: #e05c4a; }

/* ── Charts ─────────────────────────────────────────────────── */
.chart-container {
    background: #152038;
    border: 1px solid #1c2a42;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.chart-container h3 {
    font-family: 'DM Serif Display', serif;
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 16px;
    color: #8a9ab4;
}

.chart-wrapper {
    position: relative;
    height: 300px;
}

/* ── Tables ─────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    text-align: left;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7a94;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #1c2a42;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid #152038;
    color: #8a9ab4;
}

tr:hover td {
    background: #1a2840;
    color: #e0e4ec;
}

td a { color: #8a9ab4; transition: color 0.15s; }
td a:hover { color: #5dbd72; }

.text-right { text-align: right; }

/* ── Area Grid ──────────────────────────────────────────────── */
.area-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.area-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #152038;
    border: 1px solid #1c2a42;
    border-radius: 14px;
    padding: 16px 20px;
    transition: border-color 0.2s;
}

.area-card:hover { border-color: #2a3d5c; }
.area-card .area-name { font-size: 14px; font-weight: 600; }
.area-card .area-stats { text-align: right; font-size: 13px; color: #6b7a94; }
.area-card .area-price { font-weight: 600; color: #5dbd72; }

/* ── Badge ──────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #1c2a42;
    color: #6b7a94;
    font-weight: 500;
}

/* ── Filters ────────────────────────────────────────────────── */
.filter-label {
    font-size: 12px;
    color: #6b7a94;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    font-weight: 500;
}

.filter-select {
    background: #152038;
    color: #e0e4ec;
    border: 1px solid #1c2a42;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    outline: none;
}

.filter-select:hover { border-color: #2a3d5c; }
.filter-select:focus { border-color: #5dbd72; }

/* ── Map ────────────────────────────────────────────────────── */
.leaflet-container { background: #0e1525 !important; }

.map-tooltip {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    background: #152038;
    border: 1px solid #1c2a42;
    border-radius: 12px;
    padding: 12px 16px;
    color: #e0e4ec;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.map-tooltip .tt-county {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    font-size: 15px;
    margin-bottom: 4px;
}

.map-tooltip .tt-stat { color: #8a9ab4; font-size: 12px; }
.map-tooltip .tt-price { color: #5dbd72; font-weight: 600; }

.map-back-btn {
    display: none;
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1000;
    background: #152038;
    color: #e0e4ec;
    border: 1px solid #1c2a42;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: background 0.15s;
    font-weight: 500;
}

.map-back-btn:hover { background: #1a2840; }

/* ── Counties Page ──────────────────────────────────────────── */
.county-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
    border-bottom: 1px solid #1c2a42;
    -webkit-overflow-scrolling: touch;
}

.county-tab {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7a94;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 10px 10px 0 0;
    transition: all 0.15s;
    border-bottom: 2px solid transparent;
}

.county-tab:hover { color: #e0e4ec; background: #152038; }
.county-tab.active { color: #5dbd72; border-bottom-color: #5dbd72; }

.county-heatmap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 24px;
}

.hm-cell {
    padding: 14px 12px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.hm-cell:hover { transform: scale(1.04); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); }
.hm-cell .hm-name { font-size: 12px; font-weight: 600; }
.hm-cell .hm-price { font-family: 'DM Serif Display', serif; font-size: 16px; font-weight: 400; margin-top: 3px; }
.hm-cell .hm-rent { font-size: 11px; color: rgba(255, 255, 255, 0.7); margin-top: 2px; }

.area-item {
    background: #152038;
    border: 1px solid #1c2a42;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.area-item .ai-code { font-size: 14px; font-weight: 600; color: #e0e4ec; }
.area-item .ai-stats { text-align: right; font-size: 13px; }
.area-item .ai-price { color: #5dbd72; font-weight: 600; }
.area-item .ai-vol { color: #6b7a94; font-size: 12px; }

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
    nav { padding: 16px; gap: 20px; }
    .container { padding: 20px 16px; }
    .cards { grid-template-columns: 1fr 1fr; }
    .card .value { font-size: 22px; }
    .chart-wrapper { height: 220px; }
}
