/* ============================================================
   accident-route.fr — Design System
   Mode Light par défaut, Dark mode toggle
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* === CSS Variables === */
:root {
    /* Light mode (default) */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-glass: rgba(255, 255, 255, 0.7);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-inverse: #f1f5f9;
    
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    
    --accent-primary: #2563eb;
    --accent-primary-hover: #1d4ed8;
    --accent-primary-light: #dbeafe;
    --accent-primary-bg: rgba(37, 99, 235, 0.08);
    
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --danger-bg: rgba(220, 38, 38, 0.08);
    --warning: #d97706;
    --warning-light: #fffbeb;
    --warning-bg: rgba(217, 119, 6, 0.08);
    --success: #16a34a;
    --success-light: #f0fdf4;
    --info: #3b82f6;
    --info-light: #eff6ff;
    
    /* Gravité */
    --color-mortel: #dc2626;
    --color-hospitalise: #f59e0b;
    --color-blesse: #3b82f6;
    --color-indemne: #6b7280;
    --radar: #7c3aed;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    --max-width: 1280px;
    --nav-height: 64px;
    --map-height: 500px;
}

/* === Dark Mode === */
[data-theme="dark"] {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-tertiary: #1a1a24;
    --bg-card: #16161f;
    --bg-card-hover: #1e1e2a;
    --bg-glass: rgba(22, 22, 31, 0.8);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-inverse: #0f172a;
    
    --border-color: #2d2d3a;
    --border-subtle: #1e1e2a;
    
    --accent-primary-light: rgba(37, 99, 235, 0.15);
    --accent-primary-bg: rgba(37, 99, 235, 0.12);
    
    --danger-light: rgba(220, 38, 38, 0.12);
    --danger-bg: rgba(220, 38, 38, 0.15);
    --warning-light: rgba(217, 119, 6, 0.12);
    --warning-bg: rgba(217, 119, 6, 0.15);
    --success-light: rgba(22, 163, 74, 0.12);
    --info-light: rgba(59, 130, 246, 0.12);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; }

/* === Layout === */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.page-content {
    padding: 32px 0 80px;
}

/* === Navigation === */
.nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    height: var(--nav-height);
    transition: background var(--transition);
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}

.nav-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--danger), var(--warning));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.nav-links a {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
    background: var(--accent-primary-bg);
}

.nav-mobile-search { display: none; }

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition);
    color: var(--text-secondary);
}
.theme-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: scale(1.05);
}

/* Search bar nav */
.nav-search {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0 4px 0 14px;
    transition: all var(--transition);
    max-width: 280px;
    flex: 1;
}
.nav-search:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-bg);
}
.nav-search input {
    background: none;
    border: none;
    outline: none;
    padding: 8px 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    width: 100%;
    font-family: inherit;
}
.nav-search input::placeholder {
    color: var(--text-tertiary);
}
.nav-search button {
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-full);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    flex-shrink: 0;
    transition: all var(--transition);
}
.nav-search button:hover {
    background: var(--accent-primary-hover);
}

/* Mobile menu */
.nav-burger {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.nav-burger span {
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition);
}

/* === Hero === */
.hero {
    padding: 60px 0 40px;
    text-align: center;
    position: relative;
}

.home-hero {
    min-height: calc(100vh - var(--nav-height));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-image: linear-gradient(var(--border-color) 1px, transparent 1px), linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center top;
    padding: 40px 24px;
}
.home-hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: max(150px, 15vh);
    background: linear-gradient(to bottom, transparent, var(--bg-primary));
    pointer-events: none;
    z-index: 1;
}

/* Hero Floating Stats (Glassmorphism) */
.hero-floating-stats {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 16px 32px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: max-content;
    max-width: 90vw;
    overflow-x: auto;
    scrollbar-width: none;
}

/* Masquer la barre de stats quand les suggestions de recherche sont ouvertes */
.home-hero:has(.search-suggestions.active) .hero-floating-stats {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.hero-floating-stats::-webkit-scrollbar { display: none; }

.floating-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.f-stat-val {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-primary);
    line-height: 1.1;
}
.f-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.floating-stat-delim {
    width: 1px;
    height: 30px;
    background: var(--border-color);
}

/* Trending chips */
.trend-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all var(--transition);
    text-decoration: none;
}
.trend-chip:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
    .hero-floating-stats {
        bottom: 15px;
        padding: 12px 20px;
        gap: 15px;
    }
    .f-stat-val { font-size: 1.1rem; }
    .f-stat-label { font-size: 0.65rem; }
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 900;
    line-height: 1.15;
    margin-bottom: 16px;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto 40px;
    line-height: 1.6;
}

/* === Stats Hero Grid === */
.stats-hero {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-accent, var(--accent-primary));
    opacity: 0;
    transition: opacity var(--transition);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--stat-accent, var(--accent-primary));
}
.stat-card:hover::before {
    opacity: 1;
}
.stat-card.danger { --stat-accent: var(--danger); }
.stat-card.warning { --stat-accent: var(--warning); }
.stat-card.info { --stat-accent: var(--info); }
.stat-card.success { --stat-accent: var(--success); }

.stat-icon {
    font-size: 1.6rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--stat-accent, var(--accent-primary));
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.stat-trend {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}
.stat-trend.down {
    color: var(--success);
    background: var(--success-light);
}
.stat-trend.up {
    color: var(--danger);
    background: var(--danger-light);
}

/* === Search Box === */
.search-box {
    max-width: 560px;
    margin: 0 auto 40px;
    position: relative;
    z-index: 50;
}

.search-input-group {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 6px 6px 6px 24px;
    transition: all var(--transition);
    box-shadow: var(--shadow-md);
}
.search-input-group:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-primary-bg), var(--shadow-lg);
}

.search-input-group input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    padding: 12px 12px 12px 0;
}
.search-input-group input::placeholder {
    color: var(--text-tertiary);
}

.search-input-group .btn-search {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: inherit;
}
.search-input-group .btn-search:hover {
    background: var(--accent-primary-hover);
    transform: scale(1.02);
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    margin-top: 8px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 500;
    display: none;
}
.search-suggestions.active {
    display: block;
}
.search-suggestion {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border-subtle);
}
.search-suggestion:last-child {
    border-bottom: none;
}
.search-suggestion:hover {
    background: var(--bg-tertiary);
}
.search-suggestion .sg-name {
    font-weight: 600;
    font-size: 0.95rem;
}
.search-suggestion .sg-info {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* === Map === */
.map-section {
    margin-bottom: 40px;
}

.map-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.map-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.map-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.filter-btn:hover,
.filter-btn.active {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--accent-primary-light);
}
.filter-btn.mortel.active {
    border-color: var(--color-mortel);
    color: var(--color-mortel);
    background: var(--danger-light);
}
.filter-btn.grave.active {
    border-color: var(--color-hospitalise);
    color: var(--color-hospitalise);
    background: var(--warning-light);
}

#map {
    height: var(--map-height);
    width: 100%;
    z-index: 1;
}

.map-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* === Cards Grid === */
.section-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title .emoji {
    font-size: 1.3rem;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
    color: inherit;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.card-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--accent-primary-light);
    color: var(--accent-primary);
}

.card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.card-stat {
    text-align: center;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
}

.card-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.card-stat-label {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* === Data Table === */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 40px;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.table-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    background: var(--bg-tertiary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
}

table td {
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.9rem;
    vertical-align: middle;
}

table tr:hover td {
    background: var(--bg-tertiary);
}

table a {
    font-weight: 600;
}

/* Gravité badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-mortel {
    background: var(--danger-light);
    color: var(--color-mortel);
}
.badge-grave {
    background: var(--warning-light);
    color: var(--color-hospitalise);
}
.badge-leger {
    background: var(--info-light);
    color: var(--color-blesse);
}
.badge-indemne {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
}

/* === Charts === */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.chart-canvas-wrap {
    position: relative;
    height: 280px;
}

/* === Breadcrumb === */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}
.breadcrumb a:hover {
    color: var(--accent-primary);
}
.breadcrumb .sep {
    color: var(--text-tertiary);
    font-size: 0.7rem;
}

/* === Pagination === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 32px 0;
}
.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
}
.pagination a:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--accent-primary-bg);
}
.pagination .active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* === Footer === */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
    margin-top: 60px;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
}

.footer-brand {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}

.footer-col h4 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.footer-col ul {
    list-style: none;
}
.footer-col li {
    margin-bottom: 8px;
}
.footer-col a {
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: color var(--transition);
}
.footer-col a:hover {
    color: var(--accent-primary);
}

.footer-bottom {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px 24px 0;
    margin-top: 32px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.footer-data-source {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* === Detail page === */
.page-header {
    margin-bottom: 32px;
}
.page-header h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}
.page-header .subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* Accident detail */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.detail-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.9rem;
}
.detail-row:last-child {
    border-bottom: none;
}
.detail-label {
    color: var(--text-secondary);
}
.detail-value {
    font-weight: 600;
    text-align: right;
}

/* === Leaflet overrides === */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-content {
    margin: 12px 16px !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
}

.popup-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.popup-detail {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Cluster override */
.marker-cluster-small {
    background-color: rgba(59, 130, 246, 0.25) !important;
}
.marker-cluster-small div {
    background-color: var(--color-blesse) !important;
    color: white !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 700 !important;
}
.marker-cluster-medium {
    background-color: rgba(245, 158, 11, 0.25) !important;
}
.marker-cluster-medium div {
    background-color: var(--color-hospitalise) !important;
    color: white !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 700 !important;
}
.marker-cluster-large {
    background-color: rgba(220, 38, 38, 0.25) !important;
}
.marker-cluster-large div {
    background-color: var(--color-mortel) !important;
    color: white !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 700 !important;
}

/* === Animations === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes countUp {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-in {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.animate-in:nth-child(1) { animation-delay: 0s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }
.animate-in:nth-child(6) { animation-delay: 0.3s; }

/* === Responsive === */
@media (max-width: 1024px) {
    .footer-inner {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --nav-height: 56px;
        --map-height: 350px;
    }
    
    .container { padding: 0 16px; }
    
    .nav-links { display: none; }
    .nav-search { display: none; }
    .nav-burger { display: flex; }
    .nav-mobile-search { display: list-item; }
    
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--bg-glass);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border-color);
        padding: 16px;
    }
    
    .hero { padding: 32px 0 24px; }
    
    .stats-hero {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-card { padding: 16px; }
    .stat-value { font-size: 1.4rem; }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
    }
}

@media (max-width: 480px) {
    .stats-hero {
        grid-template-columns: 1fr 1fr;
    }
    
    .search-input-group {
        padding: 4px 4px 4px 16px;
    }
    
    .search-input-group .btn-search {
        padding: 10px 20px;
    }
}

/* === Skeleton Loading === */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-color) 37%, var(--bg-tertiary) 63%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === Radar marker on map === */
.radar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: #7c3aed;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    font-size: 10px;
    color: white;
    font-weight: 700;
}

/* === Dark mode Leaflet === */
[data-theme="dark"] .leaflet-popup-content-wrapper,
[data-theme="dark"] .leaflet-popup-tip {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .leaflet-popup-content {
    color: var(--text-primary) !important;
}
[data-theme="dark"] .popup-detail {
    color: var(--text-secondary) !important;
}
[data-theme="dark"] .leaflet-control-zoom a {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}
[data-theme="dark"] .leaflet-control-attribution {
    background: var(--bg-glass) !important;
    color: var(--text-tertiary) !important;
}

/* Search suggestion links */
a.search-suggestion {
    color: inherit;
    text-decoration: none;
}
a.search-suggestion:hover {
    color: inherit;
}

/* Smooth scroll to sections */
section {
    scroll-margin-top: calc(var(--nav-height) + 20px);
}

/* Table responsive overflow indicator */
.table-container {
    position: relative;
}

@media (max-width: 768px) {
    .map-header {
        padding: 12px 16px;
    }
    .map-filters {
        gap: 4px;
    }
    .filter-btn {
        padding: 4px 10px;
        font-size: 0.75rem;
    }
    .hero h1 {
        font-size: clamp(1.5rem, 5vw, 2.5rem);
    }
    .page-header h1 {
        font-size: clamp(1.3rem, 4vw, 2rem);
    }
}

/* === Regions Chips === */
.regions-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 40px; }
.regions-chips::-webkit-scrollbar { display: none; }
.region-chip { padding: 10px 20px; border-radius: var(--radius-full); background: var(--bg-card); border: 1px solid var(--border-color); white-space: nowrap; font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); transition: all var(--transition); }
.region-chip:hover { border-color: var(--accent-primary); color: var(--accent-primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* === Tabs Dashboard === */
.dashboard-tabs { display: flex; gap: 12px; border-bottom: 1px solid var(--border-color); margin-bottom: 24px; padding-bottom: 0; overflow-x: auto; scrollbar-width: none; }
.tab-btn { background: none; border: none; font-size: 0.95rem; font-weight: 600; color: var(--text-tertiary); padding: 12px 16px; cursor: pointer; border-radius: var(--radius-md) var(--radius-md) 0 0; position: relative; transition: all var(--transition); white-space: nowrap; }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent-primary); }
.tab-btn.active::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 3px; background: var(--accent-primary); border-radius: 3px 3px 0 0; }
.tab-content { display: none; animation: fadeIn var(--transition); }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* === Progress Bars (Top 5) === */
.progress-item { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.progress-item:last-child { margin-bottom: 0; }
.progress-header { display: flex; justify-content: space-between; align-items: flex-end; }
.progress-name { font-size: 0.95rem; font-weight: 600; }
.progress-name a { color: var(--text-primary); }
.progress-name a:hover { color: var(--accent-primary); }
.progress-val { font-weight: 800; color: var(--text-primary); font-size: 1rem; }
.progress-val-sub { font-size: 0.75rem; color: var(--text-tertiary); font-weight: 600; margin-left: 6px; }
.progress-bar { height: 10px; background: var(--bg-tertiary); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--warning), var(--danger)); border-radius: var(--radius-full); transition: width 1s ease; }

/* === SaaS 2026 Home Sections === */
.saas-section { padding: 80px 0; border-top: 1px solid var(--border-color); }
.saas-section:nth-child(even) { background: var(--bg-tertiary); }
.saas-section:nth-child(odd) { background: var(--bg-primary); }

.glow-bg {
    position: absolute; width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(37,99,235,0.15) 0%, transparent 70%);
    top: -200px; left: 50%; transform: translateX(-50%);
    z-index: 1; pointer-events: none;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.hero-badge-top {
    display: inline-flex; align-items: center; padding: 6px 14px;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-full); font-size: 0.85rem; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 24px; box-shadow: var(--shadow-sm);
}

.section-heading { text-align: center; max-width: 700px; margin: 0 auto 60px auto; }
.section-heading h2 { font-size: 2.2rem; font-weight: 800; color: var(--text-primary); margin-bottom: 16px; letter-spacing: -0.02em; }
.section-heading p { font-size: 1.1rem; color: var(--text-secondary); line-height: 1.6; }

.vp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 32px; }
.vp-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    padding: 40px 30px; border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm); transition: transform var(--transition), box-shadow var(--transition);
}
.vp-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--accent-primary); }
.vp-icon { font-size: 3rem; margin-bottom: 20px; line-height: 1; }
.vp-card h3 { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; }
.vp-card p { color: var(--text-secondary); line-height: 1.6; }

.targets-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.target-card {
    background: var(--bg-primary); border: 1px solid var(--border-color);
    padding: 30px; border-radius: var(--radius-lg); text-align: center;
}
.t-icon { font-size: 3.5rem; display: block; margin-bottom: 20px; }
.target-card h3 { font-size: 1.2rem; color: var(--text-primary); margin-bottom: 12px; }
.target-card p { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.5; }

.origin-section { background: var(--bg-card) !important; border: 1px solid var(--border-color); border-radius: var(--radius-xl); padding: 60px; margin: 0 auto 80px auto; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.origin-content { position: relative; z-index: 2; text-align: center; }
.origin-icon { font-size: 3.5rem; margin-bottom: 20px; }
.origin-content h2 { font-size: 1.8rem; font-weight: 800; margin-bottom: 20px; color: var(--text-primary); }
.origin-content p { font-size: 1.05rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 16px; text-align: left; }

.has-glow { position: relative; }
.has-glow::before {
    content: ''; position: absolute; z-index: -1; inset: -20px;
    background: linear-gradient(135deg, rgba(37,99,235,0.2) 0%, transparent 100%);
    filter: blur(40px); border-radius: 40px;
}
@media (max-width: 768px) {
    .saas-section { padding: 40px 0; }
    .section-heading h2 { font-size: 1.8rem; }
    .origin-section { padding: 30px 20px; }
}

/* === Loading Spinner === */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    font-weight: 500;
}
.loading-spinner::before {
    content: '';
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Nav search autocomplete dropdown */
.nav-search {
    position: relative;
}
.nav-search-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    max-height: 280px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
}
.nav-search-suggestions.active {
    display: block;
}
.nav-search-suggestions a {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    transition: background var(--transition);
    font-size: 0.85rem;
}
.nav-search-suggestions a:last-child {
    border-bottom: none;
}
.nav-search-suggestions a:hover {
    background: var(--bg-tertiary);
}
.nav-search-suggestions .sg-name {
    font-weight: 600;
    font-size: 0.85rem;
}
.nav-search-suggestions .sg-info {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}
