/* Ortho-Aktiv BestellApp – Mobile-First */

:root {
  --blue: #0C4DA2;
  --blue-dark: #093c7e;
  --blue-light: #e8f0fb;
  --ink: #152238;
  --ink-soft: #415572;
  --muted: #6b7a90;
  --line: #d9e2ef;
  --bg: #f2f5fa;
  --card: #ffffff;
  --error: #b3261e;
  --error-bg: #fdeceb;
  --success: #1e7f43;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(21, 34, 56, .08), 0 4px 16px rgba(21, 34, 56, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--blue);
  color: #fff;
}
.app-logo { width: 40px; height: 40px; border-radius: 9px; }
.app-title { flex: 1; min-width: 0; }
.app-title h1 { margin: 0; font-size: 1.05rem; line-height: 1.25; }
.app-subtitle { margin: 0; font-size: .8rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  background: rgba(255,255,255,.14);
  border: 0; color: #fff; font-size: 1.3rem;
  width: 44px; height: 44px; border-radius: 12px; cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,.28); }

/* ===== Layout ===== */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 12px calc(24px + env(safe-area-inset-bottom));
}
.view { display: block; }
.hidden { display: none !important; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 16px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 8px; font-size: 1.15rem; color: var(--blue); }
.card h3 { margin: 20px 0 8px; font-size: .95rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.lead { margin: 0 0 16px; color: var(--ink-soft); font-size: .95rem; }
.note { color: var(--muted); font-size: .85rem; margin: 10px 0 0; }
.center { text-align: center; }

.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.step-head h2 { margin: 0; }
.step-num {
  flex: 0 0 auto;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: .95rem;
}

/* ===== Formulare ===== */
.field { display: block; margin-bottom: 14px; }
.field > span, .field-label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 5px; color: var(--ink-soft); }
.field em { font-weight: 400; color: var(--muted); font-style: normal; }

input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px 12px;
  min-height: 48px;
}
textarea { resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(12, 77, 162, .15);
}

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 480px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--blue); }
.check span { font-size: .92rem; }
.check em { color: var(--muted); font-style: normal; font-size: .85rem; }

/* ===== Buttons ===== */
.btn {
  font: inherit; font-weight: 600;
  border: 0; border-radius: 12px;
  padding: 13px 18px; min-height: 50px;
  cursor: pointer;
  transition: filter .15s;
}
.btn:active { filter: brightness(.92); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-secondary { background: var(--blue-light); color: var(--blue); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost-light { background: rgba(255,255,255,.15); color: #fff; border-radius: 10px; }
.btn-block { display: block; width: 100%; }
.btn-big { font-size: 1.08rem; min-height: 58px; }
.btn-row { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
@media (min-width: 480px) { .btn-row { flex-direction: row; } }

/* ===== Meldungen ===== */
.msg { border-radius: 10px; padding: 10px 12px; font-size: .92rem; margin: 10px 0; }
.msg-error { background: var(--error-bg); color: var(--error); }
.msg-success { background: #e7f5ec; color: var(--success); }

/* Honeypot: fuer Menschen unsichtbar (nicht display:none, das erkennen Bots) */
.hp { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ===== Chips (Betreuer) ===== */
.email-add-row { display: flex; gap: 8px; }
.email-add-row input { flex: 1; }
.email-add-row .btn { min-width: 52px; font-size: 1.3rem; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--blue-light); color: var(--blue);
  border-radius: 999px; padding: 8px 14px;
  font-size: .9rem; font-weight: 600;
  max-width: 100%;
}
.chip .chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button {
  border: 0; background: none; color: var(--blue);
  font-size: 1.1rem; cursor: pointer; padding: 0 2px; min-height: 0; width: auto;
}
.chips-select .chip { cursor: pointer; background: #fff; border: 1.5px solid var(--line); color: var(--ink-soft); }
.chips-select .chip.selected { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ===== Fotoliste ===== */
.photo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-bottom: 12px; }
.photo-item { position: relative; border-radius: 10px; overflow: hidden; border: 1.5px solid var(--line); aspect-ratio: 3/4; background: var(--blue-light); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-item .pdf-badge { display: grid; place-items: center; height: 100%; font-size: .8rem; font-weight: 700; color: var(--blue); text-align: center; padding: 6px; word-break: break-word; }
.photo-item .remove {
  position: absolute; top: 4px; right: 4px;
  width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: rgba(21,34,56,.75); color: #fff;
  font-size: 1rem; line-height: 1; cursor: pointer;
}

/* ===== Zusammenfassung Besteller ===== */
.summary {
  background: var(--blue-light);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: .92rem;
}
.summary .sum-name { font-weight: 700; }
.summary .sum-line { color: var(--ink-soft); }
.summary a { color: var(--blue); font-weight: 600; text-decoration: none; }

/* ===== Foto-Großansicht ===== */
.photo-viewer {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 15, 25, .96);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 16px;
}
.photo-viewer img {
  max-width: 100%; max-height: 82vh;
  object-fit: contain; border-radius: 8px;
}
.viewer-hint { color: #cfd8e6; font-size: .9rem; text-align: center; margin: 12px 0 0; }
.viewer-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 14px;
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.18); color: #fff;
  font-size: 1.5rem; line-height: 1; cursor: pointer;
}

/* ===== Kamera ===== */
.camera-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: #000;
  display: flex; flex-direction: column;
}
.camera-overlay video { flex: 1; width: 100%; object-fit: cover; min-height: 0; }
.camera-controls {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
  background: rgba(0,0,0,.85);
}
.capture-btn {
  width: 72px; height: 72px; border-radius: 50%;
  border: 5px solid #fff; background: rgba(255,255,255,.25);
  cursor: pointer;
}
.capture-btn:active { background: #fff; }
.camera-count {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 14px;
  margin: 0; color: #fff; font-weight: 700;
  background: rgba(0,0,0,.5); border-radius: 999px; padding: 4px 12px;
}

/* ===== Erfolg ===== */
.success-icon {
  width: 72px; height: 72px; margin: 8px auto 12px;
  border-radius: 50%;
  background: var(--success); color: #fff;
  display: grid; place-items: center;
  font-size: 2.2rem; font-weight: 700;
}
.order-number { font-size: 1.5rem; font-weight: 800; color: var(--blue); margin: 4px 0 12px; letter-spacing: .03em; }

/* ===== Footer ===== */
.app-footer { text-align: center; padding: 12px; color: var(--muted); }
.app-footer a { color: var(--muted); }

/* ===== Desktop-Feinschliff ===== */
@media (min-width: 768px) {
  .app-header { padding-left: 24px; padding-right: 24px; }
  .app-main { padding: 24px 16px 40px; }
  .card { padding: 26px 24px; }
}
