/* =================================================================
   KI-Kompetenz-Nachweis — Design System
   Strikt nach CI-Master 2026. Navy/Sand/Off-White/Slate als Basis,
   Orange nur für Action, Sage sehr sparsam.

   THEME: Standard ist der dunkle Modus (Navy). Der frühere helle
   Modus ("Leitmode") ist über <body class="theme-light"> vollständig
   wiederherstellbar und liegt zusätzlich als styles.light-backup.css.
   Umschalten global: in views/head.php $bodyClass = 'theme-light'.
   ================================================================= */

/* --- Selbstgehostete Schriften (DSGVO: kein Google-Fonts-CDN; woff2, Latin-Subset) --- */
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/lato-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/lato-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Lato'; font-style: italic; font-weight: 400; font-display: swap; src: url(../fonts/lato-400-italic.woff2) format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 600 700; font-display: swap; src: url(../fonts/montserrat.woff2) format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-style: italic; font-weight: 500 600; font-display: swap; src: url(../fonts/playfair-italic.woff2) format('woff2'); }

:root {
  /* Brand-Farben (verbindlich, in beiden Themes gleich) */
  --navy:      #1A2537;
  --sand:      #D9CFC3;
  --offwhite:  #F5F5F5;
  --orange:    #C7742B;
  --sage:      #AAB7A6;
  --white:     #FFFFFF;
  --orange-dk: #b0631f;
  --sand-40:   rgba(217, 207, 195, 0.40);
  --sage-15:   rgba(170, 183, 166, 0.18);

  /* --- Semantische Tokens: DUNKEL (Standard) --- */
  --bg:            #0F1826;   /* Seitenhintergrund */
  --surface:       #1A2536;   /* Karten, Formulare, Tabellen */
  --surface-2:     #131D2C;   /* Eingabefelder, Antwort-Optionen */
  --surface-hover: #23324A;   /* Hover/aktiv auf Flächen */
  --text:          rgba(226, 232, 240, 0.72);  /* Fließtext */
  --text-strong:   #F1F4F8;   /* Überschriften, betont */
  --slate:         rgba(226, 232, 240, 0.60);  /* sekundär/gedämpft */
  --border:        rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.17);
  --link:          #D9CFC3;   /* Textlinks (Sand), Hover Orange */
  --band:          rgba(255, 255, 255, 0.035); /* section--sand */
  --panel:         #0C1421;   /* section--navy, Admin-Sidebar */
  --footer-bg:     #080F19;
  --header-bg:     rgba(15, 24, 38, 0.86);
  --ring:          rgba(255, 255, 255, 0.5);   /* konzentrische Kreise */
  --rule-color:    #FFFFFF;                     /* Horizon-Line */
  --navy-06:       rgba(255, 255, 255, 0.07);   /* feine Tracks/Ränder */
  --navy-12:       rgba(255, 255, 255, 0.14);

  /* Typografie */
  --font-head: 'Montserrat', 'Segoe UI', sans-serif;
  --font-body: 'Lato', 'Segoe UI', sans-serif;
  --font-accent: 'Playfair Display', Georgia, serif;

  /* Maße */
  --maxw: 1080px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.28);
}

/* --- Semantische Tokens: HELL (Leitmode, Fallback) --- */
body.theme-light {
  --bg:            #F5F5F5;
  --surface:       #FFFFFF;
  --surface-2:     #F5F5F5;
  --surface-hover: #FFFFFF;
  --text:          #5C5E60;
  --text-strong:   #1A2537;
  --slate:         #5C5E60;
  --border:        rgba(26, 37, 55, 0.06);
  --border-strong: rgba(26, 37, 55, 0.12);
  --link:          #1A2537;
  --band:          rgba(217, 207, 195, 0.40);
  --panel:         #1A2537;
  --footer-bg:     #1A2537;
  --header-bg:     rgba(245, 245, 245, 0.92);
  --ring:          #1A2537;
  --rule-color:    #1A2537;
  --navy-06:       rgba(26, 37, 55, 0.06);
  --navy-12:       rgba(26, 37, 55, 0.12);
  --shadow:        0 14px 40px rgba(26, 37, 55, 0.10);
  --shadow-sm:     0 4px 16px rgba(26, 37, 55, 0.08);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--orange); }

/* --- Typografie --- */
h1, h2, h3, h4 {
  font-family: var(--font-head); color: var(--text-strong); line-height: 1.22; margin: 0 0 0.5em; font-weight: 700;
  /* Lange deutsche Woerter bei Bedarf umbrechen, aber KEINE Silbentrennung normaler Woerter
     (kein "Dan-ke"/"ver-stehst"). overflow-wrap bricht zu lange Woerter notfalls ohne Trennstrich. */
  overflow-wrap: break-word;
  -webkit-hyphens: none;
  hyphens: none;
}
h1 { font-size: clamp(1.55rem, 6.5vw, 3.25rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 4.5vw, 2.3rem); font-weight: 600; }
h3 { font-size: clamp(1.2rem, 2.2vw, 1.45rem); font-weight: 600; }
p { margin: 0 0 1.1em; }
.lead { font-size: 1.18rem; color: var(--slate); }
strong { color: var(--text-strong); font-weight: 700; }

/* Akzentschrift, sehr sparsam, max 1 Zeile pro Section */
.accent {
  font-family: var(--font-accent);
  font-style: italic;
  color: var(--orange);
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
}

.kicker {
  font-family: var(--font-head);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate);
}

/* --- Layout --- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: clamp(48px, 8vw, 96px) 0; }
.section--sand { background: var(--band); }
.section--navy { background: var(--panel); color: rgba(255,255,255,0.86); }
.section--navy h1, .section--navy h2, .section--navy h3 { color: var(--white); }
.narrow { max-width: 720px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }

/* Horizon-Line (CI-Element) */
.horizon { height: 1px; background: var(--rule-color); opacity: 0.18; border: 0; margin: 0; }

/* --- Orange Dot (Signature-Mikroelement, nur vor Action) --- */
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--orange);
  margin-right: 0.6em;
  vertical-align: middle;
  flex: 0 0 auto;
}

/* --- Konzentrische Kreise (Hero-Markenzeichen) --- */
.rings { position: relative; width: 220px; height: 220px; }
.rings span { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); border: 1.5px solid var(--ring); border-radius: 50%; opacity: 0.55; }
.rings .r1 { width: 220px; height: 220px; opacity: 0.25; }
.rings .r2 { width: 158px; height: 158px; opacity: 0.4; }
.rings .r3 { width: 96px; height: 96px; opacity: 0.6; }
.rings .core { width: 14px; height: 14px; background: var(--orange); border: 0; opacity: 1; animation: pulse 3.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.35); } }
.section--navy .rings span { border-color: rgba(255,255,255,0.6); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 0.55em;
  font-family: var(--font-head); font-weight: 600; font-size: 1rem;
  padding: 14px 26px; border-radius: var(--radius);
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--orange); color: var(--white); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--orange-dk); color: var(--white); }
.btn--ghost { background: transparent; color: var(--text-strong); border-color: var(--border-strong); }
.btn--ghost:hover { border-color: var(--orange); color: var(--orange); }
.btn--block { width: 100%; justify-content: center; }
.btn .dot { margin: 0; }
.section--navy .btn--ghost { color: var(--white); border-color: rgba(255,255,255,0.3); }

/* --- Header / Nav --- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg); backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 0.6em; font-family: var(--font-head); font-weight: 700; color: var(--text-strong); }
.brand .mark { width: 26px; height: 26px; position: relative; }
.brand .mark span { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); border: 1.4px solid var(--ring); border-radius: 50%; }
.brand .mark .o1 { width: 26px; height: 26px; }
.brand .mark .o2 { width: 14px; height: 14px; }
.brand .mark .oc { width: 6px; height: 6px; background: var(--orange); border: 0; }
.nav-links { display: flex; align-items: center; gap: 1.6em; }
.nav-links a { font-family: var(--font-head); font-size: 0.95rem; color: var(--slate); }
.nav-links a:hover { color: var(--orange); }

/* --- Hero --- */
.hero { padding: clamp(40px, 7vw, 88px) 0 clamp(32px, 5vw, 64px); }
.hero-grid { display: grid; grid-template-columns: 1.5fr 0.5fr; gap: 40px; align-items: center; }
/* Hero-Headline nicht mit Silbentrennung brechen (kein "ver-stehst"). */
.hero h1 { margin-top: 0.4em; -webkit-hyphens: none; hyphens: none; }
.hero .accent { display: block; margin: 0.3em 0 0.8em; }
.hero-visual { display: flex; justify-content: center; }
/* Ring-Markenzeichen im Hero etwas kleiner, damit die Textspalte mehr Platz hat. */
.hero-visual .rings { transform: scale(0.72); transform-origin: center; }

/* --- Cards / Steps --- */
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-sm);
}
.card h3 { margin-bottom: 0.4em; }
.card .num { font-family: var(--font-head); font-weight: 700; color: var(--orange); font-size: 1.1rem; }
.step { display: flex; gap: 16px; align-items: flex-start; }
.step .idx {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; color: var(--text-strong); font-size: 0.95rem;
}

/* --- Honest-Frame Box (Sage, sparsam) --- */
.note {
  background: var(--sage-15); border: 1px solid var(--sage);
  border-radius: var(--radius); padding: 22px 24px; color: var(--text-strong);
}
.note h3 { margin-top: 0; }
.note p:last-child { margin-bottom: 0; }

/* --- Listen mit Dot --- */
.dot-list { list-style: none; padding: 0; margin: 0; }
.dot-list li { display: flex; align-items: baseline; gap: 0.6em; padding: 7px 0; }
.dot-list li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex: 0 0 auto; transform: translateY(3px); }

/* --- Formulare --- */
.form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(24px, 4vw, 40px); box-shadow: var(--shadow); }
.field { margin-bottom: 18px; }
.field label { display: block; font-family: var(--font-head); font-weight: 600; font-size: 0.92rem; color: var(--text-strong); margin-bottom: 6px; }
.field input[type=text], .field input[type=email], .field input[type=password] {
  width: 100%; padding: 13px 15px; font-family: var(--font-body); font-size: 1rem;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text-strong);
  transition: border-color 0.15s ease;
}
.field input::placeholder { color: var(--slate); }
.field input:focus { outline: none; border-color: var(--orange); background: var(--surface); }
.checkbox { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; font-size: 0.95rem; }
.checkbox input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--orange); flex: 0 0 auto; }
.checkbox label { font-family: var(--font-body); color: var(--slate); font-weight: 400; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.hint { font-size: 0.85rem; color: var(--slate); margin-top: 6px; }
.hint a { color: var(--orange); }

/* --- Alerts --- */
.alert { border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; font-size: 0.95rem; border: 1px solid transparent; }
.alert--error { background: rgba(201,72,72,0.15); border-color: rgba(201,72,72,0.45); color: #f0b6b6; }
.alert--ok { background: rgba(170,183,166,0.15); border-color: rgba(170,183,166,0.5); color: #cfe0d0; }
.alert--info { background: var(--navy-06); border-color: var(--border); color: var(--text-strong); }
body.theme-light .alert--error { background: #fdecec; border-color: #e7b7b7; color: #8a2b2b; }
body.theme-light .alert--ok { background: rgba(170,183,166,0.18); border-color: var(--sage); color: #2f5034; }
body.theme-light .alert--info { background: rgba(26,37,55,0.06); border-color: rgba(26,37,55,0.12); color: #1A2537; }
.hidden { display: none !important; }

/* --- Footer --- */
.site-footer { background: var(--footer-bg); color: rgba(255,255,255,0.7); padding: 48px 0 32px; font-size: 0.92rem; }
.site-footer a { color: rgba(255,255,255,0.82); }
.site-footer a:hover { color: var(--orange); }
.footer-grid { display: flex; flex-wrap: wrap; gap: 28px; justify-content: space-between; align-items: flex-start; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-claim { font-family: var(--font-accent); font-style: italic; color: rgba(255,255,255,0.85); }

/* =================================================================
   Test-Anwendung
   ================================================================= */
.testbox { max-width: 760px; margin: 0 auto; }
.progress { height: 6px; background: var(--navy-06); border-radius: 99px; overflow: hidden; margin: 18px 0 28px; }
.progress > span { display: block; height: 100%; background: var(--orange); width: 0; transition: width 0.3s ease; }
.q-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(22px, 4vw, 36px); box-shadow: var(--shadow-sm); }
.q-cat { font-family: var(--font-head); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange); margin-bottom: 10px; }
.q-text { font-family: var(--font-head); font-weight: 600; font-size: 1.25rem; color: var(--text-strong); margin-bottom: 22px; line-height: 1.4; }
.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius); cursor: pointer;
  background: var(--surface-2); transition: border-color 0.12s ease, background 0.12s ease;
}
.option:hover { border-color: var(--sage); background: var(--surface-hover); }
.option input { margin-top: 3px; accent-color: var(--orange); width: 18px; height: 18px; flex: 0 0 auto; }
.option.selected { border-color: var(--orange); background: var(--surface-hover); }
.option .otext { color: var(--text-strong); }
.test-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 26px; gap: 16px; }

/* Ergebnis */
.result-hero { text-align: center; padding: 24px 0; }
.score-ring { width: 132px; height: 132px; margin: 0 auto 18px; position: relative; display: flex; align-items: center; justify-content: center; }
.score-ring .val { font-family: var(--font-head); font-weight: 700; font-size: 2rem; color: var(--text-strong); }
.topics { margin-top: 18px; }

/* =================================================================
   Admin-Dashboard
   ================================================================= */
.admin-shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.admin-side { background: var(--panel); color: rgba(255,255,255,0.8); padding: 26px 20px; }
.admin-side .brand { color: var(--white); margin-bottom: 28px; }
.admin-side .brand .mark span { border-color: rgba(255,255,255,0.85); }
.admin-side nav a { display: block; color: rgba(255,255,255,0.78); padding: 10px 12px; border-radius: 8px; font-family: var(--font-head); font-size: 0.95rem; margin-bottom: 4px; }
.admin-side nav a:hover, .admin-side nav a.active { background: rgba(255,255,255,0.08); color: var(--white); }
.admin-main { padding: 32px clamp(20px, 4vw, 44px); background: var(--bg); }
.admin-main h1 { font-size: 1.8rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 18px; margin: 22px 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.stat .big { font-family: var(--font-head); font-weight: 700; font-size: 2rem; color: var(--text-strong); }
.stat .lbl { font-size: 0.85rem; color: var(--slate); text-transform: uppercase; letter-spacing: 0.06em; }
.stat .sub { font-size: 0.85rem; color: var(--orange); margin-top: 4px; }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
table.data th { font-family: var(--font-head); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate); background: var(--navy-06); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 0.76rem; font-family: var(--font-head); font-weight: 600; }
.badge--registriert { background: rgba(255,255,255,0.08); color: var(--slate); }
.badge--bestaetigt { background: rgba(90,140,200,0.20); color: #a9c5ea; }
.badge--aktiv { background: rgba(217,207,195,0.18); color: var(--sand); }
.badge--bestanden { background: rgba(170,183,166,0.20); color: #bcd3bd; }
.badge--stillgelegt { background: rgba(199,116,43,0.20); color: #e2a468; }
body.theme-light .badge--registriert { background: rgba(26,37,55,0.06); color: #5C5E60; }
body.theme-light .badge--bestaetigt { background: #e8eef5; color: #2c4a73; }
body.theme-light .badge--aktiv { background: rgba(217,207,195,0.40); color: #1A2537; }
body.theme-light .badge--bestanden { background: rgba(170,183,166,0.18); color: #2f5034; }
body.theme-light .badge--stillgelegt { background: #efe6dd; color: #b0631f; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; margin-top: 10px; }
.bars .bar { flex: 1; background: var(--orange); border-radius: 3px 3px 0 0; min-height: 2px; opacity: 0.85; }

/* Seitenaufrufe/Besucher pro Tag: Zahlen oben, zweifarbiger Balken (hell = Aufrufe, orange = Besucher). */
.day-chart { display: flex; align-items: flex-end; gap: 4px; }
.day-col { flex: 1; min-width: 0; text-align: center; }
.day-n { font-size: 0.68rem; color: var(--text-strong); line-height: 1.2; margin-bottom: 4px; }
.day-n .day-v { display: block; font-size: 0.6rem; color: var(--orange); }
.day-bar-wrap { position: relative; height: 90px; }
.day-bar-wrap .pv, .day-bar-wrap .vis { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 3px 3px 0 0; min-height: 2px; }
.day-bar-wrap .pv { background: var(--border-strong); }
.day-bar-wrap .vis { background: var(--orange); }

/* Ergebnis-Verteilung: schmales, horizontales Histogramm in 10%-Stufen. */
.dist-chart { display: flex; align-items: flex-end; gap: 6px; }
.dist-col { flex: 1; min-width: 0; text-align: center; }
.dist-n { font-size: 0.72rem; color: var(--text-strong); margin-bottom: 4px; min-height: 1em; line-height: 1.2; }
.dist-n .dist-p { display: block; font-size: 0.6rem; color: var(--slate); }
.dist-bar-wrap { height: 90px; display: flex; align-items: flex-end; }
.dist-bar { width: 100%; background: var(--orange); border-radius: 3px 3px 0 0; min-height: 2px; }
.dist-lbl { font-size: 0.68rem; color: var(--slate); margin-top: 5px; white-space: nowrap; }

/* Affiliate-Verlauf: helle Balken = Aufrufe, orange = Klicks (ueberlagert). */
.aff-chart { display: flex; align-items: flex-end; gap: 2px; height: 72px; margin-top: 10px; }
.aff-day { position: relative; flex: 1; height: 100%; min-width: 3px; }
.aff-day .v, .aff-day .c { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 2px 2px 0 0; }
.aff-day .v { background: var(--border-strong); }
.aff-day .c { background: var(--orange); }

/* --- Login-Karten --- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; }

/* =================================================================
   Responsive
   ================================================================= */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 16px; }
  .hero-visual { order: -1; }
  /* Ringe mobil kompakter, damit Headline, Button und Microcopy ohne Scrollen sichtbar sind.
     transform aendert die Layout-Box nicht, daher negative Margins zum Ausgleich. */
  .hero-visual .rings { transform: scale(0.5); margin: -50px 0; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .admin-side .brand { margin-bottom: 0; margin-right: auto; }
  .admin-side nav { display: flex; gap: 4px; }
}
