/* ============================================================================
   App shell layout — helles, klares Theme (Stripe-Stil)
   Desktop: fixed 220px sidebar links + scrollbarer Inhalt.
   Mobile:  Inhalt volle Breite + untere Navigation fixiert am Boden.
   ============================================================================ */

.app-shell {
  position: relative; z-index: 2;
  display: flex;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-second);
}

/* ── Zentrierung auf sehr breiten Bildschirmen (grosse Pult-Monitore) ───────
   Laptop- und normale Desktop-Groessen (bis ~1536px, z.B. MacBook) bleiben
   komplett unveraendert - die App fuellt dort wie bisher die volle Breite.
   Erst ab einer Breite, die ueber jeden ueblichen Laptop-Bildschirm
   hinausgeht, bekommt die App (Sidebar + Inhalt zusammen) eine maximale
   Breite und wird zentriert, statt einseitig links zu kleben. Nichts an
   der App selbst aendert sich, nur ihre Position im Viewport. */
@media (min-width: 1700px) {
  .app-shell { max-width: 1600px; margin: 0 auto; }
  .boot-skeleton { max-width: 1600px; margin: 0 auto; }
}

/* ── Boot-Skelett: sofort sichtbar, kein Warten auf JS/Netzwerk ─────────────
   Reine HTML/CSS-Silhouette der Home-Seite, verhindert die weisse Luecke
   beim Laden (Anti-Slop-Erkenntnis von YouTube uebernommen: nie eine leere
   Seite zeigen, immer schon die Form dessen, was gleich kommt). ── */
.boot-skeleton {
  position: fixed; inset: 0; z-index: 100;
  display: flex; background: var(--bg-main);
  transition: opacity 0.25s var(--ease-out), visibility 0.25s var(--ease-out);
}
.boot-skeleton.boot-skeleton-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

/* Inhalt des Boot-Skeletts (neues Design, 03.11.2026). Die Home-Teile im Skelett benutzen die
   echten Klassen aus home-neu.css (.hn-hero, .hn-cards, .hn-card, .hn-tiles ...), hier stehen nur
   Leiste, Rahmen und Abstaende von .content / .content-inner (Werte wie in home-neu.css). */
.boot-skeleton { overflow: hidden; }
.bsk-content { flex: 1; min-width: 0; height: 100%; overflow: hidden; box-sizing: border-box; padding: 20px 36px 90px 116px; }
.bsk-inner { max-width: 1290px; margin: 0 auto; }
.bsk-page { display: none; max-width: 860px; margin: 0 auto; }
.boot-skeleton.is-page .bsk-home { display: none; }
.boot-skeleton.is-page .bsk-page { display: block; }
.skel.bsk-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.skel.skel-tx.bsk-tx-big { height: .72em; margin-top: calc((1lh - .72em) / 2); border-radius: 12px; max-width: 100%; }
.bsk-m-only { display: none; }
.bsk-step { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.skel.bsk-bulb { width: 30px; height: 30px; border-radius: 50%; }
.skel.bsk-tile-ico { width: 30px; height: 30px; border-radius: 9px; }
.skel.hn-figure-skel { position: absolute; left: 22%; top: 20%; width: 58%; height: 52%; border-radius: 50%; opacity: .7; }
/* Naechster Schritt: Textspalte fuellt die Karte, damit die Skelett-Balken (in %) die echte Breite haben */
.hn-next .hn-next-body { flex: 1; }
.bsk-page .tool-head-icon { background: none; }
.bsk-page-card { padding: 18px 20px; }
.bsk-page-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--card-border); }
.bsk-page-row:last-child { border-bottom: none; }
.skel.bsk-page-ico { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; }
.bsk-page-lines { flex: 1; min-width: 0; line-height: 22px; }
/* schwebende Leiste links (wie .app-shell .sidebar eingeklappt) */
.bsk-rail {
  position: fixed; left: 16px; top: 76px; width: 66px; box-sizing: border-box; padding: 9px 8px; border-radius: 33px;
  display: flex; flex-direction: column; gap: 24px;
  background: var(--card-bg); border: 1px solid rgba(222, 210, 197, .65);
  box-shadow: 0 2px 6px rgba(112, 94, 78, .06), 0 22px 44px -18px rgba(112, 94, 78, .30);
}
.bsk-rail-item, .bsk-bnav-item { width: 48px; height: 48px; border-radius: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bsk-rail-item.is-active, .bsk-bnav-item.is-active { background: var(--bg-second); }
.bsk-rail-item .skel, .bsk-bnav-item .skel { width: 22px; height: 22px; border-radius: 7px; }
.bsk-rail-item.is-active .skel, .bsk-bnav-item.is-active .skel { background: var(--card-border); animation: none; }
.boot-skeleton.is-page .is-active { background: none; }
.boot-skeleton.is-page .is-active .skel { background: var(--bg-second); }
/* untere Leiste (Handy) */
.bsk-bnav {
  display: none; position: fixed; left: 16px; right: 16px; bottom: 14px; height: 64px; box-sizing: border-box; padding: 8px 12px;
  justify-content: space-between; align-items: center; border-radius: 24px;
  background: var(--card-bg); border: 1px solid rgba(222, 210, 197, .7);
  box-shadow: 0 2px 6px rgba(112, 94, 78, .06), 0 16px 36px -14px rgba(112, 94, 78, .32);
}
@media (max-width: 760px) {
  .bsk-content { padding: 14px 16px 160px; }
  .bsk-rail { display: none; }
  .bsk-bnav { display: flex; }
  .bsk-top.hn-top { margin-bottom: 8px; }
  .skel.bsk-avatar { width: 36px; height: 36px; }
  .bsk-m-only { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  .boot-skeleton { transition: none; }
}

/* ── Sidebar (desktop) ───────────────────────────────────────────────────────*/
.sidebar {
  width: 232px; border-right: 1px solid var(--card-border); flex-shrink: 0;
  background: var(--bg-second);
  border-right: 1px solid var(--card-border);
  display: flex; flex-direction: column;
  padding: 16px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 200ms var(--ease-out), padding 200ms var(--ease-out);
}
.sidebar-logo { display: flex; align-items: center; gap: 9px; padding: 4px 8px 10px; }
.sidebar-logo .logo-mark { width: 26px; height: 26px; font-size: 13px; object-fit: contain; }
.sidebar-logo .logo-word { font-size: 16.5px; }
.sidebar-sep { height: 1px; background: var(--card-border); margin: 4px 0 10px; }

.nav-section-label {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-faint); padding: 10px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-small);
  color: var(--text); font-size: 13.5px; cursor: pointer;
  border: 1px solid transparent; transition: all 120ms; margin-bottom: 1px;
  white-space: nowrap;
}
.nav-item:hover { color: var(--text); background: var(--card-bg); }
.nav-item.active {
  background: var(--gold-light);
  color: var(--gold-text);
  font-weight: 600;
  border-left: 3px solid var(--gold);
  padding-left: 7px;
}
.nav-item .nav-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-item .nav-icon svg { width: 17px; height: 17px; }
.nav-badge {
  margin-left: auto; background: rgba(76, 110, 245, 0.12); color: var(--gold-text);
  font-size: 10px; padding: 1px 7px; border-radius: var(--r-pill);
}
.nav-group { margin-bottom: 1px; margin-left: 19px; padding-left: 18px; border-left: 1px solid var(--card-border); }
.nav-group.hidden { display: none; }
.nav-subitem { padding-left: 8px; font-size: 13px; }

/* user card at the bottom of the sidebar */
.sidebar-user {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--r-button); background: var(--bg-second);
  position: relative; cursor: pointer; transition: background 150ms ease;
}
.sidebar-user:hover { background: var(--card-bg); }
.user-avatar {
  width: 32px; height: 32px; border-radius: var(--r-small); flex-shrink: 0;
  background: var(--gold);
  color: var(--gold-ink); font-weight: 700; font-family: var(--font-title);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.sidebar-user .u-name { font-size: 12.5px; font-weight: 500; }
.sidebar-user .u-plan { font-size: 10.5px; color: var(--text-muted); }
.user-menu-chevron { color: var(--text-faint); flex-shrink: 0; margin-left: auto; }

/* Dropdown öffnet sich NACH OBEN über der Karte (Karte sitzt unten in der Sidebar) */
.user-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0; right: 0;
  background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--r-card);
  box-shadow: 0 8px 24px rgba(20, 22, 43, .14);
  padding: 6px; z-index: 30;
}
.user-menu-head { padding: 10px 10px 8px; }
.user-menu-name { font-size: 13px; font-weight: 600; }
.user-menu-email { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-usage { font-size: 11px; color: var(--text-faint); margin-top: 3px; }
.user-menu-divider { height: 1px; background: var(--card-border); margin: 4px 0; }
.user-menu-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r-small);
  font-size: 13px; color: var(--text); cursor: pointer;
}
.user-menu-item svg { flex-shrink: 0; color: var(--text-muted); }
.user-menu-item:hover { background: var(--bg-second); }
.user-menu-item-danger { color: var(--red); }
.user-menu-item-danger svg { color: var(--red); }
.user-menu-item-danger:hover { background: rgba(220, 38, 38, 0.06); }

/* ── Main column ─────────────────────────────────────────────────────────────*/
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg-second); }

.page-location {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px;
}
.breadcrumb { font-size: 13px; color: var(--text-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb b { color: var(--text); font-weight: 500; }

/* content area: scrolls, ends where content ends */
.content {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 26px;
  padding-bottom: 90px; /* Platz für schwebende Elemente wie den Tracker-FAB */
  position: relative;
}
.content-inner { max-width: 860px; width: 100%; margin: 0 auto; box-sizing: border-box; }
/* Wie gewuenscht: NICHT nur beim Dashboard/Multicheck, sondern auf JEDER
   Seite passt sich der Inhaltsbereich an, wenn die Sidebar eingeklappt
   wird - nutzt den frei gewordenen Platz. Moderater als die Spezialfaelle
   unten (die brauchen mehr Breite fuer Raster), damit Textzeilen auf
   Chat-/Formular-Seiten nicht unangenehm breit werden. */
.app-shell:has(.sidebar.collapsed) .content-inner { max-width: 1040px; }

/* A (Korrekturauftrag 15.08.): Sidebar app-weit einklappbar, fuer fast
   Vollbild auf dem Desktop. Bewusst komplettes Ausblenden (nicht nur
   Icon-Modus), passend zu "annaehernd Vollbild". Zustand wird gemerkt. */
.sidebar-collapse-btn { margin-left:auto; background:none; border:none; color:var(--text-muted); cursor:pointer; padding:4px; border-radius:6px; display:flex; }
.sidebar-collapse-btn:hover { background:var(--card-bg); color:var(--text); }
.sidebar-expand-btn {
  position:fixed; top:18px; left:12px; z-index:50; background:var(--card-bg);
  border:1px solid var(--card-border); border-radius:8px; padding:8px; cursor:pointer;
  color:var(--text-muted); box-shadow:0 1px 2px rgba(24,24,27,0.06);
}
.sidebar-expand-btn:hover { color:var(--text); background:var(--bg-second); }
@media (max-width: 760px) { .sidebar-collapse-btn, .sidebar-expand-btn { display:none; } }

/* Punkt 8 (Multicheck-UX-Auftrag): auf grossen Monitoren wirkte die
   Uebungsflaeche im festen 860px-Rahmen zu klein, mit viel ungenutztem
   Raum daneben. Gezielt nur fuer die Multicheck-Ansicht mehr Breite und
   etwas groesserer Text - alle anderen Seiten bleiben unveraendert. */
.content-inner:has(#mc-shell-view:not(.hidden)) { max-width: 1040px; }
@media (min-width: 1440px) {
  .content-inner:has(#mc-shell-view:not(.hidden)) { max-width: 1160px; }
  .mc-shell-sheet { padding: 36px 56px; }
}
@media (min-width: 1800px) {
  .content-inner:has(#mc-shell-view:not(.hidden)) { max-width: 1360px; }
  .mc-shell-sheet { padding: 44px 72px; }
}

/* ── Bottom navigation: ENTFERNT (war nie sichtbar unter 760px, siehe unten) ──
   Navigation auf Mobile läuft komplett über die Hamburger-Drawer-Sidebar
   (siehe .sidebar unten) — exakt wie im Mockup: EIN Menü mit allen Bereichen,
   keine separate, reduzierte Bottom-Leiste. */

/* ── Hamburger-Button (nur mobil) ────────────────────────────────────────────*/
.topbar-hamburger {
  display: none; background: none; border: none;
  cursor: pointer; padding: 10px; border-radius: 8px;
  color: var(--text); transition: background 150ms;
}
.topbar-hamburger:hover { background: var(--bg-second); }
.topbar-hamburger svg { display: block; }

.bottom-nav {
  display: none;
  position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 150;
  border-radius: 28px;
  background: color-mix(in srgb, var(--card-bg) 72%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  border-top-color: color-mix(in srgb, var(--text) 16%, transparent);
  box-shadow: 0 8px 30px rgba(0,0,0,0.14);
  padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
  /* Mindestabstand zwischen den Beschriftungen, damit lange Woerter
     (FR/IT, schmale Handys um 360px) nicht aneinanderstossen */
  gap: 3px;
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; border-radius: 20px; cursor: pointer;
  color: var(--text-muted); font-size: 9.5px;
}
.bottom-nav-item svg { width: 18px; height: 18px; }
.bottom-nav-item.active { color: var(--gold-text); }

@media (prefers-reduced-transparency: reduce) {
  .bottom-nav { background: var(--card-bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* ── Overlay beim offenen Sidebar ────────────────────────────────────────────*/
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 199;
  background: rgba(15, 23, 42, 0.35);
  animation: overlayIn 200ms ease forwards;
}
.sidebar-overlay.visible { display: block; }
@keyframes overlayIn {
  from { opacity: 0; } to { opacity: 1; }
}

/* ── Responsive switch ───────────────────────────────────────────────────────*/
@media (max-width: 760px) {
  /* Sidebar: normalerweise versteckt, als Drawer einblenden (ueber die
     'Mehr'-Kachel der Bottom-Nav, siehe .bottom-nav unten) */
  .sidebar {
    display: flex !important;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
    transform: translateX(-100%);
    transition: transform 220ms ease-out;
    width: 260px; box-shadow: 4px 0 24px rgba(15, 23, 42, 0.12);
  }
  .sidebar.open { transform: translateX(0); }

  .bottom-nav { display: flex; }
  .content { padding-bottom: 78px; }

  .content { padding: 16px; padding-bottom: 32px; }

  /* Entfernt den klassischen 300ms-Tap-Verzoegerungs-Bug mobiler Browser —
     der Hauptgrund, warum Antippen "laggy" wirkt. Weitere Mobile-Aufraeum-
     Regeln (Bounce-Animationen abschalten etc.) stehen am Ende von
     components.css, weil diese Datei als letzte laedt und sonst wieder
     ueberschrieben wuerde. */
  html, body { touch-action: manipulation; }
  button, .btn, .tile, .chip, .nav-item, .stat-card, a, [onclick] {
    -webkit-tap-highlight-color: transparent;
  }
}

/* ── Pages inside the app (one visible at a time) ────────────────────────────*/
.page { display: none; width: 100%; box-sizing: border-box; }
.page.active { display: block; width: 100%; box-sizing: border-box; animation: pageIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ===== Coach-Gespräch ===== */
.coach-history { max-height: 400px; overflow-y: auto; margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; padding: 2px; }

/* Fertiger Text pro Block */
.coach-final { margin-top: 14px; padding: 14px; border-radius: var(--r-card); background: rgba(22,163,74,0.05); border: 1px solid rgba(22,163,74,0.2); animation: completeRing 0.7s ease; }
@keyframes completeRing {
  0% { box-shadow: 0 0 0 0 rgba(22,163,74,0.18); }
  100% { box-shadow: 0 0 0 14px rgba(22,163,74,0); }
}
.coach-final-check {
  display: inline-flex; width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  background: var(--green); color: #fff; align-items: center; justify-content: center;
  margin-right: 6px; transform: scale(0); animation: checkPop 0.35s 0.12s cubic-bezier(.34,1.56,.64,1) forwards;
}
.coach-final-check svg { width: 10px; height: 10px; }
@keyframes checkPop { to { transform: scale(1); } }
.coach-final-label { font-size: 12px; color: var(--green); font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; }
.coach-final-text { font-size: 14px; line-height: 1.6; }

/* Kombinierter Text unten */
.coach-combined { padding: 16px; border-radius: var(--r-card); background: var(--bg-second); border: 1px solid var(--card-border); }
.coach-combined p { margin-bottom: 10px; line-height: 1.6; }
.coach-combined p:last-child { margin-bottom: 0; }

/* ===== Interview Sprach-Modus ===== */
.btn-recording { background: var(--red) !important; color: white !important; animation: pulse-rec 1.2s infinite; }
@keyframes pulse-rec { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }

/* Redesign Etappe 5: Ort-Zeile (Stellio / Home + Avatar) nur auf Home weg (Wegnahme a) */
.content-inner:has(#page-dashboard.active) > .page-location { display: none; }
@media (max-width: 760px) { .content-inner:has(#page-dashboard.active) > .page-location { display: flex; } .content-inner:has(#page-dashboard.active) > .page-location .breadcrumb, .content-inner:has(#page-dashboard.active) > .page-location .topbar-avatar { visibility: hidden; } }

/* Schneller Start (lazy.js): Seite wartet auf ihre Skripte -> nur das Skelett zeigen */
.page > .lazy-skel { display: none; }
.page.lazy-wait > .lazy-skel { display: block; padding-top: 8px; }
.page.lazy-wait > :not(.lazy-skel) { display: none !important; }
