/* =========================================================
   Faceblatt Frontend – FINAL responsive CSS (stabil)
   - hell (auch in Android Chrome stabil)
   - schmal & zentriert (JETZT ~10% schmaler)
   - mobile-first
   - Selfie: exakt 1 Fenster (nur der Container mit >video + >canvas)
   - 4 Buttons nebeneinander (auch mobile)
========================================================= */

:root{
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: rgba(17,24,39,0.14);
  --shadow: 0 10px 24px rgba(17,24,39,0.10);
  --radius: 14px;

  --primary: #5b5cf6;
  --primary-2: #3bb5ff; /* sekundärer Ton für den Verlauf */

  /* Ganz wichtig: Browser-UI + native Controls auf "light" festnageln */
  color-scheme: light;
}

/* Auch hier (Chrome Android ist manchmal zickig) */
html{
  color-scheme: light;
}

/* ---------- Reset ---------- */

*{
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body{
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

/* Gegen "Auto Darkening" / Zwangsanpassungen (hilft oft in Chrome Android) */
html, body, .box, .card, form{
  forced-color-adjust: none;
}

/* ---------- Layout ---------- */

/* MOBILE FIRST: volle Breite */
.container,
main,
.main,
.content,
.wrap{
  width: 100%;
  margin: 0 auto;
  padding: 12px;
}

/* Ab Tablet/Desktop: schmal & zentriert (~10% schmaler) */
@media (min-width: 640px){
  .container,
  main,
  .main,
  .content,
  .wrap{
    max-width: 468px; /* vorher 520px */
  }
}

/* Hauptkarte (Formular) */
form,
.box,
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}

/* ---------- Typografie ---------- */

h1{
  font-size: 20px;
  margin: 0 0 6px;
}

p{
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.35;
}

label{
  display: block;
  margin: 7px 0 4px;
  font-size: 13px;
  color: #374151;
}

/* ---------- Inputs + Controls (hart stylen für Android Chrome) ---------- */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
textarea,
select,
button{
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
textarea,
select{
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border-radius: 12px;
  border: 1px solid rgba(17,24,39,0.18);
  background: #fff;
  color: var(--text);
}

input::placeholder,
textarea::placeholder{
  color: rgba(17,24,39,0.45);
}

input:focus,
textarea:focus,
select:focus{
  outline: none;
  border-color: rgba(91,92,246,0.65);
  box-shadow: 0 0 0 3px rgba(91,92,246,0.18);
}

textarea{
  min-height: 56px;
  resize: none;
}

/* =========================================================
   Selfie – präzise:
   NUR der Block, der direkt ein <video> UND ein <canvas> enthält.
   -> verhindert “2 Fenster”, leere Flächen, Fragmentierung
========================================================= */

/* Der echte Kamera-Block (nur wenn video+canvas direkte Kinder sind) */
form :is(div, section, fieldset):has(> video):has(> canvas){
  position: relative;
  display: grid;
  width: 100%;
  height: 140px;
  border-radius: 14px;
  background: #000;
  border: 1px solid rgba(17,24,39,0.14);
  overflow: hidden;
}

/* Video + Canvas liegen exakt übereinander */
form :is(div, section, fieldset):has(> video):has(> canvas) > video,
form :is(div, section, fieldset):has(> video):has(> canvas) > canvas{
  grid-area: 1 / 1;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

/* Video korrekt skalieren */
form :is(div, section, fieldset):has(> video):has(> canvas) > video{
  object-fit: contain !important;
  object-position: center center !important;
  background: #000 !important;
}

/* Canvas transparent (zeigt erst was, wenn gezeichnet wurde) */
form :is(div, section, fieldset):has(> video):has(> canvas) > canvas{
  background: transparent !important;
}

/* Mobile: kleiner */
@media (max-width: 420px){
  form :is(div, section, fieldset):has(> video):has(> canvas){
    height: 96px;
    border-radius: 12px;
  }
}

/* =========================================================
   Buttons: 4 nebeneinander als moderne Tiles
========================================================= */

/* Container mit Buttons (direkte Kinder) -> 4er Grid */
form :is(div, p, section):has(> button),
form :is(div, p, section):has(> input[type="submit"]){
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
}

/* Button Tiles (hart gestylt: verhindert "weiß auf weiß" in Android Chrome) */
form button,
form input[type="submit"],
form .btn{
  width: 100%;
  min-width: 0;
  padding: 9px 6px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.15;
  border-radius: 14px;

  /* WICHTIG: echter Hintergrund + echte Textfarbe */
  background-color: var(--primary);
  background-image: linear-gradient(135deg, rgba(91,92,246,1), rgba(59,181,255,1));
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;

  border: 0;
  box-shadow: 0 8px 18px rgba(17,24,39,0.10);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: normal;

  cursor: pointer;

  /* gegen Auto-Dark / forced colors */
  forced-color-adjust: none;
}

form button:active,
form input[type="submit"]:active{
  transform: translateY(1px);
}

/* Disabled klar sichtbar */
form button:disabled,
form input[type="submit"]:disabled{
  opacity: 0.55;
  filter: grayscale(0.15);
  cursor: not-allowed;
}

/* Mobile: kompakter, aber 4-spaltig bleibt */
@media (max-width: 420px){
  form :is(div, p, section):has(> button),
  form :is(div, p, section):has(> input[type="submit"]){
    gap: 6px;
  }

  form button,
  form input[type="submit"],
  form .btn{
    padding: 8px 5px;
    font-size: 11.5px;
    border-radius: 12px;
  }
}

/* ---------- Notices ---------- */

.ok{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(22,163,74,0.35);
  background: rgba(22,163,74,0.10);
  margin-top: 10px;
}

.error{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(220,38,38,0.30);
  background: rgba(220,38,38,0.08);
  margin-top: 10px;
}
