/* ============================================================
   PULSE — FitnessTracker WebApp · Design System
   Energetisch · Dark · Teal/Cyan-Akzente
   ============================================================ */

:root {
  /* Surfaces (deep teal-black) */
  --bg:        #0a1014;
  --surface-1: #101a1f;
  --surface-2: #16242b;
  --surface-3: #1d3038;
  --hairline:  rgba(120, 200, 210, 0.10);
  --hairline-strong: rgba(120, 200, 210, 0.18);

  /* Accents — shared chroma, varied hue */
  --green:   #2ee6a8;
  --green-d: #1fb88a;
  --blue:    #1fb6ff;
  --blue-d:  #1488d6;

  /* Text */
  --text:    #eaf6f4;
  --muted:   rgba(213, 235, 235, 0.62);
  --faint:   rgba(213, 235, 235, 0.34);

  /* Status */
  --warn: #ffb24d;

  /* Geometry */
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-xl: 34px;

  /* Shadows / glows */
  --glow-green: 0 0 0 1px rgba(46,230,168,0.35), 0 8px 28px -8px rgba(46,230,168,0.45);
  --glow-blue:  0 0 0 1px rgba(31,182,255,0.30), 0 8px 28px -8px rgba(31,182,255,0.4);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.03) inset, 0 12px 30px -16px rgba(0,0,0,0.7);

  /* Translucent chrome (bottom nav, rest-timer overlay) — themed separately
     because their content uses --text and needs a matching backdrop. */
  --nav-bg:     rgba(10, 16, 20, 0.82);
  --overlay-bg: rgba(6, 12, 15, 0.86);

  --app-w: 440px;
}

/* ============================================================
   Themes — ein Design = ein Block hier + ein Eintrag in
   window.THEMES (data.jsx). :root oben ist das Dark-Default.
   ============================================================ */

[data-theme="light"] {
  --bg:        #eef4f4;
  --surface-1: #ffffff;
  --surface-2: #e2ecec;
  --surface-3: #d2e2e2;
  --hairline:  rgba(15, 60, 70, 0.10);
  --hairline-strong: rgba(15, 60, 70, 0.20);

  /* Same hues, darkened for contrast on light surfaces */
  --green:   #0ebe8b;
  --green-d: #0a9a70;
  --blue:    #0e93d8;
  --blue-d:  #0a71a8;

  --text:    #10262b;
  --muted:   rgba(16, 48, 54, 0.66);
  --faint:   rgba(16, 48, 54, 0.42);

  --warn: #d9861f;

  --glow-green: 0 0 0 1px rgba(14,190,139,0.35), 0 8px 24px -10px rgba(14,190,139,0.45);
  --glow-blue:  0 0 0 1px rgba(14,147,216,0.30), 0 8px 24px -10px rgba(14,147,216,0.4);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.6) inset, 0 10px 24px -14px rgba(15,60,70,0.22);

  --nav-bg:     rgba(238, 244, 244, 0.85);
  --overlay-bg: rgba(230, 240, 240, 0.9);
}

/* Pure-black surfaces for OLED displays — inherits accents/text from :root */
[data-theme="oled"] {
  --bg:        #000000;
  --surface-1: #0a0f12;
  --surface-2: #111b20;
  --surface-3: #192930;
  --nav-bg:    rgba(0, 0, 0, 0.85);
}

@font-face { font-display: swap; }

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Barlow', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  /* Desktop: phone column on a textured dark backdrop */
  display: flex;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(31,182,255,0.07), transparent 60%),
    radial-gradient(900px 500px at 50% 110%, rgba(46,230,168,0.06), transparent 60%),
    var(--bg);
}

/* The app shell — fills viewport on mobile, centered column on desktop */
#root { width: 100%; display: flex; justify-content: center; }

.app {
  width: 100%;
  max-width: var(--app-w);
  min-height: 100dvh;
  position: relative;
  background: var(--bg);
  overflow: hidden;
  /* This is an app, not a document — text (numbers, labels, buttons)
     shouldn't turn into a selection on tap/drag. Inputs opt back in below. */
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  flex-direction: column;
}
@media (min-width: 480px) {
  .app {
    min-height: min(940px, 100dvh);
    margin: clamp(0px, 4vh, 40px) 0;
    border-radius: 38px;
    border: 1px solid var(--hairline-strong);
    box-shadow: 0 50px 120px -40px rgba(0,0,0,0.9), 0 0 0 1px rgba(0,0,0,0.4);
    overflow: hidden;
  }
}

/* ---- Typography helpers ---- */
.display {
  font-family: 'Barlow Semi Condensed', 'Barlow', sans-serif;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 0.95;
}
.num {
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.eyebrow {
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  color: var(--faint);
}

/* ---- Scrollable content region ---- */
.screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ---- Hide scrollbars everywhere — app never shows a native scrollbar track ---- */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }

/* ---- Generic card ---- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

/* ---- Buttons ---- */
.btn {
  border: none;
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform .12s ease, filter .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { transform: scale(0.97); }

input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

.btn-primary {
  background: linear-gradient(180deg, var(--green), var(--green-d));
  color: #04201a;
  box-shadow: var(--glow-green);
}
.btn-blue {
  background: linear-gradient(180deg, var(--blue), var(--blue-d));
  color: #032231;
  box-shadow: var(--glow-blue);
}
.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--hairline-strong);
}
.btn-lg { height: 58px; padding: 0 26px; font-size: 18px; }
.btn-md { height: 46px; padding: 0 20px; font-size: 15px; }

/* utility */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.grow { flex: 1; }

@keyframes popIn {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}
/* Entrance: animate movement only — opacity stays 1 so content is never
   stuck invisible if the document is hidden (animation clock paused at t=0). */
@keyframes fadeUp {
  from { transform: translateY(12px); }
  to   { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  [style*="fadeUp"], [style*="popIn"] { animation: none !important; }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(100%); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(46,230,168,0.5); }
  70% { box-shadow: 0 0 0 18px rgba(46,230,168,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,230,168,0); }
}
