/* ==========================================================================
   Strafenkatalog EGB - Apple HIG (Liquid Glass) + Google Material Design 3
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Roboto", system-ui, sans-serif;
  --bg-page: #eef2f6;
  --bg-surface: #ffffff;
  --bg-elevated: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.78);
  --bg-glass-strong: rgba(255, 255, 255, 0.92);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-subtle: rgba(148, 163, 184, 0.24);
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: rgba(37, 99, 235, 0.12);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.14);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --info: #0ea5e9;
  --info-soft: rgba(14, 165, 233, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 9999px;
  --shadow-soft: 0 10px 30px -5px rgba(15, 23, 42, 0.06), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-glass: 0 20px 45px -10px rgba(15, 23, 42, 0.12);
  --transition-spring: 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg-page: #070b14;
  --bg-surface: #0f172a;
  --bg-elevated: #1e293b;
  --bg-glass: rgba(15, 23, 42, 0.78);
  --bg-glass-strong: rgba(30, 41, 59, 0.92);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-subtle: rgba(148, 163, 184, 0.16);
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.18);
  --shadow-soft: 0 12px 32px -6px rgba(0, 0, 0, 0.45);
  --shadow-glass: 0 25px 50px -12px rgba(0, 0, 0, 0.65);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}

body {
  background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 45%),
              radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.10), transparent 45%),
              var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 1.45;
}

/* App Shell */
.app-shell {
  width: 100%;
  max-width: 520px;
  height: 100vh;
  max-height: 940px;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-glass);
}

@media (min-width: 540px) {
  .app-shell {
    height: 92vh;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
  }
}

/* Apple Glass Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 25;
  padding: 16px 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-brand {
  display: flex;
  flex-direction: column;
}

.header-subtitle {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  font-weight: 700;
}

.app-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.05rem;
  transition: transform var(--transition-spring), background var(--transition-spring);
}

.icon-btn:active {
  transform: scale(0.92);
}

.avatar-btn {
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  border: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Profile Popover */
.profile-popover {
  position: absolute;
  top: 68px;
  right: 18px;
  width: 260px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-glass);
  z-index: 40;
}

/* Content Scroll Area */
.main-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 100px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Material 3 KPI Bento Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.bento-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.bento-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
}

.bento-card.warn::before { background: var(--warning); }
.bento-card.ok::before { background: var(--success); }
.bento-card.danger::before { background: var(--danger); }

.bento-value {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.bento-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Cards & Lists */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.surface-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition-spring);
}

.surface-card:active {
  transform: scale(0.99);
}

/* Status Chips (Material 3 Tonal) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.chip--open { background: var(--warning-soft); color: var(--warning); }
.chip--overdue { background: var(--danger-soft); color: var(--danger); }
.chip--paid, .chip--paid_late { background: var(--success-soft); color: var(--success); }
.chip--info { background: var(--primary-soft); color: var(--primary); }

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Buttons */
.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--transition-spring), opacity 0.2s, background 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary { background: var(--primary); color: #ffffff; }
.btn--primary:hover { background: var(--primary-hover); }
.btn--success { background: var(--success); color: #ffffff; }
.btn--warning { background: var(--warning); color: #ffffff; }
.btn--danger { background: var(--danger); color: #ffffff; }
.btn--tonal { background: var(--primary-soft); color: var(--primary); }
.btn--outline { background: transparent; border: 1px solid var(--border-subtle); color: var(--text-main); }
.btn--full { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: 0.78rem; border-radius: var(--radius-sm); }

/* Ranking Row */
.ranking-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}

.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Bottom Navigation Bar (Apple Tab Bar + M3 Active Pill) */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  padding: 8px 10px 14px 10px;
  z-index: 30;
}

.nav-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  flex: 1;
  padding: 4px 0;
  font-size: 0.68rem;
  font-weight: 600;
}

.nav-pill {
  padding: 3px 16px;
  border-radius: var(--radius-pill);
  font-size: 1.15rem;
  transition: background var(--transition-spring), transform var(--transition-spring);
}

.nav-tab.active {
  color: var(--primary);
  font-weight: 700;
}

.nav-tab.active .nav-pill {
  background: var(--primary-soft);
  transform: translateY(-1px);
}

/* Toast Notification */
.toast {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-main);
  color: var(--bg-surface);
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: var(--shadow-glass);
  z-index: 50;
  white-space: nowrap;
}
