/* =========================================================
   fittrax – Liquid Glass Design System
   Modern · Premium · Orange Accent
   ========================================================= */

:root {
  --bg: #e8e8ed;
  --bg-deep: #d1d1d6;
  --surface: rgba(255, 255, 255, 0.48);
  --surface-strong: rgba(255, 255, 255, 0.72);
  --border: rgba(255, 255, 255, 0.75);
  --border-soft: rgba(0, 0, 0, 0.06);
  --text: #1c1c1e;
  --text-2: #636366;
  --text-3: #8e8e93;
  --accent: #ff9500;
  --accent-2: #ffcc00;
  --accent-dim: rgba(255, 149, 0, 0.15);
  --accent-glow: rgba(255, 149, 0, 0.4);
  --grad: linear-gradient(135deg, #ff9500 0%, #ffcc00 100%);
  --success: #34c759;
  --danger: #ff3b30;
  --radius: 24px;
  --radius-sm: 16px;
  --radius-xs: 12px;
  --blur: 48px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
  --nav-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-bs-theme="dark"],
html[data-theme="dark"] {
  --bg: #000000;
  --bg-deep: #0a0a0a;
  --surface: rgba(22, 22, 24, 0.55);
  --surface-strong: rgba(36, 36, 38, 0.78);
  --border: rgba(255, 255, 255, 0.14);
  --border-soft: rgba(255, 255, 255, 0.06);
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #6e6e73;
  --accent: #ff9f0a;
  --accent-2: #ffd60a;
  --accent-dim: rgba(255, 159, 10, 0.18);
  --accent-glow: rgba(255, 159, 10, 0.45);
  --grad: linear-gradient(135deg, #ff9f0a 0%, #ffd60a 100%);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.65);
}

@media (prefers-color-scheme: dark) {
  html:not([data-bs-theme="light"]):not([data-theme="light"]) {
    --bg: #000000;
    --bg-deep: #0a0a0a;
    --surface: rgba(22, 22, 24, 0.55);
    --surface-strong: rgba(36, 36, 38, 0.78);
    --border: rgba(255, 255, 255, 0.14);
    --border-soft: rgba(255, 255, 255, 0.06);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #6e6e73;
    --accent: #ff9f0a;
    --accent-2: #ffd60a;
    --accent-dim: rgba(255, 159, 10, 0.18);
    --accent-glow: rgba(255, 159, 10, 0.45);
    --grad: linear-gradient(135deg, #ff9f0a 0%, #ffd60a 100%);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.65);
  }
}

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

html { height: 100%; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  overflow-x: hidden;
}

/* Ambient glow orbs */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 100% 60% at 0% -20%, rgba(255, 149, 0, 0.28), transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(255, 204, 0, 0.14), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 120%, rgba(255, 149, 0, 0.1), transparent 45%);
}
html[data-bs-theme="dark"] body::before,
html[data-theme="dark"] body::before {
  background:
    radial-gradient(ellipse 100% 60% at 5% -15%, rgba(255, 159, 10, 0.32), transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 5%, rgba(255, 214, 10, 0.12), transparent 50%),
    radial-gradient(ellipse 60% 40% at 40% 115%, rgba(255, 149, 0, 0.12), transparent 45%);
}

/* ========== Layout ========== */
.app-wrap {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 0;
}
@media (min-width: 992px) {
  .app-wrap {
    max-width: 920px;
    padding-bottom: 32px;
  }
  .bottom-nav { display: none !important; }
  body { padding-bottom: 32px; }
}

/* ========== Glass ========== */
.glass {
  background: var(--surface);
  backdrop-filter: saturate(200%) blur(var(--blur));
  -webkit-backdrop-filter: saturate(200%) blur(var(--blur));
  border: 1px solid var(--border);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0,0,0,0.04);
  border-radius: var(--radius);
}
html[data-bs-theme="dark"] .glass,
html[data-theme="dark"] .glass {
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.glass-strong {
  background: var(--surface-strong);
  backdrop-filter: saturate(200%) blur(48px);
  -webkit-backdrop-filter: saturate(200%) blur(48px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.glass-accent {
  background: linear-gradient(145deg, rgba(255, 149, 0, 0.22), rgba(255, 204, 0, 0.08));
  backdrop-filter: saturate(180%) blur(var(--blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--blur));
  border: 1px solid rgba(255, 149, 0, 0.35);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* ========== Typography ========== */
h1, .h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.035em; color: var(--text); }
h2, .h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.025em; color: var(--text); }
h3, .h3 { font-size: 1.05rem; font-weight: 650; color: var(--text); }
.text-secondary { color: var(--text-2) !important; }
.text-muted, .text-tertiary { color: var(--text-3) !important; }
.text-accent { color: var(--accent) !important; }
.text-danger { color: var(--danger) !important; }
.small, small { font-size: 0.8125rem; }
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }

.brand-gradient {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* Fallback if clip fails */
@supports not (background-clip: text) {
  .brand-gradient { color: var(--accent); -webkit-text-fill-color: unset; background: none; }
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1.1;
}
.stat-value.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-2);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.section-label .btn { text-transform: none; letter-spacing: normal; }


/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 650;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, filter 0.15s, background 0.15s;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 0.95rem;
  line-height: 1.2;
}
.btn:active { transform: scale(0.97); }
.btn-accent {
  background: var(--grad);
  color: #1a1200 !important;
  box-shadow: 0 6px 24px var(--accent-glow);
  font-weight: 750;
}
.btn-accent:hover { filter: brightness(1.06); color: #1a1200 !important; }
.btn-soft {
  background: var(--accent-dim);
  color: var(--accent) !important;
}
.btn-soft:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent;
  color: var(--accent) !important;
}
.btn-danger {
  background: rgba(255, 59, 48, 0.15);
  color: var(--danger) !important;
}
.btn-danger-solid {
  background: var(--danger);
  color: #fff !important;
}
.btn-block, .w-100 { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; border-radius: 12px; }
.btn-lg { padding: 14px 22px; font-size: 1rem; }
.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
}
.btn-close {
  filter: none;
  opacity: 0.6;
}

/* ========== Forms ========== */
.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-control, .form-select {
  width: 100%;
  padding: 13px 16px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--accent-dim);
  border: 1.5px solid transparent;
  border-radius: var(--radius-xs);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  background: var(--surface-strong);
  box-shadow: 0 0 0 4px var(--accent-dim);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238e8e93' stroke-width='2'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.form-select-lg, .form-control-lg { padding: 14px 16px; font-size: 1.05rem; }
textarea.form-control { min-height: 88px; resize: vertical; }

/* ========== Cards / Lists ========== */
.card {
  background: var(--surface);
  backdrop-filter: saturate(180%) blur(var(--blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  overflow: hidden;
}
.card-body { padding: 18px; }
.card.border-0 { border: 1px solid var(--border); }

.list-group { border-radius: var(--radius); overflow: hidden; }
.list-group-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  text-decoration: none;
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.list-group-item:last-child { border-bottom: none; }
.list-group-item:hover, .list-group-item:active {
  background: var(--accent-dim);
  color: var(--text);
}

.icon-box {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-box svg, .icon-box i { width: 20px; height: 20px; }

/* ========== Avatar ========== */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 100px; height: 100px; font-size: 2.2rem; }
.avatar-click { cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.avatar-click:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

/* ========== Badge ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}
.badge-premium {
  background: var(--grad);
  color: #1a1200;
}
.bg-accent-soft { background: var(--accent-dim) !important; }

/* ========== Bottom Nav ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 1000;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 6px calc(8px + var(--safe-b));
  background: var(--surface-strong);
  backdrop-filter: saturate(200%) blur(48px);
  -webkit-backdrop-filter: saturate(200%) blur(48px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.08);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 14px;
  min-width: 60px;
  text-decoration: none;
  color: var(--text-3);
  font-size: 0.62rem;
  font-weight: 650;
  border-radius: 14px;
  transition: color 0.2s, background 0.2s;
}
.bottom-nav a svg, .bottom-nav a i { width: 22px; height: 22px; }
.bottom-nav a.active,
.bottom-nav a:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ========== Desktop top nav ========== */
.desktop-bar {
  display: none;
}
@media (min-width: 992px) {
  .desktop-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    margin: 0 0 24px;
    position: sticky;
    top: 12px;
    z-index: 100;
    border-radius: var(--radius);
  }
  .desktop-nav {
    display: flex;
    gap: 4px;
  }
  .desktop-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-2);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.15s;
  }
  .desktop-nav a:hover,
  .desktop-nav a.active {
    background: var(--accent-dim);
    color: var(--accent);
  }
}

/* ========== Calendar ========== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}
.cal-day.workout {
  background: var(--grad);
  color: #1a1200;
  box-shadow: 0 3px 12px var(--accent-glow);
}
.cal-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day.muted { opacity: 0.35; }

/* ========== Empty / Alert ========== */
.empty-box {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-2);
}
.empty-box svg, .empty-box i {
  width: 48px;
  height: 48px;
  color: var(--accent);
  opacity: 0.5;
  margin-bottom: 12px;
}

.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}
.alert-success { background: rgba(52, 199, 89, 0.15); color: var(--success); border: 1px solid rgba(52, 199, 89, 0.25); }
.alert-danger { background: rgba(255, 59, 48, 0.15); color: var(--danger); border: 1px solid rgba(255, 59, 48, 0.25); }
.alert-warning { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(255, 149, 0, 0.25); }

/* ========== Modal (Bootstrap compatible) ========== */
/* old modal-content removed */
.modal-header, .modal-footer { border-color: var(--border-soft) !important; }
.modal-backdrop {
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
}
.modal-backdrop.show { background-color: rgba(0,0,0,0.45); }

/* ========== Tables ========== */
.table { color: var(--text); width: 100%; }
.table th {
  font-size: 0.72rem;
  color: var(--text-2);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table-borderless td, .table-borderless th { border: 0; padding: 6px 4px; }

/* ========== Utilities ========== */
.d-flex { display: flex; }
.d-none { display: none !important; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.flex-grow-1 { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 16px !important; }
.mb-4 { margin-bottom: 24px !important; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.me-1 { margin-right: 4px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 16px; padding-bottom: 16px; }
.py-4 { padding-top: 24px; padding-bottom: 24px; }
.px-3 { padding-left: 16px; padding-right: 16px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.text-center { text-align: center; }
.text-end { text-align: right; }
.text-start { text-align: left; }
.row { display: flex; flex-wrap: wrap; margin: 0 -5px; }
.row > * { padding: 0 5px; }
.g-2 { --g: 8px; }
.col-6 { width: 50%; }
.col-4 { width: 33.333%; }
.col-md-3 { width: 50%; }
@media (min-width: 768px) {
  .col-md-3 { width: 25%; }
}
@media (min-width: 992px) {
  .d-lg-none { display: none !important; }
  .d-lg-flex { display: flex !important; }
  .d-none.d-lg-flex { display: flex !important; }
}
.h-100 { height: 100%; }
.rounded-circle { border-radius: 50% !important; }
.rounded-pill { border-radius: 999px !important; }
.sticky-top { position: sticky; top: 0; z-index: 100; }

/* Bootstrap modal fade helpers if BS loaded */
/* Bootstrap Modal – nicht display überschreiben! */
.modal.fade .modal-dialog { transition: transform 0.25s ease-out; }
.modal-backdrop.show { opacity: 0.55; }
body.modal-open { overflow: hidden; padding-right: 0 !important; }

[data-lucide] { display: inline-block; vertical-align: middle; }


/* =====================================================
   MODAL FIX – klickbar, kein Blur-Blocker
   ===================================================== */
.modal-backdrop {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background-color: rgba(0, 0, 0, 0.65) !important;
  opacity: 1 !important;
  z-index: 1040 !important;
  pointer-events: auto !important;
}
.modal-backdrop.fade { opacity: 0 !important; }
.modal-backdrop.show { opacity: 1 !important; }

.modal {
  z-index: 1055 !important;
  pointer-events: none !important; /* BS standard: only dialog receives clicks */
}
.modal.show {
  pointer-events: none !important;
}
.modal-dialog {
  pointer-events: auto !important;
  z-index: 1056 !important;
  margin: 1.75rem auto;
  position: relative;
}
.modal-content {
  pointer-events: auto !important;
  background: #1c1c1e !important;
  color: #f5f5f7 !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  border-radius: 20px !important;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html[data-bs-theme="light"] .modal-content,
html[data-theme="light"] .modal-content {
  background: #ffffff !important;
  color: #1c1c1e !important;
  border-color: rgba(0,0,0,0.08) !important;
}
.modal-header, .modal-footer, .modal-body {
  pointer-events: auto !important;
  border-color: rgba(128,128,128,0.15) !important;
}
.modal-content input,
.modal-content select,
.modal-content textarea,
.modal-content button,
.modal-content a,
.modal-content label {
  pointer-events: auto !important;
  position: relative;
  z-index: 1;
}
.btn-close {
  pointer-events: auto !important;
  opacity: 0.8;
}
.bottom-nav {
  z-index: 1030 !important;
}
.modal-overlay {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
