/* ============================
   WIPSEE MOBILE GPS - STYLESHEET
   ============================
   
   This stylesheet provides a modern minimalist design for the Wipsee GPS
   tracking application. It includes responsive layouts, a unified color system,
   and accessibility-focused UI components.
   
   TABLE OF CONTENTS:
   1. Color Palette (Root Variables)
   2. Reset & Base Styles
   3. Utility Classes
   4. Button System
   5. Form Controls
   6. Map
   7. Result Section
   8. History & List
   9. Distance Summary
   10. Car Management
   11. Modal & Overlay
   12. Switch / Toggle
   13. Toasts / Notifications
   14. Responsive Design
   
   ============================ */

/* ========================
   1. COLOR PALETTE (Root Variables)
======================== */
:root {
    /* Backgrounds */
    --bg: #fafbfc;
    --bg-secondary: #f3f4f6;
    --card: #ffffff;
    
    /* Text Colors */
    --text: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    
    /* Button System */
    --button-bg: #e8e8e8;
    --button-hover: #d9d9d9;
    --button-border: #d4d4d4;
    --button-text: #1f2937;
    
    /* Accent Colors */
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #e0f2fe;
    --accent: #06b6d4;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    
    /* UI Elements */
    --border: #e5e7eb;
    
    /* Spacing */
    --gap: 16px;
    --gap-sm: 8px;
    --gap-lg: 24px;
    
    /* Border Radius */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ========================
   RESET & BASE STYLES
======================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-touch-callout: none;
}

input, textarea, select, button {
    -webkit-user-select: text;
    user-select: text;
}

h1, h2, h3 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 12px;
    color: var(--text);
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 22px;
}

p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Header et footer gérés par Bootstrap - ne pas les surcharger */

/* ========================
   UTILITY CLASSES
======================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid #d1d5db;
}

.hidden {
    display: none !important;
}

.no-scroll {
    overflow: hidden;
}

.muted {
    color: var(--text-muted);
    font-size: 12px;
}

/* ========================
   BUTTON SYSTEM
======================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    background: var(--button-bg) !important;
    color: var(--button-text) !important;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Button Variants */
.btn-primary {
    background: var(--button-bg) !important;
    color: var(--button-text) !important;
    border-color: var(--button-border);
}

.btn-primary:hover {
    background: var(--button-hover) !important;
    box-shadow: var(--shadow-sm);
}

.btn-accent {
    background: var(--button-bg) !important;
    color: var(--button-text) !important;
    border-color: var(--button-border);
}

.btn-accent:hover {
    background: var(--button-hover) !important;
    box-shadow: var(--shadow-sm);
}

.btn-ghost {
    background: var(--button-bg) !important;
    color: var(--button-text) !important;
    border: 1px solid var(--button-border);
}

.btn-ghost:hover {
    background: var(--button-hover) !important;
    border-color: #c0c0c0;
}

/* Button Sizes */
.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.btn-sm {
    padding: 6px 8px;
    font-size: 12px;
}

/* Touch-friendly buttons for mobile */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
}

.btn-file {
    white-space: nowrap;
}

/* Special button styling */
#backBtn {
    margin-bottom: 15px;
}

#clearHistoryBtn {
    display: block;
    margin: 20px auto;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

#clearHistoryBtn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.delete-btn {
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
}

.delete-btn:hover {
    background: var(--danger);
    color: #fff;
    border-color: rgba(0, 0, 0, 0.08);
}

/* ========================
   FORM CONTROLS
======================== */
label {
    display: block;
    margin: 10px 0 6px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-control, input, textarea, select {
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    transition: all 0.2s;
    font-size: 14px;
    color: var(--text);
}

.form-control:focus, input:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(14, 165, 233, 0.12);
    outline: none;
}

#result input, #result textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

#result input:focus, #result textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(14, 165, 233, 0.12);
    outline: none;
}

#route-form {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#route-form input, #route-form textarea {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 16px;
    transition: all 0.3s;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="url"],
textarea,
select {
    font-size: 16px !important;
}

#route-form input:focus, #route-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(14, 165, 233, 0.12);
    outline: none;
}

.car-form .form-row {
    display: flex;
    gap: 8px;
}

/* ========================
   MAP
======================== */
#map {
    height: 65vh;
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

/* ========================
   RESULT SECTION
======================== */
#info {
    display: none;
}

#info.active, #liveStatus {
    display: block !important;
    text-align: center;
    margin-bottom: 15px;
    font-size: 16px;
    color: var(--text-secondary);
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
}

#warning {
    color: var(--danger);
    font-weight: 600;
}

#result {
    background: var(--card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

#result ul {
    list-style: none;
    margin-bottom: 16px;
}

#result li {
    padding: 8px 0;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

/* ========================
   HISTORY & LIST
======================== */
#history {
    list-style: none;
    max-width: 700px;
    margin: 0 auto 20px;
    padding: 0;
    display: block;
}

#history li {
    padding: 12px 15px;
    margin-bottom: 10px;
    background: var(--card);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.18s;
    box-shadow: var(--shadow);
    border: 1px solid #d1d5db;
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
}

#history li:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(9, 30, 66, 0.06);
}

.history-content {
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    justify-content: space-between;
    flex-wrap: wrap;
}

.history-item:focus {
    outline: none;
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.12);
    transform: translateY(-2px);
}

.history-empty {
    opacity: 0.9;
    text-align: center;
}

/* ========================
   DISTANCE SUMMARY
======================== */
#distanceSummary {
    max-width: 700px;
    margin: 20px auto;
    padding: 18px;
    border-radius: 14px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 10px;
}

.summary-value {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
}

/* ========================
   CAR MANAGEMENT
======================== */
.cars-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.cars-top {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 12px;
    align-items: start;
}

.car-card {
    width: 220px;
    background: var(--card);
    border-radius: var(--radius);
    padding: 10px;
    box-shadow: var(--shadow);
    border: 1px solid #d1d5db;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.car-card img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.car-card .meta {
    font-size: 13px;
    color: var(--text-muted);
}

.car-card:focus {
    outline: none;
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.car-just-added {
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-lg);
}

.form-row {
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.car-form-actions {
    margin-top: 10px;
}

.cars-panel {
    margin-top: 16px;
}

.car-summary-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.summary-sub {
    margin-top: 8px;
    font-size: 14px;
}

.vehicle-image-container {
    margin: 8px 0;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.button-group {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.car-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.car-preview {
    width: 260px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    position: relative;
    flex-shrink: 0;
}

.car-preview img {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.car-preview-label {
    position: absolute;
    left: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.car-fields {
    flex: 1;
}

.car-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.car-summary {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

#carCreatePanel.compact {
    padding: 12px;
}

#carCreatePanel.compact h2 {
    font-size: 16px;
    margin-bottom: 8px;
}

#carCreatePanel.compact .form-control {
    padding: 8px;
    font-size: 13px;
}

#carCreatePanel.compact .form-actions {
    margin-top: 8px;
}

#carCreatePanel.compact .car-preview img {
    height: 120px;
}

#toll {
    max-width: 160px;
}

#tolls {
    font-weight: 700;
    color: var(--primary);
}

#summaryToll {
    color: var(--accent);
    font-weight: 700;
}

/* ========================
   MODAL & OVERLAY
======================== */
#overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    z-index: 1000;
    display: none;
}

#overlay:not(.hidden) {
    display: block;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    width: calc(100% - 40px);
    max-width: 760px;
    max-height: 85vh;
    overflow: auto;
    padding: 20px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.25);
}

.modal.hidden {
    display: none;
}

.modal .close-btn {
    position: absolute;
    right: 12px;
    top: 8px;
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.modal .close-btn:hover {
    color: var(--text);
}

.modal #map {
    height: 320px !important;
    width: 100%;
    margin-top: 12px;
    border-radius: var(--radius-sm);
}

#details {
    background: var(--card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

#details p {
    margin-bottom: 10px;
}

/* ========================
   SWITCH / TOGGLE
======================== */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border: 2px solid #94a3b8;
    border-radius: 24px;
    transition: 0.25s;
    cursor: pointer;
}

.slider:before {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 1px;
    bottom: 1px;
    background: #fff;
    border-radius: 50%;
    transition: 0.25s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.switch input:checked + .slider {
    background: var(--primary);
    border-color: var(--primary-dark);
}

.switch input:checked + .slider:before {
    transform: translateX(22px);
    box-shadow: 0 2px 4px rgba(14, 165, 233, 0.3);
}

/* ========================
   TOASTS / NOTIFICATIONS
======================== */
.toast {
    min-width: 240px;
    background: var(--card);
    padding: 12px 14px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(9, 30, 66, 0.12);
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.22s;
}

.toast--show {
    opacity: 1;
    transform: translateY(0);
}

.toast--hide {
    opacity: 0;
    transform: translateY(12px);
}

.toast--info {
    border-left: 4px solid var(--primary);
}

.toast--success {
    border-left: 4px solid var(--success);
}

.toast--warning {
    border-left: 4px solid var(--accent);
}

.toast__actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
}

.toast__text {
    font-size: 14px;
    color: var(--text);
}

/* ========================
    RESPONSIVE DESIGN - TABLET (768px - 1024px)
======================== */
@media (max-width: 1024px) {
    body {
        padding: 16px;
        font-size: 15px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    h2 {
        font-size: 20px;
    }
    
    header, footer {
        padding: 20px 16px;
        margin-bottom: 20px;
    }
    
    .card {
        padding: 16px;
    }
    
    #route-form {
        gap: 12px;
        padding: 16px;
    }
    
    #route-form input, #route-form select {
        font-size: 14px;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    #map {
        height: 50vh;
        border-radius: var(--radius);
    }
    
    .modal {
        width: calc(100% - 28px);
        max-width: 600px;
        padding: 16px;
    }
    
    .modal #map {
        height: 280px;
    }
    
    .cars-top {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .car-row {
        flex-direction: column;
    }
    
    .car-preview {
        width: 100%;
        height: 200px;
    }
    
    .car-preview img {
        height: 150px;
    }
}

/* ========================
    RESPONSIVE DESIGN - MOBILE (< 768px)
======================== */
@media (max-width: 768px) {
    body {
        padding: 12px;
        font-size: 14px;
    }
    
    h1 {
        font-size: 20px;
    }
    
    h2 {
        font-size: 18px;
    }
    
    h3 {
        font-size: 16px;
    }
    
    header {
        padding: 16px 12px;
        margin-bottom: 16px;
        border-radius: var(--radius);
    }
    
    footer {
        padding: 16px 12px;
        margin-bottom: 16px;
        border-radius: var(--radius);
    }
    
    .card {
        padding: 14px;
        border-radius: var(--radius-sm);
    }
    
    #route-form {
        flex-direction: column;
        gap: 10px;
        padding: 14px;
        border-radius: var(--radius-sm);
    }
    
    #route-form p {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    #route-form input, 
    #route-form select {
        width: 100%;
        padding: 10px;
        font-size: 14px;
        border-radius: var(--radius-sm);
    }
    
    #info {
        padding: 10px;
        font-size: 12px;
    }
    
    #info p {
        margin-bottom: 4px;
    }
    
    .btn {
        width: 100%;
        padding: 10px 12px;
        font-size: 13px;
        border-radius: var(--radius-sm);
    }
    
    .btn-block {
        margin-bottom: 8px;
    }
    
    #map {
        height: 45vh;
        border-radius: var(--radius-sm);
        margin-bottom: 12px;
    }
    
    #result {
        padding: 14px;
        border-radius: var(--radius-sm);
    }
    
    #result h2 {
        margin-bottom: 12px;
    }
    
    #result ul {
        margin-bottom: 12px;
    }
    
    #result li {
        margin-bottom: 8px;
        font-size: 13px;
    }
    
    #result label {
        font-size: 12px;
        margin-bottom: 4px;
        display: block;
    }
    
    #result .form-control {
        margin-bottom: 10px;
        padding: 8px;
        font-size: 13px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal {
        width: calc(100% - 20px);
        max-width: none;
        max-height: 90vh;
        padding: 14px;
        border-radius: var(--radius-sm);
    }
    
    .modal h2 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .modal .close-btn {
        font-size: 18px;
        right: 8px;
        top: 8px;
    }
    
    .modal #map {
        height: 240px;
        margin-top: 10px;
    }
    
    .modal .form-control {
        font-size: 13px;
        padding: 8px;
    }
    
    #overlay {
        z-index: 1000;
    }
    
    .cars-top {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .car-row {
        flex-direction: column;
    }
    
    .car-preview {
        width: 100%;
        height: 180px;
    }
    
    .car-preview img {
        height: 120px;
    }
    
    #carCreatePanel {
        padding: 14px;
        border-radius: var(--radius-sm);
    }
    
    #carCreatePanel.compact {
        padding: 10px;
    }
    
    #carCreatePanel.compact h2 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    #carCreatePanel.compact .form-control {
        padding: 6px;
        font-size: 12px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    #toll {
        width: 100%;
        max-width: none;
    }
    
    .switch {
        width: 44px;
        height: 22px;
    }
    
    .slider:before {
        height: 16px;
        width: 16px;
    }
    
    .switch input:checked + .slider:before {
        transform: translateX(20px);
    }
    
    .toast {
        min-width: 200px;
        max-width: 90%;
        font-size: 12px;
    }
    
    .toast__text {
        font-size: 12px;
    }
    
    .toast__actions {
        gap: 6px;
    }
    
    .summary-header {
        flex-direction: column;
        gap: 8px;
    }
    
    #history {
        max-width: 100%;
        margin: 0 auto 20px;
    }
    
    #history li {
        padding: 12px;
        margin-bottom: 10px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .history-content {
        font-size: 13px;
        width: 100%;
        margin-bottom: 10px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .delete-btn {
        width: 100%;
        justify-content: center;
        padding: 10px;
    }
    
    #distanceSummary {
        max-width: 100%;
        padding: 16px;
    }
    }

    /* ========================
    RESPONSIVE DESIGN - SMALL MOBILE (< 480px)
    ======================== */
    @media (max-width: 480px) {
    body {
        padding: 12px;
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        font-size: 14px;
    }
    
    h1 {
        font-size: 22px;
        margin-bottom: 12px;
        font-weight: 700;
    }
    
    h2 {
        font-size: 18px;
        margin-bottom: 12px;
        font-weight: 700;
    }
    
    h3 {
        font-size: 16px;
        font-weight: 600;
    }
    
    p {
        font-size: 14px;
        line-height: 1.5;
    }
    
    header {
        padding: 16px 12px;
        padding-top: max(16px, env(safe-area-inset-top));
        margin-bottom: 16px;
        border-radius: var(--radius);
    }
    
    footer {
        padding: 16px 12px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        margin-bottom: 0;
        border-radius: var(--radius);
    }
    
    .card {
        padding: 14px;
        border-radius: var(--radius-sm);
    }
    
    #route-form {
        padding: 14px;
        gap: 10px;
        border-radius: var(--radius-sm);
        display: flex;
        flex-direction: column;
    }
    
    #route-form p {
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    #route-form input,
    #route-form select {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--card);
        color: var(--text);
    }
    
    #route-form input:focus,
    #route-form select:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
    }
    
    .btn {
        padding: 12px 14px;
        font-size: 14px;
        min-height: 48px;
        border-radius: var(--radius-sm);
        width: 100%;
        font-weight: 600;
    }
    
    .btn:active {
        opacity: 0.85;
    }
    
    #info {
        padding: 12px;
        border-radius: var(--radius-sm);
        font-size: 13px;
    }
    
    #info p {
        margin-bottom: 6px;
    }
    
    #map {
        height: 42vh;
        border-radius: var(--radius-sm);
        margin: 12px 0;
    }
    
    #result {
        padding: 14px;
        border-radius: var(--radius-sm);
    }
    
    #result h2 {
        font-size: 18px;
        margin-bottom: 14px;
    }
    
    #result ul {
        list-style: none;
        margin-bottom: 14px;
    }
    
    #result li {
        padding: 10px;
        background: var(--bg-secondary);
        margin-bottom: 8px;
        border-radius: var(--radius-sm);
        font-size: 13px;
        border-left: 3px solid var(--primary);
    }
    
    #result label {
        font-size: 13px;
        font-weight: 600;
        margin-bottom: 6px;
        display: block;
        color: var(--text);
    }
    
    #result .form-control {
        margin-bottom: 12px;
        padding: 12px;
        font-size: 16px;
        width: 100%;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--card);
    }
    
    .button-group {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 12px;
    }
    
    .modal {
        width: calc(100% - 20px);
        max-width: 100%;
        max-height: 90vh;
        padding: 14px;
        border-radius: var(--radius-sm);
        margin: 0 auto;
    }
    
    .modal h2 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .modal .close-btn {
        font-size: 24px;
        right: 10px;
        top: 10px;
    }
    
    .modal #map {
        height: 220px;
        margin-top: 12px;
    }
    
    .modal .form-control {
        font-size: 16px;
        padding: 12px;
        margin-bottom: 10px;
    }
    
    #overlay {
        z-index: 1000;
    }
    
    .cars-top {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .car-row {
        flex-direction: column;
    }
    
    .car-preview {
        width: 100%;
        height: 160px;
        border-radius: var(--radius-sm);
    }
    
    .car-preview img {
        height: 100px;
    }
    
    #carCreatePanel {
        padding: 14px;
        border-radius: var(--radius-sm);
    }
    
    #carCreatePanel.compact {
        padding: 12px;
    }
    
    #carCreatePanel.compact h2 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    #carCreatePanel.compact .form-control {
        padding: 10px;
        font-size: 14px;
    }
    
    .form-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 12px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    #toll {
        width: 100%;
    }
}

/* ========================
    RESPONSIVE DESIGN - IPHONE (375px - 480px)
======================== */
@media (max-width: 375px) {
    body {
        padding: 10px;
        padding-top: max(10px, env(safe-area-inset-top));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        font-size: 13px;
    }
    
    h1 {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    h2 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    header {
        padding: 14px 10px;
        padding-top: max(14px, env(safe-area-inset-top));
        margin-bottom: 14px;
    }
    
    footer {
        padding: 14px 10px;
        padding-bottom: max(14px, env(safe-area-inset-bottom));
        margin-bottom: 0;
    }
    
    .card {
        padding: 12px;
    }
    
    #route-form {
        padding: 12px;
        gap: 9px;
    }
    
    #route-form p {
        font-size: 12px;
    }
    
    #route-form input,
    #route-form select {
        padding: 11px;
        font-size: 16px;
    }
    
    .btn {
        padding: 11px 12px;
        font-size: 13px;
        min-height: 44px;
    }
    
    #map {
        height: 38vh;
        margin: 10px 0;
    }
    
    #result {
        padding: 12px;
    }
    
    #result li {
        padding: 8px;
        margin-bottom: 6px;
        font-size: 12px;
    }
    
    #result label {
        font-size: 12px;
        margin-bottom: 4px;
    }
    
    #result .form-control {
        margin-bottom: 10px;
        padding: 10px;
        font-size: 16px;
    }
    
    .modal {
        width: calc(100% - 16px);
        padding: 12px;
    }
    
    .modal h2 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .modal #map {
        height: 200px;
    }
    
    .modal p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        font-size: 13px;
        line-height: 1.5;
    }
    
    .modal .close-btn {
        font-size: 20px;
    }
    
    #history li {
        padding: 10px;
        margin-bottom: 8px;
    }
    
    .history-content {
        font-size: 12px;
        line-height: 1.4;
    }
    
    #distanceSummary {
        max-width: 100%;
        padding: 14px;
        margin: 12px auto;
    }
    
    .summary-value {
        font-size: 22px;
    }
    }

