/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --border: #475569;
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;

    /* Marker colors */
    --marker-rural: #ef4444;
    --marker-town: #3b82f6;
    --marker-semi-rural: #eab308;

    --panel-width: 360px;
    --transition: 0.2s ease;
}

/* ===== Map Controls & Layers ===== */
.layer-manager {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 250px;
    font-family: 'Segoe UI', sans-serif;
}

.layer-header h3 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #2c3e50;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 5px;
}

.layer-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.layer-item input {
    margin-top: 4px;
}

.layer-item label {
    font-size: 0.9rem;
    cursor: pointer;
    flex: 1;
}

.layer-desc {
    font-size: 0.75rem;
    color: #7f8c8d;
    margin-top: 2px;
}

.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
}

body {
    display: flex;
    overflow: hidden;
}

/* ===== Search Panel ===== */
.search-panel {
    width: var(--panel-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.panel-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border-bottom: 1px solid var(--border);
}

.panel-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.panel-header .subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== Search Section ===== */
.search-section {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.search-box {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 0.5rem;
    border: 1px solid var(--border);
    transition: border-color var(--transition);
}

.search-box:focus-within {
    border-color: var(--accent);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all var(--transition);
}

.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* ===== Filters Section ===== */
.filters-section {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
}

.filter-group select:focus {
    border-color: var(--accent);
}

/* ===== Results Section ===== */
.results-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--bg-tertiary);
    font-size: 0.85rem;
}

#resultsCount {
    color: var(--text-secondary);
}

.btn-secondary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background var(--transition);
}

.btn-secondary:hover {
    background: var(--accent-hover);
}

.results-list {
    flex: 1;
    overflow-y: auto;
    list-style: none;
}

.results-list li {
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
}

.results-list li:hover {
    background: var(--bg-tertiary);
}

.results-list li.active {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
}

.result-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.result-item-id {
    font-weight: 600;
    font-size: 0.9rem;
}

.result-item-name {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.result-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.type-badge {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.25rem;
}

.type-badge.rural {
    background: var(--marker-rural);
}

.type-badge.town {
    background: var(--marker-town);
}

.type-badge.semi-rural {
    background: var(--marker-semi-rural);
}

/* ===== Legend ===== */
.legend {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.legend h3 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-marker.rural {
    background: var(--marker-rural);
}

.legend-marker.town {
    background: var(--marker-town);
}

.legend-marker.semi-rural {
    background: var(--marker-semi-rural);
}

/* ===== Neighbors Section ===== */
.neighbors-section {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.neighbors-section h3 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.neighbor-toggle {
    margin-bottom: 0.5rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.35rem 0;
    transition: opacity var(--transition);
}

.toggle-label:hover {
    opacity: 0.8;
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.toggle-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}


/* ===== Map Container ===== */
#map {
    flex: 1;
    height: 100vh;
}

/* ===== Map Controls ===== */

.map-controls {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

.btn-control {
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-control:hover {
    background: var(--bg-tertiary);
    transform: scale(1.05);
}

/* ===== Custom Leaflet Popup ===== */
.leaflet-popup-content-wrapper {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-tip {
    background: var(--bg-secondary);
}

.leaflet-popup-content {
    margin: 0.75rem 1rem;
}

.popup-content h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.popup-content .popup-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.popup-content .popup-coords {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.popup-details-btn {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
}

.popup-details-btn:hover {
    background: var(--accent-hover);
}


/* ===== Custom Markers ===== */
.custom-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.custom-marker.rural {
    background: var(--marker-rural);
}

.custom-marker.town {
    background: var(--marker-town);
}

.custom-marker.semi-rural {
    background: var(--marker-semi-rural);
}

/* ===== Country Labels ===== */
.country-label {
    background: transparent !important;
    border: none !important;
    text-align: center;
    pointer-events: none;
}

.country-label span {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-weight: 600;
    letter-spacing: 2px;
    text-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.8),
        -1px -1px 2px rgba(0, 0, 0, 0.6),
        1px -1px 2px rgba(0, 0, 0, 0.6),
        -1px 1px 2px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
}

.country-label-large span {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
}

.country-label-medium span {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.55);
}

.country-label-small span {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
}

.country-label-title span {
    font-size: 22px;
    font-weight: 700;
    color: #3b82f6;
    letter-spacing: 4px;
    text-shadow:
        2px 2px 6px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(59, 130, 246, 0.5);
}

.senegal-title {
    color: #3b82f6 !important;
}


/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .search-panel {
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        height: auto;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    #map {
        height: 50vh;
        margin-top: 50vh;
    }

    .map-controls {
        top: auto;
        bottom: 1rem;
    }
}

/* ===== Detail Panel ===== */
.detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.detail-panel.visible {
    transform: translateX(0);
}

.detail-panel.hidden {
    transform: translateX(100%);
}

.detail-panel-content {
    height: 100%;
    overflow-y: auto;
    padding: 1.5rem;
}

.btn-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 10;
}

.btn-close:hover {
    background: var(--danger);
    border-color: var(--danger);
}

.detail-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-right: 2.5rem;
}

.type-badge-large {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}

.type-badge-large.rural {
    background: var(--marker-rural);
}

.type-badge-large.town {
    background: var(--marker-town);
}

.type-badge-large.semi-rural {
    background: var(--marker-semi-rural);
}

.detail-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.detail-id {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: monospace;
}

.detail-section {
    background: var(--bg-primary);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.detail-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.detail-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-coords {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-coords code {
    font-size: 0.85rem;
    color: var(--accent);
    font-family: 'Consolas', 'Monaco', monospace;
}

.detail-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-list-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.detail-list-item .item-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.detail-list-item .item-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    text-align: right;
}

.detail-list-item .item-value.status-yes {
    color: var(--success);
}

.detail-list-item .item-value.status-no {
    color: var(--danger);
}

.detail-list-item .item-value.status-partial {
    color: var(--warning);
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.detail-tag {
    background: var(--accent);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.detail-notes {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-style: italic;
}

/* ===== Classification Section ===== */
.classification-section {
    border-left: 4px solid var(--accent);
}

.classification-badge {
    display: inline-flex;
    margin-bottom: 1rem;
}

.badge-type {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.badge-type.rural {
    background: var(--marker-rural);
    color: white;
}

.badge-type.periurban {
    background: var(--marker-semi-rural);
    color: #1a1a2e;
}

.badge-type.urban {
    background: var(--marker-town);
    color: white;
}

.classification-reasoning {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.reasoning-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    border-left: 3px solid var(--accent);
    line-height: 1.4;
}

.reasoning-item.reasoning-legacy {
    border-left-color: var(--warning);
    color: var(--text-muted);
    font-style: italic;
}

.classification-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

/* Detail panel responsive */
@media (max-width: 768px) {
    .detail-panel {
        width: 100%;
    }
}

/* ===== Admin Dashboard Styles ===== */
.admin-body {
    display: flex;
    width: 100%;
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    /* Prevent full body scroll, content scrolls */
}

/* Nav */
.admin-nav {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    flex-shrink: 0;
}

.nav-brand {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.nav-brand h1 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.nav-links {
    list-style: none;
    padding: 1rem 0;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-links li a:hover,
.nav-links li.active a {
    background: var(--bg-tertiary);
    color: var(--accent);
    border-left-color: var(--accent);
}

/* Content Area */
.admin-content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-trend {
    font-size: 0.85rem;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Data Table */
.data-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.section-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-actions {
    display: flex;
    gap: 10px;
}

#adminSearch {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.table-container {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th {
    background: var(--bg-tertiary);
    text-align: left;
    padding: 12px 1.5rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.admin-table td {
    padding: 12px 1.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.admin-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.status-badge {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-active {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.status-no_stove {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.cell-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Bento Grid Layout */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto auto auto;
    gap: 1.5rem;
    padding-bottom: 2rem;
}

/* Zone Definitions */
.zone-metrics {
    grid-column: 1 / -1;
    /* Full width */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.zone-chart-do {
    grid-column: 1 / 2;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.5rem;
    min-height: 300px;
}

.zone-chart-bar {
    grid-column: 2 / -1;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.5rem;
    min-height: 300px;
}

.zone-table {
    grid-column: 1 / -1;
}

/* Metric Cards */
.metric-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.icon-blue {
    background: rgba(52, 152, 219, 0.1);
    color: #3498DB;
}

.icon-green {
    background: rgba(39, 174, 96, 0.1);
    color: #27AE60;
}

.icon-teal {
    background: rgba(26, 188, 156, 0.1);
    color: #1ABC9C;
}

.icon-orange {
    background: rgba(243, 156, 18, 0.1);
    color: #F39C12;
}

.metric-info h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.metric-info .label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Toggles & Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.toggle-group {
    display: flex;
    gap: 1.5rem;
}

.toggle-switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: var(--border);
    border-radius: 20px;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Chart Containers */
.chart-container-sm {
    position: relative;
    height: 250px;
    width: 100%;
}

.chart-container-lg {
    position: relative;
    height: 250px;
    width: 100%;
}

/* Responsive Grid */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }

    .zone-chart-do,
    .zone-chart-bar {
        grid-column: 1 / -1;
    }
}

/* ===== Classification Display ===== */
.classification-section {
    margin-top: 1rem;
}

.classification-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.badge-type {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-type.urban {
    background: rgba(59, 130, 246, 0.2);
    color: var(--marker-town);
    border: 1px solid var(--marker-town);
}

.badge-type.rural {
    background: rgba(239, 68, 68, 0.2);
    color: var(--marker-rural);
    border: 1px solid var(--marker-rural);
}

.badge-type.periurban {
    background: rgba(234, 179, 8, 0.2);
    color: var(--marker-semi-rural);
    border: 1px solid var(--marker-semi-rural);
}

.classification-reasoning {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.reasoning-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.25rem 0;
    line-height: 1.4;
}

.reasoning-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    margin-bottom: 0.25rem;
}

.reasoning-legacy {
    color: var(--text-muted);
    font-style: italic;
}

.classification-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}