/* ═══════════════════════════════════════════════════════════════
   Cambriolages.fr — Design System
   Dark-first, premium, glassmorphism
   ═══════════════════════════════════════════════════════════════ */

/* ─── Variables ──────────────────────────────────────────────── */
:root {
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
}

[data-theme="dark"], :root {
    --bg: #0a0a0f;
    --bg-surface: #111118;
    --bg-card: rgba(255,255,255,0.035);
    --bg-card-hover: rgba(255,255,255,0.06);
    --border-color: rgba(255,255,255,0.08);
    --border-hover: rgba(255,255,255,0.15);
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b0;
    --text-muted: #606075;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --accent-green: #10b981;
    --accent-cyan: #22d3ee;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --gradient-danger: linear-gradient(135deg, #ef4444, #f97316);
    --gradient-safe: linear-gradient(135deg, #10b981, #22d3ee);
    --gradient-primary: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --gradient-hero: linear-gradient(135deg, rgba(239,68,68,0.12), rgba(249,115,22,0.08), transparent);
}

[data-theme="light"] {
    --bg: #f5f5f8;
    --bg-surface: #ffffff;
    --bg-card: rgba(0,0,0,0.02);
    --bg-card-hover: rgba(0,0,0,0.04);
    --border-color: rgba(0,0,0,0.08);
    --border-hover: rgba(0,0,0,0.15);
    --text-primary: #111118;
    --text-secondary: #555568;
    --text-muted: #888898;
    --gradient-hero: linear-gradient(135deg, rgba(239,68,68,0.06), rgba(249,115,22,0.04), transparent);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }
a { color: var(--accent-blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-purple); }
img { max-width: 100%; height: auto; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ─── Header ─────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .site-header {
    background: rgba(255, 255, 255, 0.85);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

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

.logo-icon svg { display: block; }

.logo-text {
    display: flex;
    align-items: baseline;
    gap: 0;
}

.logo-text strong {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.logo-text small {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--accent-orange);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.main-nav a {
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
}

.main-nav a:hover, .main-nav a.active {
    color: var(--text-primary);
    background: var(--bg-card);
}

/* Nav Dropdown */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropbtn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-dropbtn:hover, .nav-dropbtn.active, .nav-dropdown:hover .nav-dropbtn {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-dropdown-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: var(--bg-surface);
    min-width: 220px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0;
    z-index: 200;
    transition: all var(--transition);
}

.nav-dropdown:hover .nav-dropdown-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.nav-dropdown-content a {
    color: var(--text-secondary);
    padding: 0.5rem 1.2rem;
    display: block;
    border-radius: 0;
    font-size: 0.85rem;
    transition: background var(--transition), color var(--transition);
}

.nav-dropdown-content a:hover {
    background-color: var(--bg-card-hover);
    color: var(--accent-blue);
}

.theme-switch {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    margin-left: 0.5rem;
}

.theme-switch:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

[data-theme="dark"] .switch-sun { display: none; }
[data-theme="light"] .switch-moon { display: none; }
[data-theme="dark"] .switch-moon { display: flex; }
[data-theme="light"] .switch-sun { display: flex; }

.switch-icon { display: flex; align-items: center; justify-content: center; }

.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.mobile-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition);
}

/* ─── Hero ───────────────────────────────────────────────────── */
.hero {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: var(--gradient-hero);
}

.hero-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
}

.hero-blob-1 {
    width: 500px;
    height: 500px;
    background: var(--accent-red);
    top: -200px;
    right: -100px;
    opacity: 0.15;
}

.hero-blob-2 {
    width: 400px;
    height: 400px;
    background: var(--accent-orange);
    bottom: -150px;
    left: -100px;
    opacity: 0.1;
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(var(--border-color) 1px, transparent 1px),
                       linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.3;
}

.hero-container {
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero-badge {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 1rem;
}

.gradient-text {
    background: var(--gradient-danger);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}

/* ─── Search ─────────────────────────────────────────────────── */
.search-container {
    max-width: 600px;
    margin: 0 auto 3rem;
    position: relative;
    z-index: 100;
}

.search-form {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
    position: relative;
}

.search-form:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    flex: 1;
    padding: 1rem 1rem 1rem 3rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 1rem;
    outline: none;
}

.search-input::placeholder { color: var(--text-muted); }

.search-btn {
    padding: 0.75rem 1.5rem;
    background: var(--gradient-danger);
    color: #fff;
    border: none;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity var(--transition);
    margin: 0.35rem;
    border-radius: var(--radius-md);
}

.search-btn:hover { opacity: 0.9; }

.search-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    display: none;
    max-height: 320px;
    overflow-y: auto;
}

.search-suggestions.active { display: block; }

.suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
    color: var(--text-primary);
}

.suggestion-item:hover {
    background: var(--bg-card-hover);
}

.suggestion-name { font-weight: 600; }
.suggestion-dept { color: var(--text-muted); font-size: 0.85rem; }
.suggestion-score {
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* ─── Hero Stats ─────────────────────────────────────────────── */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.hero-stat {
    text-align: center;
}

.hero-stat strong {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-stat span {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ─── Section Headers ────────────────────────────────────────── */
.section-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-header h2 {
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

/* ─── Page Header ────────────────────────────────────────────── */
.page-header {
    padding: 2rem 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.page-header h1 {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent-blue); }

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
}

.card h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.card-intro {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* ─── Ranking Cards ──────────────────────────────────────────── */
.ranking-section, .regions-section, .faq-section {
    padding: 4rem 0;
}

.ranking-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ranking-card {
    display: grid;
    grid-template-columns: 50px 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 0 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition);
}

.ranking-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateX(4px);
    color: var(--text-primary);
}

.rank-number {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-muted);
    grid-row: 1 / 3;
}

.rank-info {
    min-width: 0;
}

.rank-info strong {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-info small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.rank-score {
    text-align: right;
    grid-row: 1;
    grid-column: 3;
}

.score-value {
    font-size: 1.4rem;
    font-weight: 800;
}

.score-max {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.rank-bar {
    grid-column: 2 / 4;
    grid-row: 2;
    height: 4px;
    background: var(--border-color);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.rank-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.8s ease;
}

/* Score colors */
.score-low .score-value { color: #10b981; }
.score-medium .score-value { color: #22d3ee; }
.score-high .score-value { color: #f59e0b; }
.score-very-high .score-value { color: #ef4444; }
.score-extreme .score-value { color: #dc2626; }
.score-na .score-value { color: var(--text-muted); }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    border: none;
}

.btn-primary {
    background: var(--gradient-danger);
    color: #fff;
}

.btn-primary:hover { opacity: 0.9; color: #fff; }

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.section-cta {
    text-align: center;
    margin-top: 2.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ─── Regions Grid ───────────────────────────────────────────── */
.regions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.region-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}

.region-pill:hover {
    border-color: var(--accent-blue);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    color: var(--text-primary);
}

/* ─── Features Section (About) ─────────────────────────────────── */
.features-section {
    padding: 6rem 0;
    position: relative;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    text-align: center;
    transition: all var(--transition);
    backdrop-filter: blur(10px);
}

.feature-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-5px);
}

.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--gradient-hero);
    border: 1px solid var(--border-color);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--accent-orange);
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ─── Methodology Section ────────────────────────────────────── */
.methodology-section {
    padding: 5rem 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.method-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 3.5rem;
    position: relative;
}

.method-step {
    padding: 2.5rem 2rem 2rem;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    position: relative;
    transition: transform var(--transition);
}

.method-step:hover {
    transform: translateY(-5px);
    border-color: var(--border-hover);
}

.step-number {
    position: absolute;
    top: -20px;
    left: 24px;
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    border: 4px solid var(--bg-card);
}

.method-step h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.method-step p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ─── FAQ ────────────────────────────────────────────────────── */
.faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    overflow: hidden;
    background: var(--bg-card);
}

.faq-item summary {
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--transition);
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
    content: '+';
    font-size: 1.3rem;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item summary:hover { background: var(--bg-card-hover); }

.faq-content {
    padding: 0 1.5rem 1.25rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.faq-content p { margin-bottom: 0.75rem; }
.faq-content p:last-child { margin-bottom: 0; }

/* ─── Ville Page ─────────────────────────────────────────────── */
.ville-content, .region-content, .dept-content, 
.classement-content, .comparateur-content, .about-content {
    padding: 2.5rem 0 4rem;
}

.ville-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.score-card {
    text-align: center;
}

.score-card h2 {
    text-align: center;
}

/* Gauge */
.gauge-svg {
    width: 200px;
    height: 200px;
    margin: 1rem auto;
    display: block;
}

.gauge-bg {
    stroke: var(--border-color);
}

.gauge-fill {
    stroke: var(--accent-red);
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 1.5s ease;
}

.gauge-number {
    font-size: 3rem;
    font-weight: 900;
    fill: var(--text-primary);
}

.gauge-label {
    font-size: 1rem;
    fill: var(--text-muted);
}

.gauge-status {
    font-size: 0.9rem;
    font-weight: 700;
    fill: var(--text-secondary);
}

.score-details {
    margin-top: 1.5rem;
    text-align: left;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.detail-row span { color: var(--text-secondary); }
.detail-row strong { font-weight: 700; }

/* Chart */
.chart-card { position: relative; }

.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border-color);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.data-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.badge-nd {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.trend { font-size: 1.1rem; }
.trend-up { color: var(--accent-red); }
.trend-down { color: var(--accent-green); }
.trend-stable { color: var(--text-muted); }

/* Actions */
.actions-grid {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}

.action-btn:hover {
    border-color: var(--accent-blue);
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Communes chips */
.communes-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.commune-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition);
}

.commune-chip:hover {
    border-color: var(--accent-blue);
    transform: translateY(-1px);
    color: var(--text-primary);
}

.chip-score {
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
}

/* ─── Classement Controls ────────────────────────────────────── */
.classement-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.toggle-group {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.toggle-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
    border-right: 1px solid var(--border-color);
}

.toggle-btn:last-child { border-right: none; }

.toggle-btn.active {
    background: var(--gradient-danger);
    color: #fff;
}

.toggle-btn:not(.active):hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.85rem;
    cursor: pointer;
}

.filter-group select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

/* ─── Comparateur ────────────────────────────────────────────── */
.compare-selectors {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.compare-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.compare-search label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.compare-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
}

.compare-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.compare-vs {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-muted);
    padding-bottom: 0.5rem;
}

.compare-suggestions {
    top: calc(100% + 4px);
}

.compare-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.compare-card {
    display: flex;
    gap: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
}

.compare-col {
    flex: 1;
    text-align: center;
}

.compare-col h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.compare-score {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 0.25rem;
}

.compare-score small {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.compare-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.compare-meta {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.compare-divider {
    width: 1px;
    background: var(--border-color);
}

.compare-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.compare-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ─── Pagination ─────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.page-link {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
}

.page-link:hover, .page-link.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

/* ─── Footer ─────────────────────────────────────────────────── */
.site-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(4, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-col h3 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-col p {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.7;
}

.footer-col ul { list-style: none; }

.footer-col ul li { margin-bottom: 0.5rem; }

.footer-col ul a {
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: color var(--transition);
}

.footer-col ul a:hover { color: var(--accent-blue); }

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-bottom a { color: var(--text-secondary); }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}

/* ─── About ──────────────────────────────────────────────────── */
.about-content .card {
    max-width: 800px;
    margin: 0 auto 1.5rem;
}

.about-content h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 1.5rem 0 0.5rem;
    color: var(--accent-blue);
}

.about-content p, .about-content ol, .about-content li {
    color: var(--text-secondary);
    line-height: 1.8;
}

.about-content ol { padding-left: 1.5rem; }
.about-content li { margin-bottom: 0.5rem; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .main-nav { 
        display: none;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 1rem;
        gap: 0.25rem;
        z-index: 99;
    }

    .main-nav.open { display: flex; }
    .mobile-toggle { display: flex; }

    .hero { padding: 4rem 0 3rem; }
    .hero-title { font-size: 1.8rem; }

    .ville-grid { grid-template-columns: 1fr; }

    .ranking-card {
        grid-template-columns: 40px 1fr auto;
        padding: 0.75rem 1rem;
    }

    .footer-grid { grid-template-columns: 1fr 1fr; }

    .compare-selectors { flex-direction: column; }
    .compare-vs { align-self: center; }
    .compare-card { flex-direction: column; }
    .compare-divider { height: 1px; width: 100%; }

    .classement-controls { flex-direction: column; align-items: stretch; }
    .toggle-group { justify-content: center; }

    .hero-stats { gap: 1.5rem; }
    .hero-stat strong { font-size: 1.3rem; }

    .search-btn { 
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }

    .actions-grid { flex-direction: column; }

    /* ─── New components mobile ─────────────────────── */
    .card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }

    .score-card {
        padding: 1.5rem;
    }

    .gauge-svg {
        width: 160px;
        height: 160px;
    }

    .gauge-number { font-size: 2.4rem; }

    .detail-row {
        font-size: 0.82rem;
        padding: 0.5rem 0;
    }

    .seo-intro {
        font-size: 0.85rem;
        padding: 1rem;
        margin-top: 1rem;
        line-height: 1.6;
    }

    .info-box {
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.8rem;
        padding: 0.75rem;
    }

    .chart-container {
        height: 260px;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
    }

    .data-table th {
        font-size: 0.7rem;
    }

    .communes-chips {
        gap: 0.35rem;
    }

    .commune-chip {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }

    .page-header h1 {
        font-size: 1.4rem;
    }

    .page-subtitle {
        font-size: 0.85rem;
    }

    .breadcrumb {
        font-size: 0.78rem;
    }

    .scroll-top {
        bottom: 1.25rem;
        right: 1.25rem;
        width: 40px;
        height: 40px;
    }

    .contact-card {
        padding: 2.5rem 1.25rem;
    }

    .error-page {
        padding: 4rem 1rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .method-steps {
        grid-template-columns: 1fr;
    }

    .section-cta {
        flex-direction: column;
        align-items: center;
    }

    .ville-content, .region-content, .dept-content, 
    .classement-content, .comparateur-content, .about-content {
        padding: 1.5rem 0 3rem;
    }

    .compare-score {
        font-size: 2.2rem;
    }

    .compare-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
    .hero-stats { flex-direction: column; gap: 1rem; }

    .page-header h1 { font-size: 1.2rem; }
    .detail-row { font-size: 0.78rem; }
    .gauge-svg { width: 140px; height: 140px; }
    .gauge-number { font-size: 2rem; }
    .chart-container { height: 220px; }
}

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

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

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
    50% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.15); }
}

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

/* Hero animations */
.hero-badge {
    animation: fadeInUp 0.6s ease both;
}

.hero-title {
    animation: fadeInUp 0.6s 0.1s ease both;
}

.hero-subtitle {
    animation: fadeInUp 0.6s 0.2s ease both;
}

.search-container {
    animation: fadeInUp 0.6s 0.3s ease both;
}

.hero-stats {
    animation: fadeInUp 0.6s 0.4s ease both;
}

.hero-stat strong {
    animation: countUp 0.5s 0.6s ease both;
}

/* Ranking card stagger */
.ranking-card {
    opacity: 0;
    animation: fadeInUp 0.4s ease both;
}

.ranking-card:nth-child(1)  { animation-delay: 0.05s; }
.ranking-card:nth-child(2)  { animation-delay: 0.08s; }
.ranking-card:nth-child(3)  { animation-delay: 0.11s; }
.ranking-card:nth-child(4)  { animation-delay: 0.14s; }
.ranking-card:nth-child(5)  { animation-delay: 0.17s; }
.ranking-card:nth-child(6)  { animation-delay: 0.20s; }
.ranking-card:nth-child(7)  { animation-delay: 0.23s; }
.ranking-card:nth-child(8)  { animation-delay: 0.26s; }
.ranking-card:nth-child(9)  { animation-delay: 0.29s; }
.ranking-card:nth-child(10) { animation-delay: 0.32s; }
.ranking-card:nth-child(11) { animation-delay: 0.35s; }
.ranking-card:nth-child(12) { animation-delay: 0.38s; }
.ranking-card:nth-child(13) { animation-delay: 0.41s; }
.ranking-card:nth-child(14) { animation-delay: 0.44s; }
.ranking-card:nth-child(15) { animation-delay: 0.47s; }
.ranking-card:nth-child(16) { animation-delay: 0.50s; }
.ranking-card:nth-child(17) { animation-delay: 0.53s; }
.ranking-card:nth-child(18) { animation-delay: 0.56s; }
.ranking-card:nth-child(19) { animation-delay: 0.59s; }
.ranking-card:nth-child(20) { animation-delay: 0.62s; }

/* Section fade-in */
.section-header {
    animation: fadeInUp 0.5s ease both;
}

/* Region pills stagger */
.region-pill {
    animation: fadeIn 0.4s ease both;
}

.region-pill:nth-child(1)  { animation-delay: 0.1s; }
.region-pill:nth-child(2)  { animation-delay: 0.13s; }
.region-pill:nth-child(3)  { animation-delay: 0.16s; }
.region-pill:nth-child(4)  { animation-delay: 0.19s; }
.region-pill:nth-child(5)  { animation-delay: 0.22s; }
.region-pill:nth-child(6)  { animation-delay: 0.25s; }
.region-pill:nth-child(7)  { animation-delay: 0.28s; }
.region-pill:nth-child(8)  { animation-delay: 0.31s; }
.region-pill:nth-child(9)  { animation-delay: 0.34s; }
.region-pill:nth-child(10) { animation-delay: 0.37s; }
.region-pill:nth-child(11) { animation-delay: 0.40s; }
.region-pill:nth-child(12) { animation-delay: 0.43s; }
.region-pill:nth-child(13) { animation-delay: 0.46s; }
.region-pill:nth-child(14) { animation-delay: 0.49s; }

/* Hero blob animation */
.hero-blob-1 {
    animation: pulseGlow 6s ease-in-out infinite;
}

.hero-blob-2 {
    animation: pulseGlow 8s 2s ease-in-out infinite;
}

/* Card entrance */
.card {
    animation: fadeInUp 0.5s ease both;
}

/* Hover micro-interactions */
.ranking-card:hover .rank-number {
    color: var(--accent-red);
    transition: color var(--transition);
}

.ranking-card:hover .rank-bar-fill {
    filter: brightness(1.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-1px);
}

.faq-item summary:hover {
    padding-left: 1.75rem;
}

/* Score gauge hover */
.score-card:hover .gauge-fill {
    filter: drop-shadow(0 0 8px currentColor);
}

/* Search focus glow */
.search-form:focus-within {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 4px 20px rgba(59, 130, 246, 0.1);
}

/* ─── Light Mode Enhancements ────────────────────────────────── */
[data-theme="light"] .ranking-card {
    background: rgba(0, 0, 0, 0.015);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .ranking-card:hover {
    background: rgba(0, 0, 0, 0.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .card {
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .faq-item {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .search-form {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .search-suggestions {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .region-pill {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .hero-blob-1 {
    opacity: 0.08;
}

[data-theme="light"] .hero-blob-2 {
    opacity: 0.05;
}

[data-theme="light"] .hero-grid {
    opacity: 0.15;
}

[data-theme="light"] .toggle-btn.active {
    color: #fff;
}

[data-theme="light"] .btn-primary {
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

[data-theme="light"] .page-header {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Smooth theme transition */
body, .site-header, .card, .ranking-card,
.region-pill, .search-form, .faq-item, .page-header {
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ─── Prefers Reduced Motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─── Scroll to Top ─────────────────────────────────────────── */
.scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 90;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ─── Search Loading State ──────────────────────────────────── */
.search-suggestions.loading {
    display: block;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-suggestions.loading::after {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-left: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.search-suggestions.error {
    display: block;
    padding: 1rem 1.5rem;
    text-align: center;
    color: var(--accent-red);
    font-size: 0.85rem;
}

/* ─── SEO Intro (ville page) ────────────────────────────────── */
.seo-intro {
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    max-width: 800px;
    background: var(--bg-card);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

/* ─── Info Box (ville chart explanation) ─────────────────────── */
.info-box {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

/* ─── Error Page (404) ──────────────────────────────────────── */
.error-page {
    text-align: center;
    padding: 6rem 1rem;
}

.error-icon {
    margin-bottom: 1rem;
}

.error-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ─── Contact Page ──────────────────────────────────────────── */
.contact-card {
    text-align: center;
    padding: 4rem 2rem;
}

.contact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--gradient-hero);
    border: 1px solid var(--border-color);
    color: var(--accent-orange);
    margin-bottom: 1.5rem;
}

.contact-card h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.contact-desc {
    margin-bottom: 2.5rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.contact-email-btn {
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    padding: 1rem 2rem;
}

/* ─── Compare Hint ──────────────────────────────────────────── */
.compare-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ─── Badge Embed ───────────────────────────────────────────── */
.badge-card {
    border: 1px dashed var(--border-hover);
    background: var(--bg-card);
}

.badge-preview {
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    background: #0a0a0f;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255,255,255,0.05);
}

[data-theme="light"] .badge-preview {
    background: #1a1a24;
}

.badge-code-wrapper {
    margin-top: 0.5rem;
}

.badge-code-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-code-container {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.badge-code {
    display: block;
    padding: 1rem;
    padding-right: 5rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 120px;
    overflow-y: auto;
}

.badge-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.badge-copy-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.badge-copy-btn.copied {
    background: var(--accent-green);
}

@media (max-width: 768px) {
    .badge-preview {
        padding: 1.25rem 0.75rem;
    }
    .badge-code {
        font-size: 0.7rem;
        padding-right: 1rem;
        max-height: 100px;
    }
    .badge-copy-btn {
        position: static;
        width: 100%;
        justify-content: center;
        margin-top: 0;
        padding: 0.6rem;
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }
    .badge-code-container {
        display: flex;
        flex-direction: column;
    }
}
