/* ============================================================
   Dressing – Stylesheet
   Mobile-first, No-Build. Farbthema über CSS-Variablen.
   ============================================================ */

:root {
  --bg: #0f0e17;
  --bg-elev: #1a1926;
  --bg-elev-2: #232135;
  --card: #17162340;
  --line: #2b2942;
  --text: #eceafc;
  --muted: #9a97b8;
  --primary: #ff8ba7;
  --primary-2: #a685ff;
  --accent: #6ee7b7;
  --danger: #ff6b6b;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 18px;
  --radius-sm: 12px;
  --maxw: 780px;
  --tabbar-h: 68px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-theme="light"] {
  --bg: #f6f5fb;
  --bg-elev: #ffffff;
  --bg-elev-2: #f0eef9;
  --card: #ffffff;
  --line: #e6e3f2;
  --text: #1c1a2e;
  --muted: #6b688a;
  --shadow: 0 10px 30px rgba(80,60,120,.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #3a2a5522, transparent),
              radial-gradient(900px 500px at -10% 10%, #ff8ba71a, transparent),
              var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  min-height: 100dvh;
}

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px calc(14px);
  padding-top: calc(14px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .3px; }
.logo { font-size: 22px; display: inline-flex; align-items: center; }
.brand-name { font-size: 19px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-elev);
  color: var(--text); font-size: 18px; cursor: pointer;
  display: grid; place-items: center; transition: transform .1s, background .2s;
}
.icon-btn:active { transform: scale(.94); }

/* ---------------- Views ---------------- */
main { padding: 18px; }
.view-head h1 { font-size: 26px; margin: 6px 0 2px; letter-spacing: -.5px; }
.muted { color: var(--muted); margin: 0; font-size: 14px; }

/* ---------------- Filter / Chips ---------------- */
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 6px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-elev);
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: all .18s;
}
.chip.active { color: #fff; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-color: transparent; }

/* ---------------- Grid / Karten ---------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 12px; }

.item-card {
  position: relative; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .12s;
}
.item-card:active { transform: scale(.98); }
.item-thumb { aspect-ratio: 1/1; width: 100%; object-fit: cover; background: var(--bg-elev-2); display: block; }
.item-body { padding: 10px 12px 12px; }
.item-name { font-size: 14px; font-weight: 700; margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { display: flex; align-items: center; gap: 6px; }
.color-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid #0003; flex: 0 0 auto; }
.tag { font-size: 11px; color: var(--muted); }
.cat-badge {
  position: absolute; top: 10px; left: 10px; padding: 4px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; background: #0009; color: #fff; backdrop-filter: blur(4px);
}

/* ---------------- Buttons ---------------- */
.btn {
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--text);
  padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: transform .1s, filter .2s; display: inline-flex; gap: 8px; align-items: center; justify-content: center;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(90deg, var(--primary), var(--primary-2)); color: #fff; border: none; box-shadow: 0 8px 20px #a685ff44; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: #ff6b6b44; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- Occasion Picker ---------------- */
.occasion-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin: 16px 0; }
.occasion {
  border: 1px solid var(--line); background: var(--bg-elev); border-radius: var(--radius-sm);
  padding: 14px 8px; text-align: center; cursor: pointer; transition: all .18s;
}
.occasion .emoji { font-size: 26px; display: block; margin-bottom: 6px; }
.occasion .label { font-size: 12px; font-weight: 600; color: var(--muted); }
.occasion.active { border-color: transparent; background: linear-gradient(135deg, #ff8ba733, #a685ff33); box-shadow: inset 0 0 0 2px var(--primary-2); }
.occasion.active .label { color: var(--text); }

.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin: 6px 0 16px; flex-wrap: wrap; }
.chip-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }

/* ---------------- Outfit-Karten ---------------- */
.outfits-list { display: flex; flex-direction: column; gap: 18px; }
.outfit-card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.outfit-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.outfit-title { font-weight: 800; font-size: 16px; }
.score-badge { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: #6ee7b722; color: var(--accent); }
.outfit-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(0,1fr)); gap: 2px; background: var(--line); }
.board-slot { aspect-ratio: 3/4; background: var(--bg-elev-2); position: relative; overflow: hidden; }
.board-slot img { width: 100%; height: 100%; object-fit: cover; }
.board-slot .slot-label { position: absolute; bottom: 6px; left: 6px; font-size: 10px; background: #0009; color: #fff; padding: 2px 7px; border-radius: 999px; }
.outfit-foot { padding: 12px 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.outfit-why { font-size: 13px; color: var(--muted); flex: 1 1 100%; margin: 0 0 4px; }

/* ---------------- Banner (Shop-Kontext) ---------------- */
.banner {
  background: linear-gradient(135deg, #ff8ba71a, #a685ff1a); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; font-size: 14px; margin-bottom: 6px; color: var(--muted);
}
.banner b { color: var(--text); }

/* ---------------- Produkt/Ad-Karten ---------------- */
.ad-card { position: relative; }
.ad-badge { position: absolute; top: 10px; right: 10px; background: #0009; color: #ffd; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.price { font-weight: 800; font-size: 14px; }
.brand-tag { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* Rechtliches am Seitenende (Impressum/Datenschutz) */
.site-footer {
  text-align: center; padding: 22px 16px 10px; font-size: 12px;
  color: var(--muted); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.site-footer a { color: var(--muted); text-decoration: underline; }
.match-pill { font-size: 11px; color: var(--accent); background: #6ee7b71a; padding: 2px 8px; border-radius: 999px; }

/* ---------------- Tabbar ---------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: stretch; justify-content: space-around;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: blur(16px); border-top: 1px solid var(--line);
  max-width: var(--maxw); margin: 0 auto;
}
.tab {
  flex: 1; border: none; background: none; color: var(--muted); font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer;
}
.tab span { font-size: 20px; }
.tab.active { color: var(--text); }
.tab.fab {
  flex: 0 0 auto; width: 58px; margin: -18px 4px 0; border-radius: 50%; align-self: center; height: 58px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-size: 28px; font-weight: 300;
  box-shadow: 0 10px 24px #a685ff66;
}

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: #0008; backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .2s;
}
.modal {
  width: 100%; max-width: var(--maxw); max-height: 92dvh; overflow-y: auto;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(24px + env(safe-area-inset-bottom)); animation: slideup .28s cubic-bezier(.2,.8,.2,1);
}
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 22px; }
}
.modal-grabber { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 2px auto 14px; }
.modal h2 { margin: 0 0 14px; font-size: 20px; }
.modal-close { position: absolute; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 15px; font-family: inherit;
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button {
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.seg button.active { background: var(--primary-2); color: #fff; border-color: transparent; }

.preview-box { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-elev-2); aspect-ratio: 1/1; display: grid; place-items: center; margin-bottom: 14px; }
.preview-box img { width: 100%; height: 100%; object-fit: contain; }
.preview-box .placeholder { color: var(--muted); font-size: 14px; text-align: center; padding: 20px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }

/* ---------------- Try-on Ergebnis ---------------- */
.tryon-wrap { display: grid; gap: 12px; }
.tryon-result img { width: 100%; border-radius: 16px; border: 1px solid var(--line); }
.provider-note { font-size: 12px; color: var(--muted); background: var(--bg); border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; }

/* ---------------- Empty ---------------- */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-emoji { font-size: 52px; margin-bottom: 10px; }
.empty-state h3 { margin: 6px 0; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px); transform: translateX(-50%);
  background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--line);
  padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; z-index: 60;
  box-shadow: var(--shadow); animation: fade .2s;
}

/* ---------------- Row helpers ---------------- */
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack { display: grid; gap: 10px; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------- Live-Kamera ---------------- */
.cam-overlay { position: fixed; inset: 0; z-index: 70; background: #000; display: flex; flex-direction: column; align-items: center; animation: fade .2s; }
.cam-title { color: #fff; font-weight: 700; padding: calc(16px + env(safe-area-inset-top)) 16px 10px; }
.cam-video { flex: 1; width: 100%; min-height: 0; object-fit: contain; background: #000; }
.cam-controls { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 520px; gap: 12px; padding: 16px 24px calc(20px + env(safe-area-inset-bottom)); }
.cam-btn { width: 52px; height: 52px; border-radius: 50%; background: #ffffff22; color: #fff; border: 1px solid #ffffff33; font-size: 20px; cursor: pointer; flex: 0 0 auto; }
.cam-shutter { width: 74px; height: 74px; border-radius: 50%; background: #fff; border: 5px solid #ffffff55; cursor: pointer; flex: 0 0 auto; box-shadow: 0 0 0 3px #0006; transition: transform .1s; }
.cam-shutter:active { transform: scale(.92); }
.cam-btn.active { background: var(--primary-2); border-color: transparent; }
.cam-count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 120px; font-weight: 800; color: #fff; text-shadow: 0 4px 20px #000a; pointer-events: none; }

/* Kombi-Vorschlag im Produkt-Detail */
.combo-row { display: flex; align-items: center; gap: 12px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.combo-thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--bg-elev-2); flex: 0 0 auto; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(30px); opacity: .6; } }
