/* ==========================================================================
   trainmix.nl design system
   Brand: indigo #4338CA (het plan) + oranje #F97316 (de inspanning).
   Elke sport heeft zijn eigen kleur, zodat een week in één oogopslag leesbaar is.
   ========================================================================== */

:root {
  --brand: #4338CA;
  --brand-600: #3730A3;
  --brand-700: #312E81;
  --brand-soft: #EEF0FF;
  --accent: #F97316;
  --accent-600: #EA580C;
  --accent-soft: #FFF1E6;

  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-2: #F9FAFC;
  --text: #16202E;
  --muted: #64748B;
  --border: #E5E9F0;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .18);
  --shadow-lg: 0 20px 40px -16px rgba(16, 24, 40, .26);

  /* Sportkleuren: gelijk aan de kolom `colour` in de sports-tabel. */
  --blue: #2F6FED;   --blue-soft: #E8EFFD;
  --indigo: #4338CA; --indigo-soft: #EEF0FF;
  --teal: #0D9488;   --teal-soft: #DCF5F2;
  --orange: #F97316; --orange-soft: #FFF1E6;
  --pink: #DB2777;   --pink-soft: #FCE8F1;
  --green: #16A34A;  --green-soft: #DFF5E7;
  --red: #DC2626;    --red-soft: #FDE7E7;
  --yellow: #D97706; --yellow-soft: #FEF3DC;
  --gray: #64748B;   --gray-soft: #EEF1F6;

  /* Grafiekreeksen. Gevalideerd op kleurenblindheid en contrast tegen het
     vlak waarop ze staan; de donkere modus heeft eigen stappen, geen omkering. */
  --chart-fitness: #4338CA;
  --chart-fatigue: #F97316;
  --chart-load: #CBD3E1;
  --chart-grid: #E9EDF3;

  /* Intensiteit: de belangrijkste visuele taal van de app. */
  --i-easy: var(--green);      --i-easy-soft: var(--green-soft);
  --i-moderate: var(--yellow); --i-moderate-soft: var(--yellow-soft);
  --i-hard: var(--orange);     --i-hard-soft: var(--orange-soft);
  --i-race: var(--red);        --i-race-soft: var(--red-soft);
  --i-busy: var(--gray);       --i-busy-soft: var(--gray-soft);

  --radius: 16px;
  --radius-sm: 12px;
  --sidebar-w: 256px;

  --bs-primary: var(--brand);
  --bs-primary-rgb: 67, 56, 202;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-link-color: var(--brand);
  --bs-link-hover-color: var(--brand-700);
  --bs-font-sans-serif: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-bs-theme="dark"] {
  --bg: #0E1420;
  --surface: #161D2B;
  --surface-2: #1C2434;
  --text: #E6EDF6;
  --muted: #94A3B8;
  --border: #253046;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .55);
  --shadow-lg: 0 20px 40px -16px rgba(0, 0, 0, .65);
  --brand-soft: #23214A;
  --accent-soft: #3A2415;
  --blue-soft: #1A2A4A; --indigo-soft: #23214A; --teal-soft: #0F3330; --orange-soft: #3A2415;
  --pink-soft: #3B1A2A; --green-soft: #113325; --red-soft: #3A1A1A; --yellow-soft: #37280F; --gray-soft: #212B3C;
  --chart-fitness: #6366F1;
  --chart-fatigue: #E2670A;
  --chart-load: #33415A;
  --chart-grid: #222C40;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-link-color: #A5B4FC;
  --bs-link-hover-color: #C7D2FE;
}

html { font-size: 15.5px; }
body { font-family: var(--bs-font-sans-serif); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, .fw-bold { font-weight: 700; letter-spacing: -.015em; }
h3 { font-size: 1.15rem; margin: 0; }
a { text-decoration: none; }
.text-muted { color: var(--muted) !important; }
.min-w-0 { min-width: 0; }
.link-plain { color: inherit; }
.link-plain:hover { color: var(--brand); }
[data-bs-theme="dark"] .link-plain:hover { color: #fff; }

/* ---- Bootstrap overrides ------------------------------------------------ */
.btn { border-radius: 999px; font-weight: 600; padding: .5rem 1.1rem; transition: transform .12s ease, box-shadow .12s ease, background .12s; }
.btn:active { transform: translateY(1px); }
.btn-lg { padding: .7rem 1.5rem; font-size: 1.05rem; }
.btn-sm { padding: .3rem .8rem; font-size: .85rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-600); border-color: var(--brand-600); box-shadow: 0 8px 20px -8px rgba(67, 56, 202, .6); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover, .btn-accent:focus { background: var(--accent-600); border-color: var(--accent-600); color: #fff; box-shadow: 0 8px 20px -8px rgba(249, 115, 22, .65); }
.btn-outline-secondary { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-outline-secondary:hover, .btn-outline-secondary.active { background: var(--gray-soft); border-color: var(--border); color: var(--text); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
[data-bs-theme="dark"] .btn-outline-primary { color: #A5B4FC; border-color: #A5B4FC; }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-success { background: var(--green); border-color: var(--green); }
.btn-outline-danger { color: var(--red); border-color: var(--red); }

.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--border); background: var(--surface); color: var(--text); padding: .6rem .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(67, 56, 202, .12); background: var(--surface); color: var(--text); }
.form-label { font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.form-text { color: var(--muted); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-switch .form-check-input { width: 2.6em; height: 1.4em; }

.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card-hover { transition: transform .15s ease, box-shadow .15s ease; color: inherit; display: block; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: inherit; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }

.alert { border-radius: var(--radius-sm); border: 0; font-weight: 500; }
.alert-success { background: var(--green-soft); color: #14663F; }
.alert-danger { background: var(--red-soft); color: #A32424; }
.alert-warning { background: var(--yellow-soft); color: #8A5A00; }
.alert-info { background: var(--blue-soft); color: #1F4FB8; }
[data-bs-theme="dark"] .alert-success { color: #7EE2B0; } [data-bs-theme="dark"] .alert-danger { color: #FF9EA1; }
[data-bs-theme="dark"] .alert-warning { color: #FFD27A; } [data-bs-theme="dark"] .alert-info { color: #9DBBFF; }

.dropdown-menu { border-radius: var(--radius-sm); border-color: var(--border); background: var(--surface); padding: .4rem; }
.dropdown-item { border-radius: 8px; padding: .5rem .8rem; color: var(--text); font-weight: 500; }
.dropdown-item:hover { background: var(--gray-soft); color: var(--text); }
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.table td, .table th { padding: .7rem .9rem; }
.bg-body-tertiary { background: var(--surface-2) !important; }
.modal-content { background: var(--surface); border-radius: var(--radius); border-color: var(--border); }

/* ---- Chips ---------------------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--brand); color: #fff; line-height: 1.5; }
.chip-soft { background: var(--gray-soft); color: var(--muted); }
.chip-easy { background: var(--i-easy-soft); color: var(--i-easy); }
.chip-moderate { background: var(--i-moderate-soft); color: var(--i-moderate); }
.chip-hard { background: var(--i-hard-soft); color: var(--i-hard); }
.chip-race { background: var(--i-race-soft); color: var(--i-race); }
.chip-busy { background: var(--i-busy-soft); color: var(--i-busy); }
.chip-blue { background: var(--blue-soft); color: var(--blue); }
.chip-indigo { background: var(--indigo-soft); color: var(--indigo); }
.chip-teal { background: var(--teal-soft); color: var(--teal); }
.chip-orange { background: var(--orange-soft); color: var(--orange); }
.chip-pink { background: var(--pink-soft); color: var(--pink); }
.chip-green { background: var(--green-soft); color: var(--green); }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-yellow { background: var(--yellow-soft); color: var(--yellow); }
.chip-gray { background: var(--gray-soft); color: var(--gray); }

/* ---- App shell ------------------------------------------------------------ */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: .3rem;
  padding: 1rem .75rem; z-index: 1040; transition: transform .22s ease;
}
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(10, 16, 28, .45); z-index: 1035; display: none; }
.sidebar-backdrop.show { display: block; }
.main { margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }

.brand { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem 1rem; color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%); font-size: 1.05rem;
}
.brand-text { font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; }
.brand-text .dot { color: var(--muted); font-weight: 600; }

.side-nav { display: flex; flex-direction: column; gap: .15rem; }
.side-link {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: .95rem; border: 0; background: none; width: 100%; text-align: left;
}
.side-link i { font-size: 1.05rem; width: 1.2rem; }
.side-link:hover { background: var(--gray-soft); color: var(--text); }
.side-link.active { background: var(--brand-soft); color: var(--brand); }
[data-bs-theme="dark"] .side-link.active { color: #A5B4FC; }
.side-cta {
  margin-top: .6rem; display: flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600;
}
.side-cta:hover { background: var(--accent-600); color: #fff; }
.side-footer {
  margin-top: auto; display: flex; align-items: center; gap: .6rem; padding: .6rem;
  border-radius: 12px; border: 1px solid var(--border); color: var(--text);
}
.side-footer:hover { background: var(--gray-soft); color: var(--text); }
.side-footer-icon { margin-left: auto; color: var(--muted); }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .6rem;
  padding: .7rem 1.1rem; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.page-title { font-size: 1.15rem; margin: 0; font-weight: 700; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.btn-icon {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); display: grid; place-items: center; font-size: 1.05rem;
}
.btn-icon:hover { background: var(--gray-soft); color: var(--text); }
.badge-dot {
  position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; border-radius: 999px;
  font-size: .65rem; font-weight: 700; padding: 0 .3rem; min-width: 16px; text-align: center;
}
.avatar {
  width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; font-weight: 700;
  background: var(--brand-soft); color: var(--brand); font-size: .85rem; border: 0;
}
[data-bs-theme="dark"] .avatar { color: #A5B4FC; }
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }
.content { padding: 1.1rem; flex: 1; max-width: 1180px; width: 100%; }
.app-footer { padding: 1.4rem 1.1rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .content { padding: .9rem; }
}

/* ---- Session and event cards --------------------------------------------- */
.tm-item {
  display: flex; gap: .75rem; padding: .7rem .8rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: inherit; align-items: flex-start;
  border-left-width: 4px;
}
.tm-item:hover { background: var(--surface-2); color: inherit; }
.tm-item.i-easy { border-left-color: var(--i-easy); }
.tm-item.i-moderate { border-left-color: var(--i-moderate); }
.tm-item.i-hard { border-left-color: var(--i-hard); }
.tm-item.i-race { border-left-color: var(--i-race); }
.tm-item.i-busy { border-left-color: var(--i-busy); }
.tm-item.is-done { opacity: .62; }
.tm-item.is-skipped { opacity: .45; text-decoration-line: line-through; text-decoration-color: var(--muted); }
.tm-item.is-fixed { background: var(--surface-2); border-style: dashed; }
.tm-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 1rem; }
.tm-time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .85rem; color: var(--muted); }
.tm-title { font-weight: 600; line-height: 1.3; }
.tm-why { font-size: .84rem; color: var(--muted); line-height: 1.45; margin-top: .25rem; }

/* ---- Week grid ------------------------------------------------------------ */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .6rem; }
.week-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem; min-height: 130px; display: flex; flex-direction: column; gap: .45rem; }
.week-day.today { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(67, 56, 202, .12); }
.week-day.rest { background: var(--surface-2); }
.week-day-head { display: flex; align-items: baseline; justify-content: space-between; gap: .3rem; }
.week-day-name { font-weight: 700; font-size: .85rem; text-transform: capitalize; }
.week-day-date { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.week-mini {
  display: block; padding: .4rem .5rem; border-radius: 9px; font-size: .8rem; line-height: 1.3;
  border-left: 3px solid var(--i-busy); background: var(--surface-2); color: inherit;
}
.week-mini:hover { background: var(--gray-soft); color: inherit; }
.week-mini.i-easy { border-left-color: var(--i-easy); background: var(--i-easy-soft); }
.week-mini.i-moderate { border-left-color: var(--i-moderate); background: var(--i-moderate-soft); }
.week-mini.i-hard { border-left-color: var(--i-hard); background: var(--i-hard-soft); }
.week-mini.i-race { border-left-color: var(--i-race); background: var(--i-race-soft); }
.week-mini.is-fixed { border-style: dashed; border-left-style: solid; }
.week-mini.is-done { opacity: .6; }
.week-mini-time { font-variant-numeric: tabular-nums; font-weight: 600; opacity: .8; }
.rest-note { color: var(--muted); font-size: .8rem; margin: auto 0; text-align: center; }

@media (max-width: 991.98px) {
  .week-grid { grid-template-columns: 1fr; }
  .week-day { min-height: 0; }
}

/* ---- Stats ---------------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .7rem; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .8rem .9rem; display: flex; flex-direction: column; gap: .15rem;
}
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .8rem; color: var(--muted); }
.stat-note { font-size: .78rem; color: var(--muted); }

.progress-track { height: 8px; border-radius: 999px; background: var(--gray-soft); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .4s cubic-bezier(.2, .8, .2, 1); }

/* The form verdict banner: the app's opinion, stated plainly. */
.verdict { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.verdict-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.verdict-green { background: var(--green-soft); color: var(--green); }
.verdict-teal { background: var(--teal-soft); color: var(--teal); }
.verdict-orange { background: var(--orange-soft); color: var(--orange); }
.verdict-red { background: var(--red-soft); color: var(--red); }
.verdict-blue { background: var(--blue-soft); color: var(--blue); }
.verdict-gray { background: var(--gray-soft); color: var(--gray); }

/* ---- Session detail ------------------------------------------------------- */
.block-list { display: flex; flex-direction: column; gap: .5rem; }
.tm-block { display: flex; gap: .8rem; padding: .75rem .9rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.tm-block-min { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand); min-width: 3.4rem; }
[data-bs-theme="dark"] .tm-block-min { color: #A5B4FC; }
.tm-block-label { font-weight: 600; }
.tm-block-detail { color: var(--muted); font-size: .9rem; line-height: 1.5; }

.pace-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.pace { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .7rem; background: var(--surface); }
.pace-name { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.pace-value { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.1rem; }

/* ---- Charts (inline SVG, no library) -------------------------------------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .85rem; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.chart-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---- Landing -------------------------------------------------------------- */
.landing-hero { padding: 4rem 1rem 3rem; text-align: center; }
.landing-hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.08; margin-bottom: 1rem; }
.landing-hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 40rem; margin: 0 auto 1.8rem; }
.landing-nav { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; max-width: 1100px; margin: 0 auto; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; height: 100%; }
.feature-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; margin-bottom: .7rem; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; }
.auth-card { width: 100%; max-width: 30rem; }
.auth-wide { max-width: 44rem; }

.step-dots { display: flex; gap: .35rem; justify-content: center; margin-bottom: 1.2rem; }
.step-dot { width: 34px; height: 5px; border-radius: 999px; background: var(--border); }
.step-dot.done { background: var(--brand); }

/* Choice tiles used in the intake and on the sports page. */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.tile { position: relative; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile label {
  display: flex; flex-direction: column; gap: .25rem; padding: .8rem; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: var(--surface); cursor: pointer; height: 100%;
}
.tile input:checked + label { border-color: var(--brand); background: var(--brand-soft); }
.tile input:focus-visible + label { box-shadow: 0 0 0 4px rgba(67, 56, 202, .18); }
.tile-icon { font-size: 1.3rem; }
.tile-name { font-weight: 600; }
.tile-note { font-size: .8rem; color: var(--muted); }

.empty { text-align: center; padding: 2.4rem 1rem; color: var(--muted); }
.empty i { font-size: 2rem; display: block; margin-bottom: .6rem; opacity: .5; }

@media print {
  .sidebar, .topbar, .app-footer, .btn { display: none !important; }
  .main { margin-left: 0; }
}
