/* === Distance à vol d'oiseau — Design System === */

:root {
    --ink: #1a1a24;
    --steel: #3a3a50;
    --muted: #787888;
    --accent: #1a56db;
    --accent-warm: #e07030;
    --surface: #ffffff;
    --bg: #faf8f5;
    --border: #e5e2dd;
    --stripe: #f4f2ef;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-card: 0 1px 3px rgba(26,26,36,0.06), 0 1px 2px rgba(26,26,36,0.04);
    --shadow-elevated: 0 4px 16px rgba(26,26,36,0.08), 0 2px 4px rgba(26,26,36,0.04);
    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Header === */
header {
    text-align: center;
    padding: 2.5rem 1rem 1.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

header .subtitle {
    font-size: 0.875rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

/* === Main === */
main {
    flex: 1;
    max-width: 880px;
    width: 100%;
    margin: 0 auto;
    padding: 1.75rem 1.25rem 3rem;
}

/* === Tabs === */
.mode-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.75rem;
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
}

.mode-tab {
    padding: 0.6rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.mode-tab:hover { color: var(--ink); }
.mode-tab.active { background: var(--ink); color: #fff; }

/* === Inputs === */
.inputs-row {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1rem;
}

.input-group { flex: 1; min-width: 0; }

.input-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.input-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--surface);
    color: var(--ink);
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

/* === Autocomplete === */
.autocomplete-wrapper { position: relative; }

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 260px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: var(--shadow-elevated);
}

.autocomplete-dropdown.open { display: block; }

.autocomplete-item {
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--stripe);
    transition: background 0.1s;
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.active { background: #eef3ff; }

.autocomplete-item .item-label { font-weight: 500; color: var(--ink); }
.autocomplete-item .item-sublabel { font-size: 0.8rem; color: var(--muted); margin-left: 0.5rem; }

.autocomplete-empty { padding: 0.75rem 1rem; color: var(--muted); font-size: 0.85rem; text-align: center; }

/* === Distance === */
.distance-section {
    text-align: center;
    padding: 1.25rem 0 1rem;
}

.distance-value {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--accent);
}

.distance-unit {
    font-size: 1.1rem;
    color: var(--muted);
    margin-left: 0.15rem;
    font-weight: 500;
}

/* === Map === */
.map-section {
    margin-bottom: 1.5rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

#map { height: 380px; width: 100%; background: #e8e6e3; }

/* === Cards === */
.cards-row {
    display: flex;
    gap: 1.25rem;
}

.info-card {
    flex: 1;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

.info-card h3 {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

.station-name { font-size: 1.05rem; font-weight: 700; color: var(--ink); margin-bottom: 0.3rem; }
.station-address { font-size: 0.9rem; color: var(--steel); margin-bottom: 0.25rem; }
.station-context { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }

.zone-badge {
    display: inline-block;
    background: #eef3ff;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.station-lines {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.line-tag {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    color: #fff;
}

/* Métro */
.line-tag[data-line="1"]  { background: #FFCD00; color: #000; }
.line-tag[data-line="2"]  { background: #0064B0; }
.line-tag[data-line="3"]  { background: #9F9825; }
.line-tag[data-line="3b"] { background: #82D2E1; color: #000; }
.line-tag[data-line="4"]  { background: #BB4B9C; }
.line-tag[data-line="5"]  { background: #F28E42; }
.line-tag[data-line="6"]  { background: #82C8A6; color: #000; }
.line-tag[data-line="7"]  { background: #F8A0B8; color: #000; }
.line-tag[data-line="7b"] { background: #82C8A6; color: #000; }
.line-tag[data-line="8"]  { background: #CEADD2; color: #000; }
.line-tag[data-line="9"]  { background: #BDD73A; color: #000; }
.line-tag[data-line="10"] { background: #E5B327; color: #000; }
.line-tag[data-line="11"] { background: #8D6648; }
.line-tag[data-line="12"] { background: #008E56; }
.line-tag[data-line="13"] { background: #82D2E1; color: #000; }
.line-tag[data-line="14"] { background: #662483; }
.line-tag[data-line="Orlyval"] { background: #A2CD4A; color: #000; }

/* RER */
.line-tag[data-line="A"] { background: #E2231A; }
.line-tag[data-line="B"] { background: #4B92DB; }
.line-tag[data-line="C"] { background: #F5D300; color: #000; }
.line-tag[data-line="D"] { background: #3A9E3F; }
.line-tag[data-line="E"] { background: #C28AC2; }

/* Transilien */
.line-tag[data-line="H"] { background: #8D6648; }
.line-tag[data-line="J"] { background: #BDD73A; color: #000; }
.line-tag[data-line="K"] { background: #E5B327; color: #000; }
.line-tag[data-line="L"] { background: #CEADD2; color: #000; }
.line-tag[data-line="N"] { background: #3A9E3F; }
.line-tag[data-line="P"] { background: #F28E42; }
.line-tag[data-line="R"] { background: #F8A0B8; color: #000; }
.line-tag[data-line="U"] { background: #B7D0E2; color: #000; }

/* TER / Trams */
.line-tag[data-line="TER"] { background: #787888; }
.line-tag[data-line="T4"] { background: #F5D300; color: #000; }
.line-tag[data-line="T11"] { background: #E2231A; }
.line-tag[data-line="T12"] { background: #E2231A; }
.line-tag[data-line="T13"] { background: #E2231A; }

/* Default fallback */
.line-tag:not([data-line]) { background: var(--stripe); color: var(--steel); }

/* === States === */
.loading {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 0.5rem;
}

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

.error {
    text-align: center;
    padding: 1rem;
    background: #fff5f5;
    color: #c53030;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-top: 1rem;
    border: 1px solid #fed7d7;
}

.hidden { display: none; }

/* === Footer === */
footer {
    text-align: center;
    padding: 1.25rem;
    font-size: 0.75rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: var(--surface);
}

footer a { color: var(--muted); text-decoration: underline; }

/* === Responsive === */
@media (max-width: 640px) {
    header { padding: 1.5rem 1rem 1.25rem; }
    header h1 { font-size: 1.25rem; }

    main { padding: 1rem 0.75rem 2rem; }

    .mode-tab { padding: 0.5rem 1rem; font-size: 0.8rem; }

    .inputs-row, .cards-row { flex-direction: column; gap: 0.9rem; }

    .distance-value { font-size: 2rem; }
    #map { height: 260px; }
}
