/* ═══════════════════════════════════════════════════════════
   PAGE PLAN — wizard « Créer mon plan de course »
   Réutilise les tokens globaux de base.css (--vp, --vb, --g, --bg, --muted, --border)
   pour rester visuellement identique au reste du site (thème sombre).
════════════════════════════════════════════════════════════ */

.plan-page {
    display: flex;
    justify-content: center;
    padding: 3rem 1rem 4rem;
    min-height: calc(100vh - 200px);
}

.plan-wrap {
    width: 100%;
    max-width: 480px;
}

/* ── Header ── */
.plan-top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.plan-eyebrow {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--vc);
    margin-bottom: 5px;
}

.plan-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.9rem;
    letter-spacing: .03em;
    line-height: 1;
}

.plan-skip-all {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--muted);
    text-decoration: underline;
    white-space: nowrap;
    margin-top: 6px;
    transition: color .15s;
}

.plan-skip-all:hover {
    color: #fff;
}

/* ── Carte principale ── */
.plan-card {
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 20px;
    padding: 1.75rem 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    min-height: 560px;
}

@media (min-width: 640px) {
    .plan-card {
        padding: 2rem 2rem 2.25rem;
    }
}

/* ── Stepper ── */
.plan-stepper {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
}

.plan-step-item {
    display: flex;
    align-items: center;
    flex: 1;
}

.plan-step-item--last {
    flex: 0;
}

.plan-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .05);
    color: var(--muted);
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .25s;
    position: relative;
}

.plan-step-num--done {
    background: var(--g);
    border-color: transparent;
    color: #fff;
}

.plan-step-num--active {
    border-color: var(--vc);
    color: var(--vc);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, .15);
}

.plan-step-line {
    flex: 1;
    height: 1.5px;
    background: rgba(255, 255, 255, .1);
    transition: background .3s;
}

.plan-step-line--done {
    background: var(--g);
}

.plan-step-label {
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'DM Mono', monospace;
    font-size: 8px;
    color: var(--muted);
    white-space: nowrap;
    letter-spacing: .06em;
}

.plan-step-num--active .plan-step-label {
    color: var(--vc);
}

.plan-step-num--done .plan-step-label {
    color: rgba(255, 255, 255, .5);
}

/* ── Contenu étape ── */
.plan-step {
    display: none;
    flex: 1;
    flex-direction: column;
    animation: planFadeIn .2s ease;
}

.plan-step--active {
    display: flex;
}

@keyframes planFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

.plan-q {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    line-height: 1.1;
    margin-bottom: 6px;
}

.plan-hint {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.55;
    margin-bottom: 18px;
}

.plan-hint strong {
    color: rgba(255, 255, 255, .8);
    font-weight: 600;
}

/* ── Cards ── */
.plan-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plan-card-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .03);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    position: relative;
}

.plan-card-item:hover {
    border-color: rgba(167, 139, 250, .35);
    background: rgba(255, 255, 255, .06);
}

.plan-card-item--sel {
    border-color: var(--vc);
    background: rgba(118, 75, 162, .16);
}

.plan-card-item.plan-card-item--locked {
    opacity: .35;
    cursor: not-allowed;
    pointer-events: none;
}

.plan-radio {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .25);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .15s;
}

.plan-card-item--sel .plan-radio {
    border-color: var(--vc);
}

.plan-card-item--sel .plan-radio::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--vc);
}

.plan-ctext {
    flex: 1;
}

.plan-clabel {
    font-size: 14px;
    font-weight: 700;
}

.plan-csub {
    font-family: 'DM Mono', monospace;
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 2px;
}

.plan-badge {
    font-family: 'DM Mono', monospace;
    font-size: 9.5px;
    padding: 3px 8px;
    border-radius: 99px;
    flex-shrink: 0;
    white-space: nowrap;
}

.plan-badge--prio {
    background: rgba(167, 139, 250, .15);
    border: 1px solid rgba(167, 139, 250, .3);
    color: var(--vc);
}

.plan-badge--lock {
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .1);
    color: var(--muted);
    display: none;
}

.plan-badge--training {
    margin-left: 6px;
}

.plan-card-item--training {
    flex-wrap: wrap;
}

/* ── Input niveau / objectif / distance ── */
.plan-input-wrap {
    margin-top: 12px;
    position: relative;
}

.plan-input {
    width: 100%;
    padding: 11px 13px 11px 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .05);
    color: #fff;
    font-family: 'Syne', sans-serif;
    font-size: 13.5px;
    transition: border-color .15s;
    outline: none;
}

.plan-input--date {
    padding-left: 13px;
    color-scheme: dark;
}

.plan-input:focus {
    border-color: var(--vc);
}

.plan-input--error {
    border-color: #f87171;
}

.plan-input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
    filter: brightness(10);
}

.plan-input-range {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: var(--muted);
    margin-top: 5px;
    padding-left: 4px;
}

/* ── Mémoriser le niveau (compte connecté) ── */
.plan-save-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}

.plan-save-row input[type="checkbox"] {
    accent-color: var(--vc);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* ── Date row (étape 4) ── */
.plan-date-row {
    display: flex;
    gap: 10px;
}

.plan-date-field {
    flex: 1;
}

.plan-date-label {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* ── Notes ── */
.plan-note {
    margin-top: 12px;
    background: rgba(167, 139, 250, .08);
    border-left: 2px solid var(--vc);
    border-radius: 0 8px 8px 0;
    padding: 10px 12px;
    font-size: 12px;
    color: rgba(220, 215, 245, .85);
    line-height: 1.55;
    display: none;
}

.plan-note--show {
    display: block;
}

.plan-note--warn {
    background: rgba(251, 191, 36, .08);
    border-left-color: #fbbf24;
    color: rgba(255, 240, 180, .85);
}

.plan-inline-link {
    text-decoration: underline;
    cursor: pointer;
}

.plan-inline-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
}

/* ── Skip ── */
.plan-skip-row {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 18px;
}

.plan-skip {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--muted);
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    transition: color .15s;
}

.plan-skip:hover {
    color: rgba(255, 255, 255, .75);
}

/* ── Dropzone ── */
.plan-dropzone {
    border: 2px dashed rgba(255, 255, 255, .18);
    border-radius: 16px;
    padding: 36px 18px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
    transition: border-color .2s, background .2s;
}

.plan-dropzone:hover,
.plan-dropzone--drag {
    border-color: var(--vc);
    background: rgba(118, 75, 162, .07);
}

.plan-dropzone--error {
    border-color: #f87171;
    background: rgba(239, 68, 68, .07);
    animation: planShake .35s ease;
}

/* ── Sélecteur de parcours officiel ── */
/* Colonne (spinner+libellé sur une ligne, anecdote centrée en dessous, cf. ui/anecdotes.js
   qui ajoute .anecdote-text comme second enfant de ce conteneur) plutôt qu'une simple ligne. */
.plan-course-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-top: 14px;
    padding: 10px 12px;
}

.plan-course-loading--show {
    display: flex;
}

.plan-course-loading-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: var(--muted);
}

.plan-spinner {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .15);
    border-top-color: var(--vc);
    animation: planSpin .7s linear infinite;
}

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

.plan-course-list {
    margin-top: 12px;
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* Évite que le scroll de la liste ne déclenche le scroll de toute la page sur mobile
       dès qu'on atteint le haut/bas de la liste. */
    overscroll-behavior: contain;
}

.plan-course-item {
    /* Empilé (nom puis méta) plutôt que côte à côte : la méta inclut désormais la date/heure
       en plus de distance/D+, une seule ligne horizontale serait trop chargée sur mobile. */
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .03);
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, background .15s;
}

.plan-course-item:hover {
    border-color: rgba(167, 139, 250, .35);
    background: rgba(255, 255, 255, .06);
}

.plan-course-name {
    font-size: 13.5px;
    font-weight: 700;
}

.plan-course-meta {
    font-family: 'DM Mono', monospace;
    font-size: 10.5px;
    color: var(--muted);
}

.plan-course-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--vc);
    background: rgba(118, 75, 162, .14);
    margin-top: 4px;
}

.plan-course-selected-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.plan-course-selected .plan-clabel {
    font-size: 14.5px;
}

@keyframes planShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

.plan-dz-icon {
    font-size: 32px;
}

.plan-dz-title {
    font-size: 14px;
    font-weight: 700;
}

.plan-dz-sub {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--muted);
}

.plan-dz-formats {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.plan-dz-fmt {
    font-family: 'DM Mono', monospace;
    font-size: 9.5px;
    padding: 2px 9px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .1);
    color: var(--muted);
}

/* ── Spacer / nav ── */
.plan-spacer {
    flex: 1;
}

.plan-navrow {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.plan-btn {
    flex: 1;
    padding: 13px;
    border-radius: 99px;
    border: none;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: opacity .15s;
}

.plan-btn:hover {
    opacity: .88;
}

.plan-btn--prev {
    background: rgba(255, 255, 255, .07);
    color: rgba(255, 255, 255, .65);
    max-width: 100px;
}

.plan-btn--hidden {
    display: none;
}

.plan-btn--next {
    background: var(--g);
    color: #fff;
}

/* ── Responsive ── */
@media (max-width: 420px) {
    .plan-page {
        padding: 1.5rem .75rem 3rem;
    }

    .plan-card {
        padding: 1.4rem 1.1rem 1.6rem;
        min-height: 0;
    }

    .plan-title {
        font-size: 1.6rem;
    }
}
