/* ---------- Global / Base styles ---------- */
:root{
  --accent: #8c38d1;
  --bg-dark: #070707;
  --panel-dark: #0f0b12;
  --muted: #9b95a8;
  --shadow: rgba(0,0,0,0.6);
  --top-offset: 92px;
}

/* Base */
* { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', sans-serif;
  margin: 0;
  padding: 0;
  color: #e5e5e5;
  text-align: center;
  overflow-x: hidden;

  /* Hintergrund */
  background: radial-gradient(circle at 30% 30%, rgba(111,59,230,0.15) 0%, transparent 40%),
              radial-gradient(circle at 70% 70%, rgba(159,122,234,0.12) 0%, transparent 40%),
              #0a0a0a; /* Grundton fast schwarz */
  background-attachment: fixed;
  background-size: cover;
}

.top-bar {
  background-color: #1a1a1a;
  padding: 15px 30px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.branding { display:flex; align-items:center; }
.logo { height: 40px; margin-right: 10px; }
.beta-text { font-size:1.2em; color:#a855f7; }

.container {
  max-width: 600px;
  margin: 40px auto;
  background: #1f1f1f;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(168,85,247,0.3);
}

h1 { font-size:2.5em; margin-bottom:10px; }
.subtitle { color:#b3b3b3; margin-bottom:30px; }

form label { display:block; text-align:left; margin-top:20px; font-weight:700; color:#ccc; }
form input, form select {
  width:100%; padding:12px; margin-top:8px; border-radius:10px; border:1px solid #444;
  font-size:1em; background:#2a2a2a; color:#f0f0f0;
}

.generate-btn {
  margin-top:25px; padding:14px 30px; background:#a855f7; color:#fff; font-size:1.1em;
  border:none; border-radius:12px; cursor:pointer; transition:background .3s ease;
}
.generate-btn:hover { background:#9333ea; }

#loadingScreen { margin-top:40px; }
.thinking-text { font-size:1.3em; margin-bottom:10px; }
.thinking-note { font-size:1em; color:#aaa; }

.result-box { margin-top:40px; padding:25px; background:#2a2a2a; border:2px solid #444; border-radius:15px; font-size:1.1em; color:#e0e0e0; }
.error-box { margin-top:20px; padding:15px; border:1px solid #ff4d4f; background:#3a1a1a; color:#ffb3b3; border-radius:6px; }

footer { margin-top:40px; font-size:0.9em; display:flex; flex-direction:column; gap:10px; color:#999; }
footer a { color:#a855f7; text-decoration:none; transition: color .2s ease; }
footer a:hover { color:#c084fc; }

/* small helpers */
.hidden { display:none !important; }

/* ---------- Desktop Sidebar ---------- */
.slim-sidebar {
  position: fixed;
  left: 14px;
  top: var(--top-offset);
  z-index: 1400;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  background: transparent;
  pointer-events: auto;
}

.slim-sidebar .nav-item[href="/pricing"],
.slim-sidebar .nav-item[aria-current="page"][href="/pricing"] {
  position: relative; /* needed for the pseudo indicator */
  color: #fff;
  background: linear-gradient(180deg, rgba(168,85,247,0.12), rgba(168,85,247,0.06));
  border-color: rgba(168,85,247,0.14);
  box-shadow: 0 10px 30px rgba(168,85,247,0.10), 0 2px 6px rgba(0,0,0,0.45);
  transform: translateY(-3px);
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
  outline: none;
}

/* subtle pulse / glow behind the item (non-intrusive) */
.slim-sidebar .nav-item[href="/pricing"]::after,
.slim-sidebar .nav-item[aria-current="page"][href="/pricing"]::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff7ff 0%, #ffdbe8 25%, rgba(168,85,247,0.95) 60%);
  box-shadow: 0 8px 22px rgba(168,85,247,0.16);
  pointer-events: none;
}

.slim-nav { display:flex; flex-direction:column; gap:8px; margin-top:6px; align-items:center; }
.nav-item {
  width:48px; height:48px; border-radius:10px; display:inline-flex; align-items:center; justify-content:center;
  text-decoration:none; color:var(--accent); background:rgba(255,255,255,0.02);
  transition: transform .12s ease, background .12s ease; position:relative;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}
.icon { width:20px; height:20px; stroke:var(--accent); stroke-width:1.6; fill:none; }

.nav-item .label {
  position:absolute; left:62px; white-space:nowrap; background:linear-gradient(180deg, rgba(20,12,26,0.98), rgba(28,12,40,0.95));
  color:#fff; padding:8px 10px; border-radius:8px; box-shadow:0 10px 30px rgba(0,0,0,0.6);
  transform-origin:left center; transform:translateX(-6px) scale(.96); opacity:0;
  transition: opacity .16s ease, transform .16s ease; font-weight:600; font-size:14px;
}
.nav-item:hover { transform: translateY(-4px); }
.nav-item:hover .label { opacity:1; transform:translateX(0) scale(1); }

.nav-item.active {
  background: linear-gradient(180deg, rgba(140,56,209,0.12), rgba(255,255,255,0.02));
  color:#fff; transform: translateY(-2px); box-shadow: 0 10px 28px rgba(12,6,20,0.6);
}
.nav-item.active .label { opacity:1; transform: translateX(0) scale(1); }

/* Desktop panel */
.panel {
  position: fixed; left:0; top:0; height:100vh; width:320px; max-width:86vw;
  background: linear-gradient(180deg, var(--panel-dark), #1a0d26);
  box-shadow: 10px 0 42px rgba(0,0,0,0.6);
  transform: translateX(-110%); transition: transform 320ms cubic-bezier(.2,.9,.2,1); z-index:1350;
  display:flex; flex-direction:column; padding:18px; gap:12px; color:#e9e7ee;
}
.panel.open { transform: translateX(0); }

.hh-google-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  margin-right: 8px;
  vertical-align: middle;
  opacity: 0.95;
  filter: grayscale(30%) contrast(0.95);
  display: inline-block;
}

/* --- temporary label reveal for mobile taps --- */
/* label initially hidden on small screens (your existing rule) */
@media (max-width: 980px) {
  .slim-sidebar .nav-item .label {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity .22s ease;
  }
  /* when we add this class via JS, show it briefly */
  .slim-sidebar .nav-item.hh-show-label .label {
    display: inline-block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    background: rgba(0,0,0,0.6);
    padding: 4px 8px;
    border-radius: 8px;
    white-space: nowrap;
    transform-origin: right center;
  }
}
@media (min-width: 981px) {
  .panel.open ~ .container { margin-left: 320px; }
}

/* ---------- MOBILE: Sidebar rechts ---------- */
@media (max-width: 980px) {
  body { padding:10px; }
  .container { padding:10px; width:100%; box-sizing:border-box; }
  .top-bar { flex-direction:column; align-items:center; text-align:center; }
  .logo { width:60px; height:auto; margin-bottom:5px; }
  .generate-btn { width:100%; padding:12px; font-size:1em; }
  input[type="text"], input[type="email"], select { width:100%; box-sizing:border-box; font-size:1em; padding:10px; }
  .result-box, .error-box { font-size:1em; padding:10px; word-break:break-word; }
  footer { flex-direction:column; align-items:flex-start; gap:5px; }

  /* Sidebar rechts statt unten */
  .slim-sidebar {
    left: auto;
    right: 10px;
    top: var(--top-offset);
    bottom: auto;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
    padding: 4px;
    height: auto;
  }

  .slim-sidebar::before { display:none; }
  .nav-item { width:48px; height:48px; border-radius:10px; }

  .panel, .panel.open {
    display:none !important;
  }
}

/* =========== Mobile-specific fixes (paste at EOF) =========== */
/* Ziel: verhindern, dass Elemente auf kleinen Bildschirmen aus dem Viewport ragen */

@media (max-width: 980px) {
  /* Grundlegendes: kein horizontales Scrollen */
  html, body { overflow-x: hidden !important; width: 100% !important; }

  /* Container safe-box: volle Breite innerhalb Padding */
  .container,
  .page-wrap,
  main, section,
  .center-ui.card-surface {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Controls / Grid: zwinge 1-Spalten-Layout und erlaube Kindern zu schrumpfen */
  .controls {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    width: 100% !important;
  }
  /* sehr wichtig: Grid-Kinder dürfen schrumpfen (verhindert Overflow) */
  .controls > * { min-width: 0 !important; }

  /* Form controls: maximal 100% und kein Zwang zu größerer Breite */
  input, textarea, select, .format, .prompt, textarea.prompt, select.format {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* Center card: weniger Padding auf kleinen Geräten */
  .center-ui.card-surface {
    padding: 12px !important;
    border-radius: 10px !important;
  }

  /* Sidebar: sichere, nicht-offcanvas Position (rechts), verhindert Content-Verschiebung */
  .slim-sidebar {
    left: auto !important;
    right: 10px !important;
    top: calc(var(--top-offset,72px) + 6px) !important;
    width: 64px !important;
    max-width: 64px !important;
    pointer-events: auto !important;
    transform: none !important;
    box-shadow: none !important;
  }
  /* Wenn Sidebar offen, lass sie über dem Content, aber mit sicheren Breiten */
  body.mobile-sidebar-open .slim-sidebar {
    right: 12px !important;
    left: auto !important;
    width: min(72vw, 300px) !important;
    max-width: 72vw !important;
    pointer-events: auto !important;
  }

  /* Mobile backdrop z-index so the sidebar remains interactable */
  .mobile-sidebar-backdrop { z-index: 1720 !important; }

  /* Medien/Thumbnails skalieren korrekt */
  img, video { max-width: 100% !important; height: auto !important; }

  /* Top bar Abstand sichern (verhindert dass Header Content überlappt) */
  body { padding-top: calc(var(--top-offset,72px) + 6px) !important; }
}

/* noch kleinere Geräte: zusätzliche Feinjustierung */
@media (max-width: 420px) {
  .center-ui.card-surface { padding: 10px !important; }
  .generate, .generate-btn { width: 100% !important; }
  .prompt { min-height: 120px !important; }
}
