/* =====================================================
   trajet.css
   ===================================================== */

.trajet-page {
    background: #f6f7fb;
    min-height: 100vh;
}

/* ── Hero ─────────────────────────────────────────── */
.trajet-hero {
    background: linear-gradient(135deg, #fff6d8 0%, #ffe8a3 50%, #fff7e8 100%);
    padding: 52px 16px 80px;
}

.trajet-hero-inner {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.trajet-hero-title {
    margin: 0 0 10px;
    font-size: 34px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.trajet-hero-sub {
    margin: 0 0 28px;
    font-size: 16px;
    color: #4b5563;
}

/* Matches .hero-card in app.css */
.trajet-form-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 18px 45px rgba(17, 24, 39, .25);
    text-align: left;
}

/* ── Labels ───────────────────────────────────────── */
.trajet-field label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 6px;
}

/* ── Route inputs ─────────────────────────────────── */
.trajet-route-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

/* Points et ligne : colonne indépendante, hors du champ */
.trajet-route-dots {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    padding: 18px 0;
    gap: 0;
}

.trajet-route-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.trajet-route-dot--start { background: #10B981; }
.trajet-route-dot--end   { background: #ffd000; border: 2px solid #b07800; }

.trajet-route-line {
    width: 2px;
    flex: 1;
    min-height: 20px;
    background: #e5e7eb;
    margin: 4px 0;
}

/* Champs texte : le seul élément arrondi */
.trajet-route-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f7f7fb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    transition: border-color .15s, box-shadow .15s;
}

.trajet-route-fields:focus-within {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79,70,229,.10);
    background: #fff;
}

.trajet-route-sep {
    height: 1px;
    background: #e5e7eb;
    margin: 0 14px;
}

.trajet-field--route {
    position: relative;
}

.trajet-field--route label {
    font-size: 10px;
    font-weight: 800;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin: 0;
    padding: 10px 14px 2px;
    display: block;
}

.trajet-field--route input {
    width: 100%;
    padding: 2px 14px 10px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 500;
    color: #111827;
    outline: none;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}
.trajet-field--route input:focus {
    outline: none;
    box-shadow: none;
}
.trajet-field--route input::placeholder { color: #9ca3af; }

/* Swap button */
.trajet-swap-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    color: #9ca3af;
    flex-shrink: 0;
    transition: border-color .15s, color .15s;
}
.trajet-swap-btn:hover {
    border-color: #4f46e5;
    color: #4f46e5;
}

/* ── Options row ──────────────────────────────────── */
.trajet-options-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    margin-bottom: 20px;
}

.trajet-options-row .trajet-field:last-child {
    grid-column: 1 / -1;
}

.trajet-field {
    display: flex;
    flex-direction: column;
}

/* Select */
.trajet-select-wrap {
    position: relative;
}
.trajet-select-wrap select {
    width: 100%;
    padding: 10px 32px 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    background: #f7f7fb;
    box-sizing: border-box;
    appearance: none;
    cursor: pointer;
    outline: none;
    transition: border-color .15s;
}
.trajet-select-wrap::after {
    content: '';
    position: absolute;
    right: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #9ca3af;
    pointer-events: none;
}
.trajet-select-wrap select:focus { border-color: #4f46e5; }

/* Consumption */
.trajet-conso-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f7f7fb;
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.trajet-conso-wrap:focus-within {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.trajet-conso-wrap input {
    flex: 1;
    padding: 10px 4px 10px 12px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    outline: none;
    min-width: 0;
}
.trajet-conso-unit {
    padding: 0 10px;
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    font-weight: 600;
    user-select: none;
}

/* Segmented control — matches .seg / .seg.active in app.css */
.trajet-segmented {
    display: flex;
    gap: 6px;
}

.trajet-seg {
    flex: 1;
    padding: 11px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    color: #6b7280;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    text-align: center;
}
.trajet-seg.active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

/* ── Submit — matches .btn.primary ───────────────── */
.trajet-submit {
    width: 100%;
    padding: 14px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background .15s;
}
.trajet-submit:hover:not(:disabled) { background: #4338ca; }
.trajet-submit:disabled { background: #9ca3af; cursor: not-allowed; }

/* Spinner */
.trajet-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: trajet-spin .7s linear infinite;
}
@keyframes trajet-spin { to { transform: rotate(360deg); } }

/* ── Autocomplete ─────────────────────────────────── */
.trajet-autocomplete {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    list-style: none;
    padding: 4px 0;
    margin: 0;
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
    z-index: 1000;
    max-height: 230px;
    overflow-y: auto;
}
.trajet-autocomplete li {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}
.trajet-autocomplete li:hover { background: #f7f7fb; }

/* ── Error ────────────────────────────────────────── */
.trajet-error {
    margin: 12px 0 0;
    padding: 12px 14px;
    background: rgba(255,255,255,.9);
    color: #b91c1c;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border-left: 3px solid #ef4444;
}

/* ── How it works ─────────────────────────────────── */
.trajet-how {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 16px 48px;
}

.trajet-how-inner {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px 28px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.trajet-how-step {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.trajet-how-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffd000;
    color: #0f172a;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.trajet-how-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-top: 2px;
}

.trajet-how-text strong {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
}

.trajet-how-text span {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.trajet-how-divider {
    width: 1px;
    height: 44px;
    background: #e5e7eb;
    flex-shrink: 0;
    margin: 0 24px;
}

/* ── Results ──────────────────────────────────────── */
.trajet-results {
    max-width: 1160px;
    margin: 24px auto 60px;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    align-items: start;
}

/* ── Sidebar ──────────────────────────────────────── */
.trajet-sidebar {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Summary — matches .hero-card style ───────────── */
.trajet-summary {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
}

.trajet-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.trajet-summary-item {
    background: #f7f7fb;
    border: 1px solid #e9e9f6;
    border-radius: 8px;
    padding: 12px;
}

.trajet-summary-label {
    display: block;
    font-size: 11px;
    color: #6b7280;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.trajet-summary-value {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
}

.trajet-summary-value--best { color: #ffd000; }

/* ── List header ──────────────────────────────────── */
.trajet-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0 2px;
}

.trajet-list-title {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
}

/* Matches .distance-chip in app.css */
.trajet-count {
    background: #eef2ff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 700;
}

/* ── List ─────────────────────────────────────────── */
.trajet-list {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.trajet-list::-webkit-scrollbar { width: 4px; }
.trajet-list::-webkit-scrollbar-track { background: transparent; }
.trajet-list::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

/* ── Station card — extends .station-card ─────────── */
.trajet-station {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
}
.trajet-station:hover {
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(79,70,229,.08);
}
.trajet-station--best {
    border-color: #ffd000;
    box-shadow: 0 2px 8px rgba(217,120,40,.1);
}
.trajet-station--best:hover {
    border-color: #b07800;
    box-shadow: 0 4px 14px rgba(217,120,40,.18);
}
.trajet-station--selected {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79,70,229,.15) !important;
    background: #eef2ff;
}

/* Rank — matches .station-rank in app.css */
.trajet-station-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    background: #e5e7eb;
    color: #6b7280;
}
.trajet-station-rank.rank-1 { background: #FACC15; color: #333; }
.trajet-station-rank.rank-2 { background: #C0C0C0; color: #333; }
.trajet-station-rank.rank-3 { background: #CD7F32; color: #fff; }

.trajet-station-info { min-width: 0; }

/* Matches .station-name */
.trajet-station-name {
    font-size: 14px;
    font-weight: 800;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

/* Matches .station-location */
.trajet-station-addr {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trajet-station-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Matches .distance-chip */
.trajet-badge-hw {
    background: #eef2ff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 700;
}

.trajet-station-price-col { text-align: right; }

.trajet-station-price {
    font-size: 15px;
    font-weight: 800;
    color: #111827;
    white-space: nowrap;
    display: block;
}
.trajet-station--best .trajet-station-price { color: #ffd000; }

/* Freshness */
.trajet-fresh { color: #16a34a; font-weight: 700; }
.trajet-stale { color: #ef4444; font-weight: 700; }

.trajet-empty {
    color: #9ca3af;
    font-size: 14px;
    text-align: center;
    padding: 40px 0;
}

/* ── Map ──────────────────────────────────────────── */
.trajet-map-wrap {
    position: sticky;
    top: 16px;
}

#trajet-map {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    height: calc(100vh - 110px);
    min-height: 480px;
    max-height: 740px;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 980px) {
    .trajet-results {
        grid-template-columns: 1fr;
    }
    .trajet-map-wrap {
        position: static;
        order: -1;
    }
    #trajet-map {
        height: 320px;
        min-height: 260px;
        max-height: 320px;
    }
    .trajet-list {
        max-height: none;
    }
}

@media (max-width: 680px) {
    .trajet-how-inner {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    .trajet-how-divider {
        width: 100%;
        height: 1px;
        margin: 0;
    }
}

@media (max-width: 620px) {
    .trajet-options-row {
        grid-template-columns: 1fr 1fr;
    }
    .trajet-options-row .trajet-field:last-child {
        grid-column: 1 / -1;
    }
    .trajet-hero { padding: 36px 16px 72px; }
    .trajet-hero-title { font-size: 24px; }
    .trajet-hero-sub { font-size: 14px; margin-bottom: 20px; }
}
