/* ============================================================
   SafeRoute - Styles principaux
   ============================================================ */

/* Variables globales */
:root {
    --sr-green: #1E5E2F;
    --sr-green-light: #E8F5E9;
    --sr-green-dark: #144620;
    --sr-red: #D32F2F;
    --sr-red-light: #FFEBEE;
    --sr-orange: #F57C00;
    --sr-orange-light: #FFF3E0;
    --sr-purple: #7B1FA2;
    --sr-purple-light: #F3E5F5;
    --sr-blue: #1976D2;
    --sr-bg: #F8F9FA;
    --sr-text: #1A1A1A;
    --sr-text-light: #6B7280;
    --sr-border: #E5E7EB;
    --sr-white: #FFFFFF;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.25s ease;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #0f172a;
    color: var(--sr-text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   CONTAINER PRINCIPAL (Phone Mockup sur Desktop)
   ============================================================ */
.app-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.app-phone {
    width: 100%;
    max-width: 430px;
    height: 92vh;
    max-height: 900px;
    background: var(--sr-white);
    border-radius: 32px;
    box-shadow: 0 0 0 8px #1e293b, 0 0 0 10px #334155, var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Sur mobile : plein écran sans bordure phone */
@media (max-width: 480px) {
    .app-wrapper { padding: 0; }
    .app-phone {
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }
}

/* ============================================================
   STATUS BAR
   ============================================================ */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--sr-text);
    flex-shrink: 0;
    background: inherit;
}
.status-bar.dark { color: white; }

/* ============================================================
   ÉCRANS (Screens)
   ============================================================ */
.screen {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
.screen.active { display: flex; }

.screen-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.screen-content::-webkit-scrollbar { display: none; }

/* ============================================================
   HEADER DE NAVIGATION
   ============================================================ */
.nav-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--sr-border);
    flex-shrink: 0;
    gap: 12px;
}
.nav-header .back-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: var(--sr-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}
.nav-header .back-btn:hover { background: var(--sr-bg); }
.nav-header .title {
    font-weight: 700;
    font-size: 15px;
    flex: 1;
    text-align: center;
    margin-right: 36px;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar {
    display: flex;
    gap: 6px;
    padding: 12px 24px;
}
.progress-bar .step {
    flex: 1;
    height: 4px;
    background: var(--sr-border);
    border-radius: 2px;
    transition: background var(--transition);
}
.progress-bar .step.done { background: var(--sr-green); }
.progress-bar .step.current { background: var(--sr-green); }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-family: inherit;
}
.btn-primary {
    background: var(--sr-green);
    color: white;
}
.btn-primary:hover { background: var(--sr-green-dark); }
.btn-danger {
    background: var(--sr-red);
    color: white;
}
.btn-danger:hover { background: #b71c1c; }
.btn-outline {
    background: white;
    color: var(--sr-green);
    border: 2px solid var(--sr-green);
}
.btn-outline:hover { background: var(--sr-green-light); }
.btn-ghost {
    background: transparent;
    color: var(--sr-text-light);
}
.btn-ghost:hover { background: var(--sr-bg); }
.btn-full { width: 100%; }
.btn-lg { padding: 16px 28px; font-size: 16px; border-radius: var(--radius); }

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sr-bg);
    border: 1px solid var(--sr-border);
    cursor: pointer;
    font-size: 18px;
    color: var(--sr-text);
    transition: all var(--transition);
}
.btn-icon:hover { background: #e5e7eb; }

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: white;
    border-top: 1px solid var(--sr-border);
    padding: 6px 16px;
    flex-shrink: 0;
}
.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 500;
    color: #9ca3af;
    border: none;
    background: none;
    cursor: pointer;
    padding: 8px 12px;
    transition: color var(--transition);
    font-family: inherit;
}
.bottom-nav .nav-item i { font-size: 18px; }
.bottom-nav .nav-item.active { color: var(--sr-green); }
.bottom-nav .nav-item.report-btn {
    width: 50px;
    height: 50px;
    background: var(--sr-green);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-top: -28px;
    box-shadow: 0 4px 12px rgba(30, 94, 47, 0.4);
    transition: transform var(--transition), box-shadow var(--transition);
}
.bottom-nav .nav-item.report-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(30, 94, 47, 0.5);
}

/* ============================================================
   SPLASH SCREEN
   ============================================================ */
.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    padding: 24px;
}
.splash-logo {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 16px;
}
.splash-logo .main-icon {
    font-size: 70px;
    color: var(--sr-green);
}
.splash-logo .car-icon {
    font-size: 30px;
    color: var(--sr-red);
    position: absolute;
    bottom: 5px;
    right: 5px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.splash-title {
    font-size: 36px;
    font-weight: 900;
    color: var(--sr-green);
    letter-spacing: -1px;
}
.splash-title span { color: var(--sr-text); }
.splash-subtitle {
    font-size: 14px;
    color: var(--sr-text-light);
    margin-top: 4px;
    font-weight: 500;
}
.splash-bottom {
    padding: 20px 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ============================================================
   HOME SCREEN
   ============================================================ */
.home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid var(--sr-border);
}
.home-header .brand {
    font-weight: 700;
    font-size: 18px;
    color: var(--sr-green);
}
.home-header .brand span { color: var(--sr-text); }

.greeting {
    padding: 4px 20px 12px;
}
.greeting .hello { font-size: 13px; color: var(--sr-text-light); }
.greeting .question { font-size: 18px; font-weight: 700; color: var(--sr-text); margin-top: 2px; }

/* ============================================================
   CARTES
   ============================================================ */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--sr-border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

.card-report {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    margin: 0 16px;
}
.card-report .card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.card-report .card-icon.red { background: var(--sr-red); color: white; }
.card-report .card-icon.green { background: var(--sr-green-light); color: var(--sr-green); }
.card-report .card-body h3 { font-weight: 700; font-size: 15px; }
.card-report .card-body p { font-size: 12px; color: var(--sr-text-light); margin-top: 2px; }
.card-report .card-arrow { margin-left: auto; color: var(--sr-border); font-size: 14px; }

/* ============================================================
   MINI MAP (carte dans la page d'accueil)
   ============================================================ */
.mini-map-container {
    margin: 0 16px;
    height: 160px;
    border-radius: var(--radius);
    overflow: hidden;
    background: #e2e8f0;
    border: 1px solid var(--sr-border);
}

/* ============================================================
   GRILLE DE SÉLECTION (type d'accident)
   ============================================================ */
.type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 16px;
}
.type-card {
    border: 2px solid var(--sr-border);
    border-radius: var(--radius);
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: white;
    position: relative;
}
.type-card:hover { border-color: #9ca3af; }
.type-card.selected {
    border-color: var(--sr-green);
    background: var(--sr-green-light);
}
.type-card.selected .check-mark {
    display: flex;
}
.type-card .check-mark {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    background: var(--sr-green);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    align-items: center;
    justify-content: center;
}
.type-card i { font-size: 32px; margin-bottom: 8px; display: block; }
.type-card .type-label { font-weight: 600; font-size: 13px; }

/* Couleurs des types */
.type-card[data-type="collision"] i, .type-card[data-type="collision"].selected i,
.type-card[data-type="collision"] .type-label { color: var(--sr-red); }
.type-card[data-type="renversement"] i, .type-card[data-type="renversement"].selected i,
.type-card[data-type="renversement"] .type-label { color: var(--sr-orange); }
.type-card[data-type="pieton"] i, .type-card[data-type="pieton"].selected i,
.type-card[data-type="pieton"] .type-label { color: var(--sr-green); }
.type-card[data-type="moto"] i, .type-card[data-type="moto"].selected i,
.type-card[data-type="moto"] .type-label { color: var(--sr-purple); }
.type-card[data-type="velo"] i, .type-card[data-type="velo"].selected i,
.type-card[data-type="velo"] .type-label { color: var(--sr-blue); }
.type-card[data-type="camion"] i, .type-card[data-type="camion"].selected i,
.type-card[data-type="camion"] .type-label { color: #455A64; }
.type-card[data-type="autre"] i, .type-card[data-type="autre"].selected i,
.type-card[data-type="autre"] .type-label { color: #757575; }

/* Map screen : conteneur forcé en hauteur */
.map-screen-content {
    position: relative !important;
    overflow: hidden !important;
}
.map-fill {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
/* Légende en bas avec marge pour la barre de recherche */
#screen-map-view .map-legend {
    bottom: 80px;
}
.map-overlay-top {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    gap: 8px;
}
.map-search {
    flex: 1;
    background: white;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    border: 1px solid var(--sr-border);
    outline: none;
    font-family: inherit;
}
.map-locate-btn {
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid var(--sr-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--sr-green);
    transition: all var(--transition);
}
.map-locate-btn:hover { background: var(--sr-bg); }
.map-locate-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.map-location-pin {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -100%);
    z-index: 5;
    pointer-events: none;
    font-size: 36px;
    color: var(--sr-red);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.map-address-bar {
    position: absolute;
    bottom: 100px;
    left: 12px;
    right: 12px;
    z-index: 10;
    background: white;
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--sr-border);
}
.map-address-bar i { color: var(--sr-green); font-size: 16px; margin-top: 2px; }
.map-address-bar .address-text { font-size: 12px; line-height: 1.4; }
.map-address-bar .address-text strong { display: block; font-size: 13px; margin-bottom: 2px; }
.map-address-bar .address-text .coords { color: var(--sr-text-light); font-size: 10px; margin-top: 2px; }

.map-legend {
    position: absolute;
    bottom: 20px;
    left: 12px;
    right: 12px;
    z-index: 10;
    background: white;
    border-radius: var(--radius);
    padding: 12px 14px;
    box-shadow: var(--shadow);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--sr-border);
}
.map-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.map-legend .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ============================================================
   FORMULAIRES
   ============================================================ */
.form-group {
    margin-bottom: 16px;
}
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--sr-text-light);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--sr-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border var(--transition);
    background: white;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--sr-green);
    box-shadow: 0 0 0 3px rgba(30, 94, 47, 0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* Counter */
.counter-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--sr-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    width: fit-content;
    background: var(--sr-bg);
}
.counter-control button {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    color: var(--sr-text);
    transition: background var(--transition);
}
.counter-control button:hover { background: #e5e7eb; }
.counter-control .counter-value {
    width: 40px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
}

/* Toggle buttons */
.toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}
.toggle-btn {
    padding: 10px;
    border: 2px solid var(--sr-border);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all var(--transition);
    font-family: inherit;
    text-align: center;
}
.toggle-btn:hover { border-color: #9ca3af; }
.toggle-btn.selected {
    border-color: var(--sr-green);
    background: var(--sr-green-light);
    color: var(--sr-green);
}

/* Severity selector */
.severity-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.severity-btn {
    padding: 12px 10px; border: 2px solid var(--sr-border); border-radius: var(--radius-sm);
    background: white; cursor: pointer; font-weight: 600; font-size: 13px;
    transition: all var(--transition); font-family: inherit; text-align: center;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.severity-btn:hover { border-color: #9ca3af; }
.severity-btn.selected { transform: scale(1.03); }
.severity-btn.mineur.selected { border-color: #22c55e; background: #f0fdf4; color: #166534; }
.severity-btn.modere.selected { border-color: #F57C00; background: #FFF3E0; color: #92400E; }
.severity-btn.grave.selected { border-color: #EF4444; background: #FEF2F2; color: #991B1B; }
.severity-btn.critique.selected { border-color: #991B1B; background: #1a1a1a; color: #fff; }

/* Emergency bar */
.emergency-bar {
    margin: 0 16px 12px; padding: 14px; background: #FEF2F2;
    border: 1.5px solid #FECACA; border-radius: var(--radius);
}
.emergency-title {
    font-size: 11px; font-weight: 700; color: #991B1B;
    margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
}
.emergency-numbers { display: flex; gap: 8px; }
.emergency-btn {
    flex: 1; padding: 10px 6px; border-radius: 10px; text-align: center;
    text-decoration: none; font-size: 10px; color: white; font-weight: 500;
    transition: transform 0.2s; line-height: 1.3;
}
.emergency-btn:hover { transform: scale(1.05); }
.emergency-btn strong { font-size: 15px; display: block; }
.emergency-btn.police { background: #1E40AF; }
.emergency-btn.pompiers { background: #D32F2F; }
.emergency-btn.samu { background: #0D9488; }
.emergency-btn.urgences { background: #1E5E2F; }
.photo-upload {
    border: 2px dashed var(--sr-border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--sr-text-light);
}
.photo-upload:hover { border-color: var(--sr-green); background: var(--sr-green-light); }
.photo-upload i { font-size: 28px; margin-bottom: 8px; display: block; }
.photo-upload span { font-size: 13px; font-weight: 600; }

/* ============================================================
   SUCCESS SCREEN
   ============================================================ */
.success-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    padding: 24px;
}
.success-icon {
    width: 80px;
    height: 80px;
    background: var(--sr-green-light);
    color: var(--sr-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 16px;
}
.success-title { font-size: 22px; font-weight: 700; color: var(--sr-text); }
.success-message { font-size: 13px; color: var(--sr-text-light); max-width: 280px; margin-top: 8px; line-height: 1.5; }
.receipt-card {
    background: var(--sr-bg);
    border: 1px solid var(--sr-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 300px;
    margin-top: 20px;
    text-align: left;
}
.receipt-card i { color: var(--sr-text-light); font-size: 24px; }
.receipt-card .receipt-info { font-size: 12px; }
.receipt-card .receipt-info .ref { font-weight: 700; font-size: 14px; color: var(--sr-text); }
.receipt-card .receipt-info .date { color: var(--sr-text-light); margin-top: 2px; }

/* ============================================================
   ALERTS LIST
   ============================================================ */
.filter-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid var(--sr-border);
    background: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    font-family: inherit;
    color: var(--sr-text-light);
}
.filter-tab.active { background: var(--sr-green); color: white; border-color: var(--sr-green); }

.alert-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    background: white;
    border-bottom: 1px solid var(--sr-border);
    cursor: pointer;
    transition: background var(--transition);
}
.alert-item:hover { background: #f9fafb; }
.alert-item .alert-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.alert-item .alert-info { flex: 1; font-size: 12px; }
.alert-item .alert-info .alert-type { font-weight: 700; font-size: 14px; }
.alert-item .alert-info .alert-address { color: var(--sr-text-light); margin-top: 2px; }
.alert-item .alert-meta { text-align: right; font-size: 11px; color: var(--sr-text-light); flex-shrink: 0; }
.alert-item .alert-distance { font-weight: 600; color: var(--sr-red); margin-top: 2px; font-size: 11px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.closing { animation: fadeOut 0.2s ease forwards; }
.modal-sheet {
    background: white;
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 430px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px 20px 32px;
    animation: slideUp 0.3s ease;
}
.modal-sheet.closing { animation: slideDown 0.2s ease forwards; }
.modal-handle {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 0 auto 20px;
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; text-align: center; }

/* Tab switcher dans la modal */
.modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--sr-border);
    margin-bottom: 20px;
}
.modal-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--sr-text-light);
    font-family: inherit;
    transition: all var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.modal-tab.active { color: var(--sr-green); border-bottom-color: var(--sr-green); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes slideDown { from { transform: translateY(0); } to { transform: translateY(100%); } }

/* ============================================================
   PROFILE SCREEN
   ============================================================ */
.profile-avatar {
    width: 72px;
    height: 72px;
    background: var(--sr-green-light);
    color: var(--sr-green);
    border: 3px solid var(--sr-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    margin: 0 auto;
}
.profile-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border-top: 1px solid var(--sr-border);
    padding-top: 14px;
    text-align: center;
    font-size: 12px;
}
.profile-stats .stat-value { font-weight: 700; font-size: 18px; color: var(--sr-text); }
.profile-stats .stat-label { color: var(--sr-text-light); font-size: 10px; margin-top: 2px; }

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: white;
    border-bottom: 1px solid var(--sr-border);
    cursor: pointer;
    font-size: 13px;
    transition: background var(--transition);
    font-family: inherit;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--sr-text);
}
.menu-item:hover { background: #f9fafb; }
.menu-item .menu-icon { margin-right: 12px; color: var(--sr-text-light); width: 20px; text-align: center; }

/* ============================================================
   SPINNER / LOADING
   ============================================================ */
.spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--sr-border);
    border-top-color: var(--sr-green);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    z-index: 200;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
    max-width: 90%;
    text-align: center;
}
.toast.error { background: var(--sr-red); }
.toast.success { background: var(--sr-green); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(-50%) translateY(20px); } }

/* ============================================================
   RESPONSIVE – TABLETTE (≥ 768px)
   ============================================================ */
@media (min-width: 768px) {
    body {
        background: #e2e8f0;
    }

    .app-wrapper {
        padding: 16px;
    }

    .app-phone {
        max-width: 720px;
        height: auto;
        min-height: 92vh;
        max-height: none;
        border-radius: 24px;
        box-shadow: 0 0 0 4px #cbd5e1, 0 0 0 6px #94a3b8, var(--shadow-lg);
    }

    .status-bar,
    .bottom-indicator { display: none; }

    /* Grille types d'accident : 3 colonnes */
    .type-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        padding: 0 8px;
    }

    /* Cartes plus grandes */
    .mini-map-container {
        height: 200px;
    }

    .card-report {
        margin: 0 8px;
    }

    /* Écran succès */
    .success-message {
        max-width: 400px;
    }

    /* Modal centrée */
    .modal-overlay {
        align-items: center;
    }
    .modal-sheet {
        border-radius: 24px;
        max-width: 480px;
        animation: modalPopIn 0.3s ease;
    }
    .modal-sheet.closing { animation: modalPopOut 0.2s ease forwards; }
    .modal-handle { display: none; }

    @keyframes modalPopIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
    @keyframes modalPopOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.95); } }

    /* Profile */
    .profile-avatar {
        width: 90px;
        height: 90px;
        font-size: 32px;
    }

    /* Map légende plus espacée */
    .map-legend {
        gap: 16px;
        font-size: 12px;
    }
}

/* ============================================================
   RESPONSIVE – DESKTOP (≥ 1024px)
   ============================================================ */
@media (min-width: 1024px) {
    body {
        background: #f1f5f9;
    }

    .app-wrapper {
        padding: 24px;
    }

    .app-phone {
        max-width: 1100px;
        width: 95%;
        min-height: 90vh;
        border-radius: 20px;
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--sr-border);
    }

    /* Home : layout en 2 colonnes */
    #screen-home .screen-content {
        display: flex;
        flex-wrap: wrap;
        gap: 0;
    }

    #screen-home .greeting {
        width: 100%;
        padding: 16px 24px 8px;
    }

    /* Colonne gauche : boutons */
    .home-left-col {
        flex: 1;
        min-width: 280px;
    }

    /* Colonne droite : mini carte + alertes */
    .home-right-col {
        flex: 1;
        min-width: 300px;
        display: flex;
        flex-direction: column;
    }

    .mini-map-container {
        height: 240px;
        margin: 0 16px 8px 0;
    }

    #nearby-alerts {
        padding: 0 16px 16px 0;
        overflow-y: auto;
        flex: 1;
    }

    /* Grille types d'accident : 4 colonnes */
    .type-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
        max-width: 800px;
        margin: 0 auto;
    }

    .type-card {
        padding: 24px 16px;
    }
    .type-card i { font-size: 36px; }
    .type-card .type-label { font-size: 14px; }

    /* Report step 2 : map plus grande */
    #screen-report-2 .screen-content > div:first-of-type {
        min-height: 400px;
    }

    /* Report step 3 : form centré */
    #screen-report-3 .screen-content {
        max-width: 650px;
        margin: 0 auto;
        width: 100%;
    }

    /* Map view */
    #screen-map-view .screen-content {
        min-height: 500px;
    }

    .map-legend {
        font-size: 13px;
        gap: 20px;
    }

    /* Alerts : liste en grille sur desktop */
    #alerts-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1px;
        background: var(--sr-border);
    }
    #alerts-list .alert-item {
        background: white;
        border: none;
    }

    /* Profile */
    #screen-profile .screen-content {
        max-width: 600px;
        margin: 0 auto;
        width: 100%;
    }

    /* Modal */
    .modal-sheet {
        max-width: 520px;
    }

    /* Bottom nav : barre plus large */
    .bottom-nav {
        padding: 8px 48px;
        justify-content: space-around;
    }

    .bottom-nav .nav-item {
        font-size: 12px;
        padding: 10px 20px;
    }
    .bottom-nav .nav-item i { font-size: 20px; }

    /* Cards */
    .card-report {
        margin: 0 16px;
    }

    /* Formulaires plus larges */
    .form-input, .form-textarea {
        font-size: 15px;
        padding: 14px 16px;
    }
}

/* ============================================================
   RESPONSIVE – GRAND ÉCRAN (≥ 1400px)
   ============================================================ */
@media (min-width: 1400px) {
    .app-phone {
        max-width: 1200px;
    }

    /* Home : 2 colonnes plus larges */
    .home-left-col { min-width: 300px; }
    .home-right-col { min-width: 380px; }

    .mini-map-container {
        height: 300px;
    }

    .type-grid {
        max-width: 900px;
    }
}

@media (max-width: 640px) {
    .app-wrapper {
        padding: 0;
        overflow-x: hidden;
    }

    .app-phone {
        max-width: 100vw;
        border-radius: 0;
        box-shadow: none;
    }
}

/* ============================================================
   MODERNISATION EXPERIENCE
   ============================================================ */
.screen.active {
    animation: screenIn 0.24s ease both;
}

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

.trust-strip {
    width: calc(100% - 32px);
    margin: 0 16px 14px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.trust-strip > div {
    min-height: 64px;
    border: 1px solid #dbe4ea;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f7faf9);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px;
}

.trust-strip strong {
    font-size: 20px;
    line-height: 1;
    color: var(--sr-text);
}

.trust-strip span {
    margin-top: 5px;
    color: var(--sr-text-light);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

.alert-card {
    background: white;
    border: 1px solid #dfe7ec;
    border-left: 4px solid var(--alert-color);
    border-radius: 14px;
    margin: 10px 16px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.alert-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.1);
}

.alert-card.compact {
    margin: 8px 0;
}

.alert-main {
    width: 100%;
    display: flex;
    gap: 12px;
    padding: 14px;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
}

.alert-icon.modern {
    color: white;
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.2);
}

.alert-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.severity-pill {
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 800;
}

.severity-pill.low { background: #dcfce7; color: #166534; }
.severity-pill.medium { background: #ffedd5; color: #9a3412; }
.severity-pill.high { background: #fee2e2; color: #991b1b; }
.severity-pill.critical { background: #111827; color: #ffffff; }

.alert-description {
    color: #475569;
    font-size: 12px;
    margin-top: 6px;
}

.alert-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.alert-tags span {
    background: #f1f5f9;
    color: #475569;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 700;
}

.alert-tags .danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-actions {
    border-top: 1px solid #eef2f5;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.alert-actions button {
    border: 0;
    background: white;
    padding: 10px 6px;
    color: #475569;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    font-family: inherit;
    transition: background 0.2s ease, color 0.2s ease;
}

.alert-actions button:hover {
    background: #f8fafc;
    color: var(--sr-green);
}

.alert-actions button:disabled {
    color: var(--sr-green);
    background: #eef8f0;
    cursor: default;
}

.alerts-summary {
    margin: 12px 16px 6px;
    border-radius: 14px;
    padding: 12px 14px;
    background: #101827;
    color: white;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.alerts-summary strong {
    font-size: 22px;
}

.alerts-summary span {
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
}

.empty-state {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
    gap: 8px;
    text-align: center;
    padding: 24px;
}

.empty-state.compact {
    min-height: 86px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
}

.empty-state i {
    color: var(--sr-green);
    font-size: 28px;
}

.photo-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.photo-chip {
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 999px;
    background: #eef6ff;
    color: #1d4ed8;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 700;
}

.photo-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-rank {
    margin-top: 16px;
    border: 1px solid #dbe4ea;
    border-radius: 14px;
    background: #f8fafc;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.profile-rank strong {
    color: var(--sr-green);
    font-size: 13px;
}

.profile-rank span {
    color: var(--sr-text-light);
    font-size: 12px;
}

@media (max-width: 480px) {
    .trust-strip {
        width: calc(100% - 24px);
        margin: 0 12px 12px;
    }

    .trust-strip > div {
        padding: 8px;
        min-height: 58px;
    }

    .trust-strip strong {
        font-size: 18px;
    }

    .alert-card {
        margin-left: 12px;
        margin-right: 12px;
    }

    .alert-actions button {
        font-size: 10px;
    }
}
