/* Même typo que le site public (Website/static/css/style.css) - identité
   de marque commune plutôt que la police générique utilisée ici avant.
   Barlow Condensed pour les titres, IBM Plex Sans pour le corps. */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;600&display=swap');

/* ─── Reset global ───────────────────────────────────────────── */
html, body {
    margin: 0;
    padding: 0;
    background-color: #0d1117;
}

h1, h2, h3 {
    font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
    font-weight: 700;
}

/* ─── Grille principale ──────────────────────────────────────── */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 42%;
  height: calc(100vh - 115px);
  overflow: hidden;
}

/* Col gauche : graphiques */
.col-graphs {
  padding: 12px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Col droite : carte + splits */
.col-right {
  display: flex;
  flex-direction: column;
  border-left: 1px solid #30363d;
  overflow: hidden;
}

/* Section carte (hauteur réduite) */
.map-section {
  height: 42%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #30363d;
}

.map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px 6px;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
}

.map-iframe {
  flex: 1;
  border: none;
  width: 100%;
  min-height: 0;
}

/* Section splits (prend le reste) */
.splits-section {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  background-color: #161b22;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.splits-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

/* Hauteur du graphe principal */
.graph-main {
  height: calc(100vh - 210px);
  min-height: 350px;
  touch-action: none;
}

/* ─── Toolbar responsive ─────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 12px;
  padding: 10px 20px;
  align-items: flex-end;
  flex-wrap: wrap;
  background-color: #161b22;
  border-bottom: 1px solid #30363d;
}

.toolbar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ─── Tablette paysage (768px – 1023px) ─────────────────────── */
@media (max-width: 1023px) {
  .main-grid {
    grid-template-columns: 55% 1fr;
    height: calc(100vh - 130px);
  }

  .map-section {
    height: 38%;
  }

  .graph-main {
    height: calc(100vh - 230px);
    min-height: 300px;
  }
}

/* ─── Tablette portrait + smartphone (< 768px) ──────────────── */
@media (max-width: 767px) {
  .main-grid {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .col-graphs {
    padding: 8px 10px;
  }

  .col-right {
    border-left: none;
    border-top: 1px solid #30363d;
    height: auto;
    overflow: visible;
  }

  .map-section {
    height: 240px;
    flex-shrink: 0;
  }

  .splits-section {
    max-height: 300px;
    overflow-y: auto;
  }

  .graph-main {
    height: 52vw;
    min-height: 260px;
  }

  .toolbar {
    padding: 8px 10px;
    gap: 8px;
  }
}

/* ─── Petit smartphone (< 480px) ────────────────────────────── */
@media (max-width: 479px) {
  .map-section {
    height: 200px;
  }

  .graph-main {
    height: 60vw;
    min-height: 220px;
  }
}

/* ── Classes communes responsive (pages internes) ────────────────────────── */

/* Header de page générique */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 24px;
    min-height: 52px;
}
.page-header-title {
    flex: 1;
    text-align: center;
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Conteneur centré avec padding */
.page-content-wrap {
    padding: 20px;
}

/* Tableau scrollable horizontalement sur mobile */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
    .page-header         { padding: 8px 14px; }
    .page-header-back    { display: none !important; }   /* géré par mobile-back-btn */
    .page-header-title   { font-size: 15px !important; }
    .page-content-wrap   { padding: 12px 10px; }

    /* Colonnes secondaires cachées dans le tableau setup */
    .setup-col-hide { display: none; }
}

/* ── Mon Programme — responsive ──────────────────────────────────────────── */

.training-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 20px;
    min-height: 52px;
}

/* Grille semaine : 7 colonnes sur desktop */
.training-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

/* Tablette paysage ≤ 900px → 4 colonnes, jours vides cachés */
@media (max-width: 900px) {
    .training-header { padding: 8px 16px; }
    .training-content { padding: 14px 14px !important; }
    .training-week-grid { grid-template-columns: repeat(4, 1fr); }
    .training-day-empty { display: none; }
}

/* Tablette portrait ≤ 640px → 2 colonnes */
@media (max-width: 640px) {
    .training-week-grid { grid-template-columns: repeat(2, 1fr); }
    .training-btn-label { display: none; }   /* icône seule sur les boutons */
}

/* Mobile ≤ 440px → 1 colonne, blocs plus grands (touch-friendly) */
@media (max-width: 440px) {
    .training-header { padding: 6px 10px; gap: 6px; }
    .training-content { padding: 10px 10px !important; }
    .training-week-grid { grid-template-columns: 1fr; }
    .training-day-card { padding: 12px 14px !important; }
    .training-modal-box { padding: 16px 14px !important; border-radius: 12px !important; }
    .training-header-title { font-size: 14px !important; }
}

/* ── Burger menu — mobile only ────────────────────────────────────────────── */

/* Barre mobile fixe : cachée sur desktop, visible sur mobile */
.mobile-top-bar { display: none; }

@media (max-width: 768px) {
    .mobile-top-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 52px;
        z-index: 1100;
        background: #161b22;
        border-bottom: 1px solid #30363d;
        padding: 0 8px;
    }
    /* Les pages poussent leur contenu sous la barre */
    body { padding-top: 52px; }

    /* Boutons retour et éléments à masquer sur mobile */
    .mobile-back-btn { display: none !important; }
    .mobile-hide     { display: none !important; }
}

/* ☰ toujours ancré à gauche (positionnement absolu, indépendant de tout
   ordre flex/DOM) - cf. demande du 2026-07-07. */
.mobile-burger-btn {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
}

/* ── Bulle de conversation — bas-droite sur PC (comportement d'origine).
   Uniquement sur mobile : ancrée en haut-droite, à droite du logo, dans la
   barre ☰ fixe (cf. demande du 2026-07-07). ─────────────────────────────── */
.chat-fab-container {
    position: fixed;
    bottom: 24px; right: 24px;
}
.chat-panel-pos {
    position: fixed;
    bottom: 86px; right: 24px; /* au-dessus du bouton (24 + 52 + 10) */
}
@media (max-width: 768px) {
    /* Tout en haut à droite, dans la barre ☰ (52px) : de gauche à droite,
       ☰ - logo - bulle. Bouton réduit pour tenir dans la barre. */
    .chat-fab-container { bottom: auto; top: 9px; right: 8px; }
    .chat-panel-pos      { bottom: auto; top: 58px; right: 8px; }
    .chat-fab-btn  { width: 34px !important; height: 34px !important; }
    .chat-fab-icon { font-size: 16px !important; }
}

/* Overlay plein écran */
#burger-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;      /* flex quand visible, none quand fermé */
    align-items: stretch;
}

/* Backdrop semi-transparent (cliquable pour fermer) */
.burger-backdrop {
    flex: 1;
    background: rgba(0, 0, 0, 0.55);
    cursor: pointer;
}

/* Drawer depuis la gauche */
.burger-drawer {
    width: 280px;
    max-width: 85vw;
    background: #161b22;
    border-right: 1px solid #30363d;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    animation: burgerSlideIn 0.22s ease-out;
    font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif;
}

@keyframes burgerSlideIn {
    from { transform: translateX(-100%); opacity: 0.6; }
    to   { transform: translateX(0);    opacity: 1;   }
}

/* En-tête du drawer */
.burger-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #30363d;
    flex-shrink: 0;
}

/* Zone nav */
.burger-nav {
    flex: 1;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
}

/* Item de nav */
.burger-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    transition: background 0.12s;
}

.burger-nav-item:hover {
    background: rgba(88, 166, 255, 0.08);
}

.burger-nav-icon  { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.burger-nav-label { font-size: 14px; font-weight: 500; color: #e6edf3; }

/* Pied */
.burger-drawer-footer {
    padding: 14px 16px;
    border-top: 1px solid #30363d;
    flex-shrink: 0;
}

/* ── Menu responsive ──────────────────────────────────────────────────────── */
.menu-header {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 24px; flex-wrap: wrap;
    background: #161b22; border-bottom: 1px solid #30363d;
}
.menu-header-brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.menu-header-title { margin: 0; font-size: 19px; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #e6edf3; }
.menu-header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.menu-header-user  { font-size: 12px; color: #8b949e; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; max-width: 180px; }

.menu-section      { padding: 14px 24px 0; }
.menu-title-block  { padding: 20px 24px 0; }
.menu-title-block h2 { font-size: 17px; font-weight: 600; margin: 0 0 4px; color: #e6edf3; }
.menu-title-sub    { font-size: 12px; color: #8b949e; }

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 14px;
    padding: 16px 24px 48px;
}

.menu-card { border-radius: 12px; }
.menu-card-inner {
    display: flex; flex-direction: column;
    padding: 20px 18px; height: 100%; box-sizing: border-box;
}
.menu-card-icon  { font-size: 30px; margin-bottom: 12px; line-height: 1; }
.menu-card-label { font-weight: 700; font-size: 14px; margin-bottom: 6px; color: #e6edf3; }
.menu-card-desc  { font-size: 11px; color: #8b949e; line-height: 1.45; flex: 1; }
.menu-card-soon  { font-size: 10px; color: #f78166; margin-top: 10px; font-weight: 600; }
.menu-card:hover { border-color: #58a6ff !important; }

/* ── Tablette <= 700px : 2 colonnes */
@media (max-width: 700px) {
    .menu-header       { padding: 10px 16px; }
    .menu-header-user  { max-width: 120px; }
    .menu-section      { padding: 12px 14px 0; }
    .menu-title-block  { padding: 16px 14px 0; }
    .menu-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 12px 14px 40px;
    }
    .menu-card-inner { padding: 16px 14px; }
    .menu-card-icon  { font-size: 26px; margin-bottom: 10px; }
    .menu-card-label { font-size: 13px; }
}

/* ── Mobile <= 440px : liste verticale, icone + texte cote a cote */
@media (max-width: 440px) {
    .menu-header-title { font-size: 16px; }
    .menu-header-user  { display: none; }
    .menu-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px 12px 36px;
    }
    .menu-card-inner {
        flex-direction: row; align-items: center;
        gap: 14px; padding: 14px;
    }
    .menu-card-icon  { font-size: 28px; margin-bottom: 0; flex-shrink: 0; }
    .menu-card-desc  { display: none; }
    .menu-card-label { font-size: 14px; margin-bottom: 0; }
    .menu-section     { padding: 10px 12px 0; }
    .menu-title-block { padding: 14px 12px 0; }
}

/* ── Coach : programmes d'entraînement — responsive ──────────────────────── */

.coach-training-grid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 16px;
    align-items: start;
}

.coach-pilot-sidebar {
    position: sticky;
    top: 20px;
}

/* La grille calendrier a besoin d'une largeur minimale pour défiler proprement */
.coach-calendar-inner {
    min-width: 640px;
}

@media (max-width: 900px) {
    .coach-training-grid {
        grid-template-columns: 1fr;
        padding: 14px;
        gap: 12px;
    }
    .coach-pilot-sidebar {
        position: static;
    }
}

@media (max-width: 640px) {
    .coach-training-grid { padding: 10px; }
}

/* ── Mes pistes (my_tracks.py / settings.py:_tab_tracks) ────────────────── */
.track-detail-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 16px;
}
.track-detail-left {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 520px;
}
.track-detail-right {
    position: relative;
    height: 520px;
}

@media (max-width: 700px) {
    .track-detail-grid {
        grid-template-columns: 1fr;
    }
    /* Carte en premier sur mobile : c'est là qu'on clique pour placer un
       point, elle doit rester visible/accessible sans avoir à scroller
       passé toute la liste des points déjà placés. */
    .track-detail-right {
        order: 1;
        height: 58vh;
        min-height: 420px;
    }
    .track-detail-left {
        order: 2;
        max-height: none;
    }
}

/* ─── DatePicker (react-dates, ex. Date de naissance dans Paramètres) ────
   Thème sombre cohérent avec le reste de l'appli - dcc.DatePickerSingle/
   DatePickerRange rendent en clair par défaut, ces overrides s'appliquent
   partout où le composant est utilisé (pas seulement le champ naissance),
   même sélecteurs CSS génériques de react-dates dans toute l'appli. */
.SingleDatePicker, .DateRangePicker {
    width: 100%;
    display: block;
}
.SingleDatePickerInput, .DateRangePickerInput {
    background-color: transparent !important;
    border: none !important;
    display: flex !important;
    width: 100%;
}
.DateInput {
    background-color: transparent !important;
    width: 100% !important;
}
.DateInput_input {
    background-color: #0d1117 !important;
    color: #e6edf3 !important;
    border: 1px solid #30363d !important;
    border-radius: 6px !important;
    font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    padding: 9px 11px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    line-height: 1.3 !important;
}
.DateInput_input__focused {
    border-color: #58a6ff !important;
    background-color: #0d1117 !important;
}
.DateInput_input::placeholder {
    color: #8b949e !important;
}
.SingleDatePickerInput_calendarIcon {
    filter: invert(0.7);
    margin: 0 8px !important;
}
.SingleDatePickerInput_clearDate {
    background-color: transparent !important;
}
.SingleDatePickerInput_clearDate svg {
    fill: #8b949e !important;
}
.DateInput_fangShape { fill: #161b22 !important; }
.DateInput_fangStroke { stroke: #30363d !important; fill: transparent !important; }
.DayPicker, .DayPicker_transitionContainer, .CalendarMonth, .CalendarMonthGrid,
.DayPicker__withBorder {
    background-color: #161b22 !important;
    border-color: #30363d !important;
}
.CalendarMonth_caption { color: #e6edf3 !important; }
.DayPicker_weekHeader { color: #8b949e !important; }
.CalendarDay__default {
    background-color: #161b22 !important;
    border: 1px solid #30363d !important;
    color: #e6edf3 !important;
}
.CalendarDay__default:hover {
    background-color: #21262d !important;
    color: #e6edf3 !important;
}
.CalendarDay__blocked_out_of_range, .CalendarDay__blocked_out_of_range:hover {
    background-color: #0d1117 !important;
    color: #484f58 !important;
}
.CalendarDay__selected, .CalendarDay__selected:hover,
.CalendarDay__selected_span, .CalendarDay__hovered_span {
    background-color: #58a6ff !important;
    border-color: #58a6ff !important;
    color: #04141f !important;
}
.DayPickerNavigation_button__default {
    border: 1px solid #30363d !important;
    background-color: #0d1117 !important;
}
.DayPickerNavigation_svg__horizontal { fill: #e6edf3 !important; }
.CalendarMonth_table { border-collapse: separate !important; }

/* Le popup se recadre pour ne pas déborder d'un écran étroit (mobile). */
@media (max-width: 480px) {
    .DayPicker_transitionContainer, .DayPicker {
        width: 100% !important;
        max-width: 92vw !important;
    }
    .CalendarMonth, .CalendarMonthGrid {
        width: 100% !important;
    }
}
