:root {
    --bg-main: #0d1b2a;
    --bg-card: #1b263b;
    --border-color: #415a77;
    --text-primary: #e0e1dd;
    --accent-color: #4cc9f0;
    --btn-color: #4361ee;
    --btn-hover: #3a0ca3;
    --error-color: #f72585;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- BASE GLOBALE (Aussi pour la page d'accueil) --- */
html, body {
    min-height: 100vh;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, sans-serif;
    height: -webkit-fill-available;
}

/* --- SPÉCIFIQUE AU DASHBOARD UNIQUEMENT --- */
body.dashboard-body {
    height: 100vh;
    height: 100dvh; /* Adapte la hauteur dynamiquement sur mobile */
    overflow: hidden;
}

/* --- CONTENEUR D'ACCUEIL / CONNEXION / INSCRIPTION --- */
.auth-container, .home-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.auth-card, .home-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* --- BANDEAU SUPÉRIEUR DASHBOARD --- */
.top-header {
    width: 100%;
    height: 60px;
    background-color: var(--bg-card);
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-burger {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
}

.logo {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--accent-color);
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn-logout {
    color: var(--error-color);
    text-decoration: none;
    font-size: 0.9rem;
}

/* --- LAYOUT PLEIN ÉCRAN DASHBOARD --- */
.dashboard-layout {
    display: flex;
    width: 100vw;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    overflow: hidden;
}

/* SIDEBAR GAUCHE */
.sidebar {
    width: 25%;
    min-width: 260px;
    background-color: #14213d;
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    transition: margin-left 0.3s ease, opacity 0.3s ease;
}

.dashboard-layout.sidebar-collapsed .sidebar {
    margin-left: -25%;
    opacity: 0;
    pointer-events: none;
}

.btn-create-sidebar {
    display: block;
    width: 100%;
    text-align: center;
    background-color: var(--btn-color);
    color: #fff;
    padding: 0.85rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    margin-bottom: 1.5rem;
    transition: background 0.2s;
}

.btn-create-sidebar:hover {
    background-color: var(--btn-hover);
}

.sidebar h2 {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-list {
    list-style: none;
}

.plan-list li {
    margin-bottom: 0.5rem;
}

.plan-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background-color: var(--bg-main);
    border-radius: 6px;
    color: var(--text-primary);
    text-decoration: none;
    border: 1px solid transparent;
}

.plan-list li.active a, .plan-list a:hover {
    border-color: var(--accent-color);
    background-color: var(--bg-card);
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.ravito-auto {
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-triathlon {
    background-color: rgba(76, 201, 240, 0.15);
    color: #4cc9f0;
    border: 1px solid rgba(76, 201, 240, 0.3);
}

.badge-course_a_pied {
    background-color: rgba(247, 37, 133, 0.15);
    color: #f72585;
    border: 1px solid rgba(247, 37, 133, 0.3);
}

.badge-cyclisme {
    background-color: rgba(67, 97, 238, 0.15);
    color: #4361ee;
    border: 1px solid rgba(67, 97, 238, 0.3);
}

.badge-trail {
    background-color: rgba(255, 183, 3, 0.15);
    color: #ffb703;
    border: 1px solid rgba(255, 183, 3, 0.3);
}

/* ZONE PRINCIPALE DE CONTENU */
.main-content {
flex: 1;
    height: 100%;
    padding: 1.5rem;
    background-color: var(--bg-main);
    overflow-y: auto; /* Le défilement se fait ici */
}

.form-container {
    width: 100%;
    min-height: 100%; /* S'adapte au contenu et s'étire si nécessaire */
    background-color: var(--bg-card);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.full-form {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    gap: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.half-width {
    flex: 1;
}

.flex-grow {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.flex-grow textarea {
    flex: 1;
    min-height: 200px;
    resize: none;
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

input[type="text"],
input[type="date"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-main);
    color: #fff;
    font-size: 1rem;
}

.btn-submit {
    padding: 1rem;
    background-color: var(--btn-color);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover {
    background-color: var(--btn-hover);
}

.success-msg {
    color: #4cc9f0;
    background-color: rgba(76, 201, 240, 0.1);
    border: 1px solid #4cc9f0;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.error-msg {
    color: var(--error-color);
    background-color: rgba(247, 37, 133, 0.1);
    border: 1px solid var(--error-color);
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* --- BOUTON UPLOAD GPX SUR-MESURE --- */
.file-input-hidden {
    display: none;
}

.file-upload-wrapper {
    width: 100%;
}

.btn-file-custom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.85rem 1.2rem;
    background-color: var(--bg-main);
    border: 1px dashed var(--accent-color);
    border-radius: 6px;
    color: var(--accent-color);
    font-weight: 500;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.btn-file-custom:hover {
    background-color: rgba(76, 201, 240, 0.1);
    border-style: solid;
}

.file-icon {
    font-size: 1.1rem;
}

/* --- COMPOSANTS GRAPHIQUE GPX --- */
.gpx-container {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.gpx-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.gpx-stats strong {
    color: var(--accent-color);
}

.chart-wrapper {
    position: relative;
    height: 250px;
    width: 100%;
}

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        z-index: 100;
        width: 80%;
        height: calc(100vh - 60px);
        margin-left: -80%;
    }

    .dashboard-layout.sidebar-collapsed .sidebar {
        margin-left: 0;
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        width: 100%;
    }

    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
}

/* --- PAGE DE CONNEXION / LOGIN --- */
body:not(.dashboard-body) {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px; /* Force la carte à ne pas dépasser 420px */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.login-card h1 {
    color: var(--accent-color);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

.login-card form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.register-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.register-link a {
    color: var(--accent-color);
    text-decoration: none;
}

.register-link a:hover {
    text-decoration: underline;
}

/* --- BOUTON ET MODALE PRÉFÉRENCES --- */
.btn-pref {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.2s;
}

.btn-pref:hover {
    opacity: 0.8;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(13, 27, 42, 0.75);
    backdrop-filter: blur(5px); /* Flou d'arrière-plan */
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.modal-header h3 {
    color: var(--accent-color);
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

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

/* --- HABILLAGE DES CHAMPS DU FORMULAIRE --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.2rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary, #a0aec0);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Style uniforme pour input, select et placeholder */
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-input, #1b263b);
    border: 1px solid var(--border-color, #2a3d52);
    border-radius: 8px;
    color: var(--text-primary, #ffffff);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

/* Effet au survol et au focus (clic) */
.form-group input[type="number"]:focus,
.form-group select:focus {
    border-color: var(--accent-color, #4cc9f0);
    box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.15);
}

/* Style du texte indicatif (placeholder) */
.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Retirer les petites flèches par défaut des champs number (optionnel) */
.form-group input[type="number"]::-webkit-outer-spin-button,
.form-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.form-group input[type="number"] {
    -moz-appearance: textfield;
}

.input-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-suffix input {
    padding-right: 2.5rem; /* Espace pour ne pas chevaucher le texte 'kg' */
}

.input-suffix .suffix {
    position: absolute;
    right: 1rem;
    color: var(--text-secondary, #a0aec0);
    font-size: 0.85rem;
    pointer-events: none;
}

/* --- BLOC DURATION & SPEEDS --- */
.effort-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.2rem;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin: 10px;
}

.effort-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.effort-inputs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.speed-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-main);
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.speed-group input[type="number"] {
    width: 70px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: right;
    outline: none;
}

.speed-group .unit {
    font-size: 0.85rem;
    color: var(--text-primary);
    opacity: 0.8;
}

.time-display {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background-color: rgba(76, 201, 240, 0.1);
    border: 1px solid var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

.time-label {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.time-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-color);
}

.time-input-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background-color: rgba(76, 201, 240, 0.1);
    border: 1px solid var(--accent-color);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
}

.time-fields {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.time-fields input[type="number"] {
    width: 45px;
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
    outline: none;
}

.time-sep {
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.9rem;
}

/* --- BOUTONS INTENSITÉ --- */
.intensity-options {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.btn-intensity {
    flex: 1;
    padding: 0.65rem 0.5rem;
    background-color: var(--bg-main, #0d1b2a);
    border: 1px solid var(--border-color, #2a3d52);
    border-radius: 8px;
    color: var(--text-secondary, #a0aec0);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-intensity:hover {
    border-color: var(--accent-color, #4cc9f0);
    color: var(--text-primary, #ffffff);
}

/* État sélectionné */
.btn-intensity.active {
    background-color: rgba(76, 201, 240, 0.15);
    border-color: var(--accent-color, #4cc9f0);
    color: var(--accent-color, #4cc9f0);
    box-shadow: 0 0 10px rgba(76, 201, 240, 0.2);
}

/* --- WEATHER INDEX --- */
.weather-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.weather-badge {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

/* Couleurs selon la difficulté météo */
.weather-badge.level-1 { background: rgba(46, 196, 182, 0.2); color: #2ec4b6; border: 1px solid #2ec4b6; }
.weather-badge.level-2 { background: rgba(76, 201, 240, 0.2); color: #4cc9f0; border: 1px solid #4cc9f0; }
.weather-badge.level-3 { background: rgba(255, 183, 3, 0.2); color: #ffb703; border: 1px solid #ffb703; }
.weather-badge.level-4 { background: rgba(251, 133, 0, 0.2); color: #fb8500; border: 1px solid #fb8500; }
.weather-badge.level-5 { background: rgba(230, 57, 70, 0.2); color: #e63946; border: 1px solid #e63946; }

/* Conteneur principal du menu Admin */
.dropdown-admin {
    position: relative;
    display: inline-block;
}

/* Le menu volant */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0; /* Ou left: 0 selon le placement sur ton écran */
    margin-top: 6px;
    background: #0d1b2a;
    border: 1px solid #415a77;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 1000; /* Assure que le menu passe au-dessus des autres éléments */
    min-width: 200px;
}

/* Ajustement des boutons dans le menu */
.dropdown-menu .dropdown-item {
    width: 100%;
    text-align: left;
    white-space: nowrap;
    margin: 0;
}

/* Flèche d'indication */
.dropdown-arrow {
    font-size: 0.75rem;
    margin-left: 4px;
    transition: transform 0.2s ease;
}

/* Conteneur principal */
.ravito-list {
    display: flex;
    flex-direction: column; /* Empile les éléments verticalement */
    width: 100%;
}

/* Éléments enfants (badges / ravitaillements) */
.ravito-list > * {
    display: block;         /* Force l'affichage en bloc */
    width: 100%;            /* S'assure qu'ils prennent toute la largeur */
    box-sizing: border-box; /* Évite les dépassements de taille avec padding */
}

/* Style du bouton d'application des ravitos */
.applyrevito{
    margin:10px;
}
/* Conteneur global (si besoin de forcer les couleurs) */
.ravito-config-form, .form-group {
    color: #e2e8f0; /* Texte principal clair */
}

/* Libellés des champs */
.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #f1f5f9 !important; /* Blanc cassé bien lisible */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Affichage des valeurs (ex: 400 g) */
.range-val {
    font-size: 0.9rem;
    color: #94a3b8;
}

.range-val strong {
    color: #38bdf8 !important; /* Bleu clair brillant pour les chiffres */
    font-size: 1rem;
}

/* --- Style des Sliders --- */
.form-range-custom {
    width: 100%;
    height: 6px;
    background: #334155; /* Piste foncée */
    border-radius: 3px;
    outline: none;
    accent-color: #38bdf8; /* Couleur du curseur et du remplissage */
    cursor: pointer;
}

/* --- Style des Radios (Oui / Non) --- */
.radio-group {
    display: flex;
    gap: 20px;
    align-items: center;
    padding-top: 6px;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #cbd5e1 !important; /* Gris très clair */
    cursor: pointer;
}

.radio-label input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #38bdf8; /* Couleur de la puce cochée */
    cursor: pointer;
}

/* Style du conteneur pliable */
.collapsible-section {
    background-color: #1b263b;
    border: 1px solid #415a77;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

/* En-tête cliquable */
.collapsible-header {
    padding: 12px 16px;
    font-weight: bold;
    color: #e0e1dd;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none; /* Masque la flèche par défaut de browser */
    user-select: none;
}

.collapsible-header::-webkit-details-marker {
    display: none; /* Masque la flèche sous Chrome/Safari */
}

.collapsible-header:hover {
    background-color: #2a3a5e;
}

/* Animation de la flèche */
.chevron-icon {
    transition: transform 0.2s ease;
    font-size: 0.8em;
}

details[open] .chevron-icon {
    transform: rotate(180deg);
}

/* Ajustement de padding quand déroulé */
details[open] #gpx-container {
    padding: 15px;
}
/* 1. Conteneur principal */
/* --- CONTENEUR PRINCIPAL --- */
.collapsible-section {
    background-color: #1b263b;
    border: 1px solid #415a77;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

/* --- EN-TÊTE --- */
.collapsible-header {
    padding: 12px 16px;
    font-weight: bold;
    color: #e0e1dd;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    user-select: none;
}

.collapsible-header::-webkit-details-marker {
    display: none;
}

.collapsible-header .chevron-icon {
    transition: transform 0.3s ease;
}

details[open] .chevron-icon {
    transform: rotate(180deg);
}
.collapsible-section {
    background-color: var(--bg-main);
    border: 1px solid #415a77;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.collapsible-header {
    padding: 12px 16px;
    font-weight: bold;
    color: #e0e1dd;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    user-select: none;
}

.collapsible-header::-webkit-details-marker {
    display: none;
}

.collapsible-header .chevron-icon {
    transition: transform 0.3s ease;
}

details[open] .chevron-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    background-color: var(--bg-card);
    padding: 8px 16px 16px 16px;
        border: 1px solid var(--border-color);
    margin: 10px;
    border-radius: 8px;
}

.collapsible-section .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.collapsible-section .half-width {
    flex: 1 1 calc(50% - 8px);
    min-width: 200px;
}

.collapsible-section .form-group {
    margin-bottom: 12px;
}