/* =========================================================
   MODEX Labs — Base / Design tokens
   Konzept: "Bahnen" — Pool-Identität für Schwimmtrainer-Tools
   ========================================================= */

@import url('fonts/fonts.css');

:root{
  /* --- Farben (benannt) --- */
  --deep-end:   #0A1F2B;
  --deep-end-2: #08161E;
  --pool:       #0E6BA8;
  --pool-dim:   #0B5685;
  --lane:       #FFC93C;
  --lane-ink:   #2B1D00;
  --foam:       #F5F7F6;
  --chalk:      #5C7A85;
  --flag:       #E1473B;
  --ok:         #1F9D6B;
  --warn:       #C9821E;

  /* --- Typografie --- */
  --font-display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* --- Radien / Abstände --- */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --gap: 1rem;

  /* --- Light Theme (Standard) --- */
  --bg: var(--foam);
  --bg-alt: #ECF1F1;
  --surface: #FFFFFF;
  --surface-2: #FAFBFB;
  --ink: var(--deep-end);
  --ink-soft: var(--chalk);
  --border: rgba(10, 31, 43, 0.12);
  --border-strong: rgba(10, 31, 43, 0.22);
  --accent: var(--pool);
  --accent-ink: #FFFFFF;
  --shadow: 0 1px 2px rgba(10,31,43,.06), 0 12px 28px -16px rgba(10,31,43,.22);
  --shadow-sm: 0 1px 2px rgba(10,31,43,.08);
}

body[data-theme="dark"]{
  --bg: var(--deep-end-2);
  --bg-alt: #0D2531;
  --surface: #112C39;
  --surface-2: #0E2730;
  --ink: #EAF3F5;
  --ink-soft: #8FAAB3;
  --border: rgba(234, 243, 245, 0.12);
  --border-strong: rgba(234, 243, 245, 0.22);
  --accent: var(--lane);
  --accent-ink: var(--lane-ink);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 16px 34px -16px rgba(0,0,0,.55);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
}

*,*::before,*::after{ box-sizing: border-box; }

html{ -webkit-text-size-adjust: 100%; }

body{
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.55;
  transition: background-color .25s ease, color .25s ease;
}

h1,h2,h3{
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .01em;
  margin: 0 0 .3em;
  color: var(--ink);
}

a{ color: var(--pool); }
body[data-theme="dark"] a{ color: var(--lane); }

p{ margin: 0 0 .8em; color: var(--ink-soft); }

::selection{ background: var(--lane); color: var(--lane-ink); }

/* --- Fokus-Sichtbarkeit (Tastatur) --- */
:focus-visible{
  outline: 2.5px solid var(--lane);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* =========================================================
   Bahnseil — Signature-Trennlinie (lane rope)
   Wiederverwendbar als <div class="lane-rope"></div>
   ========================================================= */
.lane-rope{
  --d: 14px;
  height: 6px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      90deg,
      var(--lane) 0 var(--d),
      var(--pool) var(--d) calc(var(--d) * 2)
    );
  opacity: .9;
}
body[data-theme="dark"] .lane-rope{
  background:
    repeating-linear-gradient(
      90deg,
      var(--lane) 0 var(--d),
      var(--pool-dim) var(--d) calc(var(--d) * 2)
    );
}

/* =========================================================
   Modul-Header / -Footer (von module-base.js gerendert)
   ========================================================= */
.module-shell{
  padding: 1.6rem clamp(1rem, 4vw, 2.6rem) 1.4rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.page-header-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.module-shell .logo{
  display: flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
}
.module-shell .logo .mark{
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(155deg, var(--pool), var(--deep-end));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  text-decoration: none;
  flex: none;
  box-shadow: var(--shadow-sm);
}
.module-shell .logo .txt .brand{
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .04em;
  color: var(--ink);
  line-height: 1;
}
.module-shell .logo .txt .sub{
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: .2rem;
}

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

.dashboard-link{
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  background: var(--surface-2);
  transition: background-color .15s ease, transform .15s ease;
}
.dashboard-link:hover{ background: var(--bg-alt); transform: translateX(-2px); }

.theme-toggle{
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 1.05rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background-color .15s ease, transform .15s ease;
}
.theme-toggle:hover{ background: var(--bg-alt); transform: scale(1.05); }

.module-shell h1{
  font-size: clamp(1.5rem, 3vw, 2.05rem);
  margin-bottom: .35rem;
}
.module-shell p{
  max-width: 60ch;
  font-size: .96rem;
}

.module-shell-footer{
  padding: 1.6rem clamp(1rem, 4vw, 2.6rem) 2.2rem;
  background: var(--bg);
}
.module-shell-footer .impressum{
  font-family: var(--font-mono);
  font-size: .72rem;
  line-height: 1.7;
  color: var(--ink-soft);
  border-top: 1px solid var(--border);
  padding-top: 1.1rem;
}
.module-shell-footer .impressum strong{
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 700;
}
.module-shell-footer .ver{
  margin-top: .4rem;
  opacity: .65;
}

main{
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2.6rem) 3rem;
}

/* =========================================================
   Gemeinsame Buttons
   ========================================================= */
button{ font-family: var(--font-body); }

.run, .btn-pdf{
  appearance: none;
  border: none;
  cursor: pointer;
  background: var(--pool);
  color: #fff;
  font-weight: 700;
  font-size: .92rem;
  padding: .8rem 1.4rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.run:hover:not(:disabled), .btn-pdf:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -10px rgba(14,107,168,.55);
}
.run:active:not(:disabled), .btn-pdf:active{ transform: translateY(0); }
.run:disabled{ opacity: .45; cursor: not-allowed; box-shadow: none; }

body[data-theme="dark"] .run, body[data-theme="dark"] .btn-pdf{
  background: var(--lane);
  color: var(--lane-ink);
}
body[data-theme="dark"] .run:hover:not(:disabled), body[data-theme="dark"] .btn-pdf:hover{
  box-shadow: 0 10px 22px -10px rgba(255,201,60,.45);
}

.ghost, .btn-ghost{
  appearance: none;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  font-size: .88rem;
  padding: .76rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease;
}
.ghost:hover, .btn-ghost:hover{ background: var(--bg-alt); border-color: var(--border-strong); }
.ghost--hidden{ display: none; }

/* Spinner (Ladezustand auf Buttons) */
.spin{
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  display: inline-block;
  animation: spin .7s linear infinite;
  margin-right: .15rem;
}
body[data-theme="dark"] .spin{
  border-color: rgba(43,29,0,.35);
  border-top-color: var(--lane-ink);
}
@keyframes spin{ to{ transform: rotate(360deg); } }

/* =========================================================
   Gemeinsame Formularelemente
   ========================================================= */
input[type="text"], input[type="date"], input[type="time"], input:not([type]),
select, textarea{
  font-family: var(--font-body);
  font-size: .92rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .62rem .75rem;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus{
  border-color: var(--pool);
  box-shadow: 0 0 0 3px rgba(14,107,168,.16);
}
body[data-theme="dark"] input:focus, body[data-theme="dark"] select:focus, body[data-theme="dark"] textarea:focus{
  border-color: var(--lane);
  box-shadow: 0 0 0 3px rgba(255,201,60,.16);
}

label{ font-size: .82rem; color: var(--ink-soft); font-weight: 600; }

/* Pill / Badge */
.pill{
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-family: var(--font-mono);
  font-size: .76rem;
  padding: .32rem .7rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
}
