/* =========================================================
   lireGPX — Design system
   Même identité visuelle que GPX → MP4
   La logique JavaScript et les IDs fonctionnels sont conservés.
   ========================================================= */

:root {
    --navy: #102235;
    --navy-strong: #0a1725;
    --ink: #17283a;
    --muted: #687889;
    --paper: #f6f8fb;
    --white: #ffffff;
    --line: rgba(16, 34, 53, .12);
    --line-strong: rgba(16, 34, 53, .18);
    --yellow: #ffdc00;
    --yellow-soft: rgba(255, 220, 0, .16);
    --shadow: 0 18px 55px rgba(16, 34, 53, .14);
    --shadow-soft: 0 8px 30px rgba(16, 34, 53, .10);
    --radius: 18px;
    --header-height: 72px;
}

/* =========================================================
   GLOBAL
   ========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: var(--paper);
    color: var(--ink);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input,
select {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.hidden {
    display: none !important;
}

/* =========================================================
   CARTE
   ========================================================= */

#map {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: #dce5ea;
}

/*
 * Les contrôles Leaflet restent fonctionnels mais prennent
 * l'identité visuelle de l'application.
 */

.leaflet-control-zoom {
    border: 0 !important;
    box-shadow: var(--shadow-soft) !important;
}

.leaflet-control-zoom a {
    width: 40px !important;
    height: 40px !important;
    line-height: 40px !important;
    border: 0 !important;
    background: rgba(255, 255, 255, .94) !important;
    color: var(--navy) !important;
    font-size: 20px !important;
}

.leaflet-control-zoom a:first-child {
    border-radius: 12px 12px 0 0;
}

.leaflet-control-zoom a:last-child {
    border-radius: 0 0 12px 12px;
}

.leaflet-control-attribution {
    background: rgba(255, 255, 255, .78) !important;
    color: #536271 !important;
    border-radius: 8px 0 0 0;
}

/* =========================================================
   BARRE D'IDENTITÉ
   ========================================================= */

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 12px 22px;
    z-index: 900;
    pointer-events: none;
}

.brand-lockup,
.brand-link {
    pointer-events: auto;
}

.brand-lockup {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 9px 15px;
    border: 1px solid rgba(16, 34, 53, .10);
    border-radius: 14px;
    background: rgba(255, 255, 255, .88);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.brand {
    color: var(--navy);
    text-decoration: none;
}

.brand-main {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -.04em;
}

.brand-tagline {
    font-size: .72rem;
    color: var(--muted);
    letter-spacing: .02em;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: 13px;
    background: var(--navy);
    color: var(--white);
    text-decoration: none;
    font-size: .82rem;
    font-weight: 650;
    box-shadow: var(--shadow-soft);
    transition: transform .18s ease, background .18s ease;
}

.brand-link:hover {
    background: var(--navy-strong);
    transform: translateY(-1px);
}

/* =========================================================
   MENU TOGGLE
   ========================================================= */

#menuToggle {
    position: fixed;
    top: 86px;
    left: 20px;
    width: 48px;
    height: 48px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(16, 34, 53, .12);
    border-radius: 14px;
    background: rgba(255, 255, 255, .94);
    color: var(--navy);
    cursor: pointer;
    z-index: 1100;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: transform .18s ease, box-shadow .18s ease;
}

#menuToggle:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.menu-toggle-icon {
    width: 19px;
    display: grid;
    gap: 4px;
}

.menu-toggle-icon span {
    display: block;
    height: 2px;
    border-radius: 99px;
    background: currentColor;
}

/* =========================================================
   MENU
   ========================================================= */

#menu {
    position: fixed;
    top: 20px;
    left: 20px;
    bottom: 20px;
    width: min(360px, calc(100vw - 40px));
    padding: 22px;
    overflow-y: auto;
    z-index: 1200;
    border: 1px solid rgba(16, 34, 53, .10);
    border-radius: 24px;
    background: rgba(250, 252, 254, .96);
    color: var(--ink);
    box-shadow: 0 28px 80px rgba(16, 34, 53, .22);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    animation: menu-in .18s ease-out;
}

@keyframes menu-in {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.menu-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.menu-kicker,
.menu-section-title {
    margin: 0;
    color: var(--muted);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .15em;
}

.menu-header h2 {
    margin: 5px 0 0;
    color: var(--navy);
    font-size: 1.55rem;
    line-height: 1;
    letter-spacing: -.04em;
}

.menu-close {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: rgba(16, 34, 53, .06);
    color: var(--navy);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.menu-section {
    padding: 21px 0;
    border-bottom: 1px solid var(--line);
}

.menu-section-title {
    margin-bottom: 11px;
}

.menu-button {
    width: 100%;
    min-height: 43px;
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 7px 0;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
    color: var(--navy);
    cursor: pointer;
    text-align: left;
    font-size: .86rem;
    font-weight: 650;
    transition:
        transform .15s ease,
        border-color .15s ease,
        background .15s ease,
        box-shadow .15s ease;
}

.menu-button:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
    box-shadow: 0 5px 18px rgba(16, 34, 53, .08);
}

.menu-button:active {
    transform: translateY(0);
}

.menu-button-primary {
    background: var(--navy);
    border-color: var(--navy);
    color: var(--white);
}

.menu-button-primary:hover {
    background: var(--navy-strong);
    border-color: var(--navy-strong);
}

.menu-button-secondary {
    background: rgba(255, 255, 255, .78);
}

.button-symbol {
    width: 21px;
    flex: 0 0 21px;
    display: inline-grid;
    place-items: center;
    font-size: 1rem;
    opacity: .82;
}

.file-drop {
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 9px 0;
    padding: 12px 13px;
    border: 1px dashed rgba(16, 34, 53, .25);
    border-radius: 13px;
    background: rgba(255, 255, 255, .68);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.file-drop:hover {
    border-color: var(--navy);
    background: var(--white);
}

.file-drop-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--yellow);
    color: var(--navy);
    font-weight: 800;
}

.file-drop strong,
.file-drop small {
    display: block;
}

.file-drop strong {
    font-size: .84rem;
}

.file-drop small {
    margin-top: 2px;
    color: var(--muted);
    font-size: .72rem;
}

#fileInput {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.url-field {
    margin: 14px 0;
}

.field-label,
.url-field label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 700;
}

.url-row {
    display: grid;
    grid-template-columns: 1fr 44px;
    gap: 7px;
}

.url-row input,
.menu-select {
    width: 100%;
    min-height: 43px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    outline: 0;
    background: var(--white);
    color: var(--navy);
}

.url-row input:focus,
.menu-select:focus {
    border-color: rgba(16, 34, 53, .35);
    box-shadow: 0 0 0 3px rgba(16, 34, 53, .06);
}

.url-row button {
    min-height: 43px;
    border: 0;
    border-radius: 11px;
    background: var(--navy);
    color: var(--white);
    cursor: pointer;
    font-size: 1.15rem;
}

.play-grid,
.history-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.field-label {
    margin-top: 14px;
}

.menu-select {
    appearance: auto;
    font-size: .84rem;
}

.menu-footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding-top: 18px;
    color: var(--muted);
    font-size: .72rem;
}

.menu-footer a {
    color: var(--navy);
    text-decoration: none;
    font-weight: 700;
}

/* =========================================================
   CREATION OVERLAY
   ========================================================= */

.overlay {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 16px;
    border: 1px solid rgba(16, 34, 53, .12);
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: var(--navy);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    font-size: .82rem;
    font-weight: 700;
    pointer-events: none;
}

.overlay small {
    color: var(--muted);
    font-weight: 500;
}

.creation-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--yellow);
    box-shadow: 0 0 0 5px var(--yellow-soft);
}

/* =========================================================
   DASHBOARD
   ========================================================= */

.dashboard {
    position: fixed;
    left: 20px;
    bottom: 48px;
    z-index: 1000;
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    border: 1px solid rgba(16, 34, 53, .11);
    border-radius: 16px;
    background: rgba(255, 255, 255, .92);
    color: var(--navy);
    box-shadow: var(--shadow);
    overflow: hidden;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.dashboard-item {
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 13px 17px;
    border-right: 1px solid var(--line);
}

.dashboard-item:last-child {
    border-right: 0;
}

.dashboard-label {
    color: var(--muted);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.dashboard-item strong {
    font-size: 1.02rem;
    letter-spacing: -.02em;
}

.dashboard-item small {
    color: var(--muted);
    font-size: .67rem;
    font-weight: 600;
}

/* =========================================================
   TIMELINE
   ========================================================= */

.timeline-shell {
    position: fixed;
    left: 20px;
    right: 20px;
    bottom: 15px;
    z-index: 1000;
    display: grid;
    grid-template-columns: 32px 1fr 42px;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    height: 32px;
    border: 1px solid rgba(16, 34, 53, .10);
    border-radius: 999px;
    background: rgba(255, 255, 255, .90);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.timeline-shell span {
    color: var(--muted);
    font-size: .61rem;
    font-weight: 700;
}

.timeline-end {
    text-align: right;
}

#timeline {
    width: 100%;
    margin: 0;
    accent-color: var(--navy);
    cursor: pointer;
}

/* =========================================================
   BATEAU
   ========================================================= */

.boat-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.boat {
    width: 22px;
    height: 22px;
    transform-origin: center;
}

.boat-inner {
    width: 100%;
    height: 100%;
    transform-origin: center;
}

.boat-inner svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 2px 5px rgba(16, 34, 53, .38));
}

.wind-arrow {
    transform-origin: center center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   ANCIENS CONTROLS
   ========================================================= */

.controls {
    display: none;
}

/* =========================================================
   RESPONSIVE — TABLETTE / IPAD
   ========================================================= */

@media (max-width: 820px) {
    .brand-tagline {
        display: none;
    }

    .brand-link span:first-child {
        display: none;
    }

    .brand-link {
        width: 45px;
        height: 42px;
        justify-content: center;
        padding: 0;
    }

    #menuToggle {
        top: 80px;
        left: 15px;
    }

    .dashboard {
        left: 15px;
        bottom: 55px;
        max-width: calc(100vw - 30px);
    }

    .dashboard-item {
        min-width: 100px;
        padding: 11px 13px;
    }

    .timeline-shell {
        left: 15px;
        right: 15px;
    }
}

/* =========================================================
   RESPONSIVE — PETITS ÉCRANS
   ========================================================= */

@media (max-width: 560px) {
    :root {
        --header-height: 62px;
    }

    .app-header {
        padding: 10px 12px;
    }

    .brand-lockup {
        padding: 8px 11px;
    }

    .brand-main {
        font-size: 1.08rem;
    }

    #menuToggle {
        top: 70px;
        left: 12px;
        width: 45px;
        height: 45px;
    }

    #menu {
        top: 10px;
        left: 10px;
        bottom: 10px;
        width: calc(100vw - 20px);
        padding: 18px;
        border-radius: 20px;
    }

    .dashboard {
        left: 10px;
        right: 10px;
        bottom: 51px;
        width: auto;
        max-width: none;
    }

    .dashboard-item {
        min-width: 0;
        flex: 1;
        padding: 10px 9px;
    }

    .dashboard-label {
        font-size: .55rem;
    }

    .dashboard-item strong {
        font-size: .86rem;
    }

    .timeline-shell {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .overlay {
        top: 72px;
        max-width: calc(100vw - 30px);
        white-space: nowrap;
    }

    .overlay small {
        display: none;
    }
}

/* =========================================================
   MODE PAYSAGE IPAD
   ========================================================= */

@media (orientation: landscape) and (max-height: 650px) {
    .app-header {
        min-height: 58px;
    }

    #menuToggle {
        top: 70px;
    }

    .dashboard {
        bottom: 47px;
    }

    .timeline-shell {
        bottom: 9px;
    }
}

/* =========================================================
   ACCESSIBILITÉ
   ========================================================= */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
label:focus-visible {
    outline: 3px solid rgba(255, 220, 0, .8);
    outline-offset: 2px;
}

/* =========================================================
   RÉDUCTION DES ANIMATIONS
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* =========================================================
   CONTRÔLES LEAFLET
   Éviter les chevauchements avec l'en-tête GPXtoMAP
   ========================================================= */

/* Contrôle +/- à gauche */
.leaflet-top.leaflet-left {
    top: 145px;
    left: 14px;
}

/* Sélecteur de couches à droite */
.leaflet-top.leaflet-right {
    top: 90px;
    right: 14px;
}

@media (max-width: 820px) {

    .leaflet-top.leaflet-left {
        top: 140px;
        left: 12px;
    }

    .leaflet-top.leaflet-right {
        top: 85px;
        right: 12px;
    }
}