/* =========================================================
   MoooGly v2 – Design-System
   Philosophie: warm, professionell, ruhig – kein KI-Kitsch.
   ========================================================= */

:root {
  /* Backgrounds */
  --bg-base:    #F8F7F4;
  --bg-surface: #FFFFFF;
  --bg-subtle:  #F1EFE9;
  --bg-overlay: rgba(26, 26, 46, 0.45);

  /* Primary: Schieferblau */
  --color-primary:       #1E3A5F;
  --color-primary-hover: #16304F;
  --color-primary-light: #EBF2FB;

  /* Accent: Teal (eigenständig, klar abgegrenzt von Moodle-Orange) */
  --color-accent:        #0D9488;
  --color-accent-hover:  #0F766E;
  --color-accent-light:  #CCFBF1;

  /* Text */
  --text-primary:   #1A1A2E;
  --text-secondary: #4A5568;
  --text-muted:     #94A3B8;
  --text-inverse:   #FFFFFF;

  /* Status */
  --color-success: #059669;
  --color-warning: #CA8A04;
  --color-error:   #DC2626;

  /* Wallet-Donut */
  --wallet-available: #0D9488;
  --wallet-preview:   #FACC15;
  --wallet-charge:    #EAB308;
  --wallet-consumed:  #94A3B8;

  /* Borders */
  --border-subtle: #E5E7EB;
  --border-default: #D1D5DB;

  /* Radius */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;

  /* Shadow */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.12);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;
  --space-10: 64px;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  2rem;
  --text-4xl:  2.5rem;
}

/* ─── Reset & Base ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-base);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); text-decoration: underline; }

/* Skip-Link */
.skip-link {
  position: absolute; top: -100px; left: 0;
  background: var(--color-primary); color: white;
  padding: var(--space-3) var(--space-4); z-index: 999;
}
.skip-link:focus { top: 0; }

/* Focus */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ─── Layout-Container ──────────────────────────────── */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

/* ─── Typografie ────────────────────────────────────── */
h1, h2, h3, h4 { margin: 0 0 var(--space-3); line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
p  { margin: 0 0 var(--space-3); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }

/* ─── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms, border-color 150ms, transform 150ms, box-shadow 150ms;
  user-select: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
@media (prefers-reduced-motion: no-preference) {
  .btn:hover:not(:disabled) { transform: translateY(-1px); }
  .btn:active:not(:disabled) { transform: translateY(0); }
}
.btn-primary { background: var(--color-primary); color: var(--text-inverse); }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); }
.btn-accent  { background: var(--color-accent); color: var(--text-inverse); }
.btn-accent:hover:not(:disabled) { background: var(--color-accent-hover); }
.btn-ghost   { background: transparent; color: var(--text-primary); border-color: var(--border-default); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-subtle); }
.btn-sm { padding: 6px 12px; font-size: var(--text-sm); }

/* ─── Cards ─────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}

/* ─── Inputs ────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.field label { font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font: inherit;
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: border-color 150ms, box-shadow 150ms;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.field textarea { min-height: 88px; resize: vertical; }

/* Radio-Cards */
.radio-card-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); }
.radio-card {
  position: relative;
  display: block;
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color 150ms, background-color 150ms;
}
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card:hover { border-color: var(--color-primary-light); }
.radio-card:has(input:checked) { border-color: var(--color-primary); background: var(--color-primary-light); }
.radio-card-title { font-weight: 600; font-size: var(--text-base); margin-bottom: 2px; }
.radio-card-desc  { font-size: var(--text-sm); color: var(--text-secondary); }

/* ─── Header ────────────────────────────────────────── */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 50;
}
.site-header .container { display: flex; align-items: center; gap: var(--space-5); height: 64px; }
.site-header .brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; font-size: var(--text-lg); color: var(--text-primary); }
.site-header .brand img { height: 28px; width: auto; }
.site-header nav { margin-left: auto; display: flex; align-items: center; gap: var(--space-4); }

/* ─── Landing-Hero ──────────────────────────────────── */
.hero {
  padding: var(--space-10) 0 var(--space-8);
  background: linear-gradient(180deg, var(--bg-base) 0%, var(--bg-subtle) 100%);
}
.hero h1 { font-size: var(--text-4xl); max-width: 720px; }
.hero .lead { font-size: var(--text-lg); color: var(--text-secondary); max-width: 640px; margin-bottom: var(--space-5); }
.hero .cta-row { display: flex; gap: var(--space-3); flex-wrap: wrap; }

/* Sections */
section.block { padding: var(--space-8) 0; }
section.block + section.block { border-top: 1px solid var(--border-subtle); }
section h2 { margin-bottom: var(--space-5); }

/* Feature-Grid */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-5); }
.feature-card { padding: var(--space-5); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--bg-surface); }
.feature-card .icon { width: 36px; height: 36px; color: var(--color-primary); margin-bottom: var(--space-3); }
.feature-card h3 { font-size: var(--text-lg); }

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-4); }
.price-card { padding: var(--space-5); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--bg-surface); }
.price-card.featured { border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.price-card .price { font-size: var(--text-3xl); font-weight: 600; color: var(--color-primary); font-variant-numeric: tabular-nums; }
.price-card .price small { font-size: var(--text-sm); color: var(--text-muted); font-weight: 400; }
.price-card ul { padding-left: var(--space-4); margin: var(--space-3) 0; color: var(--text-secondary); }
.price-card ul li { margin-bottom: 4px; }

/* Footer */
.site-footer { padding: var(--space-6) 0; color: var(--text-muted); font-size: var(--text-sm); text-align: center; border-top: 1px solid var(--border-subtle); }

/* ─── App-Shell ─────────────────────────────────────── */
.app-shell { display: flex; flex-direction: column; height: 100vh; }
.app-header { flex: 0 0 56px; display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-5); border-bottom: 1px solid var(--border-subtle); background: var(--bg-surface); }
.app-header .brand { font-weight: 600; }
.app-header .spacer { flex: 1; }

.app-main { flex: 1; display: grid; grid-template-columns: 440px 1fr; min-height: 0; }
.app-side { border-right: 1px solid var(--border-subtle); background: var(--bg-surface); overflow-y: auto; padding: var(--space-5); }
.app-frame { background: var(--bg-subtle); position: relative; }
.app-frame iframe { width: 100%; height: 100%; border: 0; background: white; }
.app-frame .frame-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: var(--text-sm);
  padding: var(--space-5); text-align: center;
}

@media (max-width: 900px) {
  .app-main { grid-template-columns: 1fr; }
  .app-frame { display: none; }
}

/* ─── Wizard ────────────────────────────────────────── */
.wizard-steps { display: flex; gap: var(--space-2); margin-bottom: var(--space-5); }
.wizard-step-pill {
  flex: 1; height: 6px; border-radius: 3px; background: var(--border-subtle);
  transition: background-color 200ms;
}
.wizard-step-pill.active { background: var(--color-primary); }
.wizard-step-pill.done   { background: var(--color-success); }

.wizard-card { animation: fadeSlideIn 200ms ease-out; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .wizard-card { animation: none; } }

.wizard-actions { display: flex; gap: var(--space-3); margin-top: var(--space-5); justify-content: space-between; }

/* Slider */
.slider-field { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.slider-field .row { display: flex; align-items: center; gap: var(--space-3); }
.slider-field input[type=range] { flex: 1; }
.slider-field .value { min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Wallet-Pill (Header) */
.wallet-pill {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 6px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: var(--text-sm); font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.wallet-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-success); }

/* Wallet-Donut (SVG-Container) */
.wallet-donut { position: relative; width: 140px; height: 140px; margin: 0 auto; }
.wallet-donut .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.wallet-donut .balance { font-size: var(--text-2xl); font-weight: 600; font-variant-numeric: tabular-nums; }
.wallet-donut .balance-label { font-size: var(--text-xs); color: var(--text-muted); }

/* Toast */
.toast { position: fixed; bottom: var(--space-5); right: var(--space-5); background: var(--text-primary); color: white; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 100; }
.toast.error { background: var(--color-error); }
.toast.success { background: var(--color-success); }

/* Spinner */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 600ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat-Messages */
.chat-window { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3) 0; }
.chat-msg { padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); max-width: 90%; }
.chat-msg.user      { align-self: flex-end; background: var(--color-primary); color: white; border-bottom-right-radius: var(--radius-sm); }
.chat-msg.assistant { align-self: flex-start; background: var(--bg-subtle); border-bottom-left-radius: var(--radius-sm); }
.chat-msg.system    { align-self: center; background: transparent; color: var(--text-muted); font-size: var(--text-sm); font-style: italic; }
.chat-input-row { display: flex; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border-subtle); }
.chat-input-row input { flex: 1; padding: 10px 12px; border: 1px solid var(--border-default); border-radius: var(--radius-md); }
