/* ═══════════════════════════════════════════════════════════════════════════
   BRIGHTFITNESS 2.0 — REDESIGN LAYER
   Lädt NACH style.css. Neue Navigation (Bottom-Tab + FAB), Hub-Views, Widgets.
   Backend/Logik unberührt — rein visuell & strukturell.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* An --accent gekoppelt: folgt automatisch dem gewählten Theme-Farbton */
  --bf-grad:        linear-gradient(135deg, var(--accent-lite) 0%, var(--accent) 55%, var(--accent2) 100%);
  --bf-grad-soft:   linear-gradient(135deg, var(--accent-25), var(--accent-15));
  --bf-nav-h:       68px;
  --bf-fab:         60px;
  --bf-r-card:      20px;
  --bf-r-pill:      999px;
  --bf-ease:        cubic-bezier(.22,1,.36,1);
  --bf-ease-spring: cubic-bezier(.34,1.56,.64,1);
}

/* ───────────────────────────────────────────────────────────────────────────
   BOTTOM NAV 2.0 — 4 Tabs + zentraler FAB
   ─────────────────────────────────────────────────────────────────────────── */
.bf-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--bf-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(12,12,14,.78);
  backdrop-filter: blur(28px) saturate(1.7);
  -webkit-backdrop-filter: blur(28px) saturate(1.7);
  border-top: 1px solid rgba(255,255,255,.07);
  z-index: 300;
  align-items: stretch;
  justify-content: space-around;
}
[data-theme="light"] .bf-nav {
  background: rgba(248,248,250,.82);
  border-top-color: rgba(0,0,0,.08);
}

.bf-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: none;
  color: var(--text3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  position: relative;
  transition: color var(--bf-ease) .2s;
  -webkit-tap-highlight-color: transparent;
  padding: 8px 0 6px;
}
.bf-nav-item { font-size: 10px; }
.bf-nav-item span { white-space: nowrap; }
.bf-nav-item svg { width: 23px; height: 23px; stroke-width: 1.9; transition: transform var(--bf-ease-spring) .35s; }
.bf-nav-item span { transition: opacity .2s, font-weight .2s; }
.bf-nav-item.active { color: var(--accent); }
.bf-nav-item.active svg { transform: translateY(-1px) scale(1.08); }
.bf-nav-item.active span { font-weight: 700; }
.bf-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  width: 26px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--bf-grad);
  transform: translateX(-50%);
  box-shadow: 0 0 12px var(--accent-glow);
}
.bf-nav-item:active svg { transform: scale(.9); }

/* FAB entfernt — 5-Tab-Layout. Spacer & FAB & Sheet ausblenden. */
.bf-nav-spacer { display: none; }
.bf-fab, .bf-sheet, .bf-sheet-backdrop { display: none !important; }

/* ── FAB ───────────────────────────────────────────────────────── */
.bf-fab {
  display: none;
  position: fixed;
  left: 50%;
  bottom: calc(var(--bf-nav-h) - var(--bf-fab)/2 + env(safe-area-inset-bottom, 0px) - 2px);
  transform: translateX(-50%);
  width: var(--bf-fab); height: var(--bf-fab);
  border-radius: 50%;
  border: none;
  background: var(--bf-grad);
  color: #fff;
  z-index: 301;
  align-items: center; justify-content: center;
  box-shadow: 0 6px 20px var(--accent-45), 0 2px 6px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.3);
  cursor: pointer;
  transition: transform var(--bf-ease-spring) .4s, box-shadow var(--bf-ease) .25s;
  -webkit-tap-highlight-color: transparent;
}
.bf-fab svg { width: 28px; height: 28px; stroke-width: 2.4; transition: transform var(--bf-ease-spring) .45s; }
.bf-fab:active { transform: translateX(-50%) scale(.92); }
.bf-fab.open { box-shadow: 0 6px 24px var(--accent-45), 0 2px 6px rgba(0,0,0,.5); }
.bf-fab.open svg { transform: rotate(135deg); }

/* ── Quick-Action Sheet ────────────────────────────────────────── */
.bf-sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 305;
  opacity: 0; pointer-events: none;
  transition: opacity .28s var(--bf-ease);
}
.bf-sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.bf-sheet {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 306;
  background: var(--bg2);
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  border-top: 1px solid var(--border2);
  padding: 14px 18px calc(26px + env(safe-area-inset-bottom, 0px));
  transform: translateY(110%);
  transition: transform .4s var(--bf-ease);
  box-shadow: 0 -12px 48px rgba(0,0,0,.5);
}
.bf-sheet.open { transform: translateY(0); }
.bf-sheet-handle {
  width: 40px; height: 4px; border-radius: 999px;
  background: var(--text4);
  margin: 0 auto 16px;
}
.bf-sheet-title { font-size: 13px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; padding-left: 4px; }
.bf-qa-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 380px) { .bf-qa-grid { grid-template-columns: repeat(3, 1fr); } }

.bf-qa {
  display: flex; flex-direction: column;
  align-items: center; gap: 9px;
  padding: 16px 6px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform var(--bf-ease) .18s, background .18s, border-color .18s;
  -webkit-tap-highlight-color: transparent;
}
.bf-qa:active { transform: scale(.94); background: var(--surface2); }
.bf-qa-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bf-grad-soft);
  border: 1px solid var(--accent-25);
}
.bf-qa-icon svg { width: 23px; height: 23px; stroke: var(--accent); stroke-width: 2; }
.bf-qa-label { font-size: 11px; font-weight: 600; color: var(--text2); text-align: center; line-height: 1.2; }

/* Aktiviere neue Nav nur auf Mobile, blende alte aus */
@media (max-width: 768px) {
  .mobile-nav { display: none !important; }
  .bf-nav { display: flex; }
  .bf-fab { display: flex; }
  .content-area { padding-bottom: calc(var(--bf-nav-h) + 24px) !important; }
}

/* ───────────────────────────────────────────────────────────────────────────
   WIDGET LIBRARY STYLES
   ─────────────────────────────────────────────────────────────────────────── */

/* Section header mit optionalem Action-Link */
.bf-sec { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 2px 12px; }
.bf-sec:first-child { margin-top: 4px; }
.bf-sec-title { font-size: 18px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.bf-sec-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.bf-sec-action { font-size: 13px; font-weight: 600; color: var(--accent); cursor: pointer; background: none; border: none; display: inline-flex; align-items: center; gap: 3px; }
.bf-sec-action svg { width: 14px; height: 14px; }

/* Card */
.bf-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--bf-r-card);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
[data-theme="dark"] .bf-card { background: #141414; }
[data-theme="light"] .bf-card { box-shadow: 0 1px 4px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04); background: #fff; }

/* Hero-Ring Card (Dashboard centerpiece) */
.bf-hero {
  background: radial-gradient(120% 90% at 50% 0%, var(--accent-15) 0%, transparent 60%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--bf-r-card);
  padding: 24px 20px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
[data-theme="dark"] .bf-hero { background: radial-gradient(120% 90% at 50% 0%, var(--accent-15) 0%, transparent 60%), #141414; }
[data-theme="light"] .bf-hero { background: radial-gradient(120% 90% at 50% 0%, var(--accent-bg) 0%, transparent 60%), #fff; box-shadow: 0 1px 4px rgba(0,0,0,.05), 0 8px 28px rgba(0,0,0,.05); }

.bf-ring-wrap { position: relative; width: 188px; height: 188px; margin: 6px auto 4px; }
.bf-ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.bf-ring-track { fill: none; stroke: var(--bg3); }
[data-theme="light"] .bf-ring-track { stroke: var(--bg2); }
.bf-ring-fill { fill: none; stroke: url(#bfRingGrad); stroke-linecap: round; transition: stroke-dashoffset 1s var(--bf-ease); filter: drop-shadow(0 0 6px var(--accent-glow)); }
.bf-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.bf-ring-big { font-size: 42px; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: var(--text); }
.bf-ring-unit { font-size: 13px; font-weight: 600; color: var(--text2); margin-top: 4px; }
.bf-ring-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* Stat-Pills horizontal scroll */
.bf-pills { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; scrollbar-width: none; scroll-snap-type: x mandatory; }
.bf-pills::-webkit-scrollbar { display: none; }
.bf-pill {
  flex: 0 0 auto;
  min-width: 104px;
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px 15px;
  display: flex; flex-direction: column; gap: 7px;
}
[data-theme="dark"] .bf-pill { background: #141414; }
[data-theme="light"] .bf-pill { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.bf-pill-top { display: flex; align-items: center; gap: 7px; }
.bf-pill-ic { width: 28px; height: 28px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bf-pill-ic svg { width: 15px; height: 15px; stroke-width: 2.2; }
.bf-pill-val { font-size: 20px; font-weight: 800; letter-spacing: -.02em; color: var(--text); line-height: 1; }
.bf-pill-lbl { font-size: 11px; color: var(--text2); font-weight: 500; }

/* Progress bar */
.bf-bar-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.bf-bar-lbl { font-size: 13px; font-weight: 600; color: var(--text); }
.bf-bar-val { font-size: 12px; font-weight: 600; color: var(--text2); }
.bf-bar { height: 9px; border-radius: 999px; background: var(--bg3); overflow: hidden; }
[data-theme="light"] .bf-bar { background: var(--bg2); }
.bf-bar-fill { height: 100%; border-radius: 999px; background: var(--bf-grad); transition: width .9s var(--bf-ease); }
.bf-bar-fill.green { background: linear-gradient(90deg, #32D74B, #28A83C); }
.bf-bar-fill.blue { background: linear-gradient(90deg, #409CFF, #0A84FF); }

/* Next-Up workout card */
.bf-nextup {
  background: var(--bf-grad);
  border-radius: var(--bf-r-card);
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.bf-nextup::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.bf-nextup-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.bf-nextup-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 5px 0 3px; }
.bf-nextup-meta { font-size: 13px; opacity: .9; margin-bottom: 16px; }
.bf-nextup-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: #1a1a1a;
  border: none; border-radius: 999px;
  padding: 11px 22px; font-size: 14px; font-weight: 700;
  cursor: pointer; position: relative; z-index: 1;
  transition: transform var(--bf-ease) .18s;
}
.bf-nextup-btn:active { transform: scale(.96); }
.bf-nextup-btn svg { width: 16px; height: 16px; }

/* Hub cards (Du / Training Übersicht) */
.bf-hub-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bf-hub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 16px;
  display: flex; flex-direction: column; gap: 12px;
  cursor: pointer;
  text-align: left;
  transition: transform var(--bf-ease) .18s, border-color .18s, background .18s;
  -webkit-tap-highlight-color: transparent;
}
[data-theme="dark"] .bf-hub-card { background: #141414; }
[data-theme="light"] .bf-hub-card { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.bf-hub-card:active { transform: scale(.97); }
.bf-hub-card.wide { grid-column: span 2; flex-direction: row; align-items: center; }
.bf-hub-ic {
  width: 44px; height: 44px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bf-grad-soft);
  border: 1px solid var(--accent-20);
  flex-shrink: 0;
}
.bf-hub-ic svg { width: 22px; height: 22px; stroke: var(--accent); stroke-width: 2; }
.bf-hub-tt { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.bf-hub-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.bf-hub-card.wide .bf-hub-body { flex: 1; }
.bf-hub-card.wide .bf-hub-chev { color: var(--text3); }
.bf-hub-card.wide .bf-hub-chev svg { width: 20px; height: 20px; }

/* Profile header (Du hub top) */
.bf-prof {
  display: flex; align-items: center; gap: 15px;
  background: radial-gradient(140% 100% at 0% 0%, var(--accent-15), transparent 55%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--bf-r-card);
  padding: 20px;
  margin-bottom: 4px;
}
[data-theme="dark"] .bf-prof { background: radial-gradient(140% 100% at 0% 0%, var(--accent-15), transparent 55%), #141414; }
[data-theme="light"] .bf-prof { background: radial-gradient(140% 100% at 0% 0%, var(--accent-bg), transparent 55%), #fff; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.bf-prof-av {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--bf-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px var(--accent-35);
}
.bf-prof-name { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.bf-prof-lvl { font-size: 13px; color: var(--text2); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.bf-prof-lvl b { color: var(--accent); font-weight: 700; }
.bf-prof-xp { margin-top: 9px; }

/* Page entrance */
.bf-fade { animation: bfFade .35s var(--bf-ease) both; }
@keyframes bfFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.bf-fade-1 { animation-delay: .04s; }
.bf-fade-2 { animation-delay: .08s; }
.bf-fade-3 { animation-delay: .12s; }
.bf-fade-4 { animation-delay: .16s; }

@media (prefers-reduced-motion: reduce) {
  .bf-fade, .bf-sheet, .bf-fab, .bf-ring-fill, .bf-bar-fill { animation: none !important; transition: none !important; }
}
