/* ================================================================
   Party-Kamera – gemeinsames Stylesheet
   Themes setzen nur Variablen; alle Komponenten lesen sie.
   ================================================================ */

/* ── THEME: VINTAGE (Einwegkamera, Polaroids) ──────── */
:root, [data-theme="vintage"] {
  --bg:        #14100c;
  --card:      rgba(38, 29, 21, 0.9);
  --input-bg:  rgba(20, 15, 10, 0.9);
  --paper:     #f4ecd8;
  --ink:       #2b2118;
  --accent:    #e8a33d;
  --accent-h:  #d18f2a;
  --accent-ink:#2b2118;
  --red:       #c8553d;
  --t1:        #f6efe2;
  --t2:        #a89a86;
  --border:    rgba(255, 235, 200, 0.09);
  --border-a:  rgba(232, 163, 61, 0.45);
  --error-t:   #f0a593;
  --glow-1:    rgba(232, 163, 61, 0.13);
  --glow-2:    rgba(200, 85, 61, 0.10);
  --nav-fade:  rgba(20, 16, 12, 0.98);

  --font-display: 'Special Elite', monospace;
  --font-body:    'DM Sans', -apple-system, sans-serif;
  --font-hand:    'Caveat', cursive;
  --display-weight: 400;
  --number-shadow:  3px 3px 0 rgba(200, 85, 61, 0.55);
  --badge-border:   1px dashed var(--border-a);

  --camera-bg:     linear-gradient(160deg, #3a3029 0%, #1d1713 100%);
  --camera-border: rgba(255, 235, 200, 0.12);
  --camera-shadow: 0 20px 50px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.08);
  --shutter:       #c8553d;
  --shutter-ring:  #f4ecd8;

  --photo-radius:  3px;
  --photo-shadow:  0 10px 28px rgba(0, 0, 0, 0.55);
  --photo-meta:    #8a7a66;
  --caption-size:  21px;
  --caption-weight:700;
  color-scheme: dark;
}

/* ── THEME: MODERN (hell, klar) ────────────────────── */
[data-theme="modern"] {
  --bg:        #f5f4f1;
  --card:      #ffffff;
  --input-bg:  #f4f3f0;
  --paper:     #ffffff;
  --ink:       #1d1d1f;
  --accent:    #ff5a5f;
  --accent-h:  #ec474c;
  --accent-ink:#ffffff;
  --red:       #e5484d;
  --t1:        #1d1d1f;
  --t2:        #6e6e73;
  --border:    rgba(0, 0, 0, 0.08);
  --border-a:  rgba(255, 90, 95, 0.5);
  --error-t:   #c4373c;
  --glow-1:    rgba(255, 90, 95, 0.10);
  --glow-2:    rgba(108, 92, 231, 0.08);
  --nav-fade:  rgba(245, 244, 241, 0.98);

  --font-display: 'DM Sans', -apple-system, sans-serif;
  --font-body:    'DM Sans', -apple-system, sans-serif;
  --font-hand:    'DM Sans', -apple-system, sans-serif;
  --display-weight: 700;
  --number-shadow:  none;
  --badge-border:   1px solid var(--border-a);

  --camera-bg:     #ffffff;
  --camera-border: rgba(0, 0, 0, 0.06);
  --camera-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  --shutter:       #ff5a5f;
  --shutter-ring:  #ffffff;

  --photo-radius:  14px;
  --photo-shadow:  0 6px 20px rgba(0, 0, 0, 0.08);
  --photo-meta:    #8e8e93;
  --caption-size:  16px;
  --caption-weight:500;
  color-scheme: light;
}

/* ── RESET ─────────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--t1);
  min-height: 100vh;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 90% 60% at 10% 0%,   var(--glow-1) 0%, transparent 60%),
    radial-gradient(ellipse 70% 70% at 95% 100%, var(--glow-2) 0%, transparent 60%);
}

/* ── LAYOUT ────────────────────────────────────────── */
#app {
  position: relative; z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 18px calc(96px + env(safe-area-inset-bottom));
}

/* ── HEADER ────────────────────────────────────────── */
.header { text-align: center; padding: 44px 0 30px; }
.header-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
  border: var(--badge-border);
  border-radius: 4px;
  padding: 6px 12px 4px;
  margin-bottom: 22px;
}
.header-number {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: clamp(84px, 26vw, 124px);
  line-height: 0.9;
  color: var(--accent);
  text-shadow: var(--number-shadow);
  margin-bottom: 10px;
}
.header h1 {
  font-family: var(--font-display);
  font-size: clamp(26px, 8vw, 34px);
  font-weight: var(--display-weight); line-height: 1.2;
  margin-bottom: 10px;
}
.header p { font-size: 15px; color: var(--t2); font-weight: 300; line-height: 1.6; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 22px 0 16px;
}
.topbar-title { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 18px; }
.topbar-sub { font-size: 12px; color: var(--t2); margin-top: 2px; }
.link-btn {
  background: none; border: none; color: var(--t2);
  font-family: inherit; font-size: 12px; text-decoration: underline; cursor: pointer;
}

/* ── CARD + FORM ───────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 18px;
  margin-bottom: 14px;
  transition: border-color 0.25s;
}
.card:focus-within { border-color: var(--border-a); }

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block;
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--t2);
  margin-bottom: 8px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row .field { margin-bottom: 0; }
.hint { font-size: 12px; color: var(--t2); margin-top: 6px; line-height: 1.5; }

input[type="text"], input[type="number"], input[type="email"], input[type="date"], textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 15px;
  font-family: inherit; font-size: 16px;
  color: var(--t1);
  outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input::placeholder, textarea::placeholder { color: var(--t2); opacity: 0.5; }
input:focus, textarea:focus { border-color: var(--border-a); box-shadow: 0 0 0 3px var(--glow-1); }
textarea { resize: vertical; min-height: 110px; line-height: 1.6; }

.field > label.check { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 400; color: var(--t1); margin-bottom: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; }
.check small { display: block; color: var(--t2); font-size: 12px; }

/* ── BUTTONS ───────────────────────────────────────── */
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  background: var(--accent); color: var(--accent-ink);
  border: none; border-radius: 14px;
  padding: 17px 24px;
  font-family: var(--font-display); font-weight: var(--display-weight); font-size: 17px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  margin-top: 6px;
}
.btn-primary:hover { background: var(--accent-h); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--glow-1); color: var(--accent);
  border: 1px solid var(--border-a);
  border-radius: 10px;
  padding: 10px 16px;
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  text-decoration: none;
}
.btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-delete {
  background: rgba(200,85,61,0.1); color: var(--error-t);
  border: 1px solid rgba(200,85,61,0.3);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: inherit; font-size: 12px;
  cursor: pointer;
}
.btn-delete:disabled { opacity: 0.4; }

.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(128,128,128,0.3); border-top-color: var(--accent-ink);
  border-radius: 50%;
  animation: spin 0.55s linear infinite; flex-shrink: 0;
}
.spinner-lg { width: 28px; height: 28px; border-width: 3px; border-color: rgba(128,128,128,0.25); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
  background: rgba(200,85,61,0.1);
  border: 1px solid rgba(200,85,61,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px; color: var(--error-t);
  margin-top: 12px; line-height: 1.5;
}
.state-center { text-align: center; padding: 50px 20px; color: var(--t2); font-size: 14px; line-height: 1.6; }
.state-center .spinner-lg { margin: 0 auto 16px; display: block; }
.state-center .big { font-size: 48px; margin-bottom: 12px; }
.state-center h2 { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 22px; color: var(--t1); margin-bottom: 8px; }

/* ── CAMERA BODY ───────────────────────────────────── */
.camera {
  background: var(--camera-bg);
  border: 1px solid var(--camera-border);
  border-radius: 26px;
  padding: 14px 14px 18px;
  box-shadow: var(--camera-shadow);
}
.camera-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 6px 12px;
  font-family: var(--font-display); font-size: 12px; letter-spacing: 0.12em;
  color: var(--t2);
}
.camera-top .rec { color: var(--red); }
.camera-top .rec::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); margin-right: 6px;
  animation: blink 1.4s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0.2; } }

.viewfinder {
  position: relative;
  aspect-ratio: 1/1;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 3px solid #0c0907;
}
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewfinder video.mirror { transform: scaleX(-1); }
[data-theme="modern"] .viewfinder { border: none; border-radius: 16px; }
[data-theme="vintage"] .viewfinder::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle, transparent 45%, rgba(0,0,0,0.55) 100%);
}
.vf-mark {
  position: absolute; width: 22px; height: 22px; z-index: 2; pointer-events: none;
  border: 2px solid rgba(255,255,255,0.65);
}
.vf-mark.tl { top: 14px; left: 14px; border-right: none; border-bottom: none; }
.vf-mark.tr { top: 14px; right: 14px; border-left: none; border-bottom: none; }
.vf-mark.bl { bottom: 14px; left: 14px; border-right: none; border-top: none; }
.vf-mark.br { bottom: 14px; right: 14px; border-left: none; border-top: none; }
.vf-stamp {
  position: absolute; right: 16px; bottom: 12px; z-index: 2; pointer-events: none;
  font-family: 'VT323', monospace; font-size: 22px;
  color: #ff9a3c; text-shadow: 0 0 6px #ff5a00;
}
.vf-fallback {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 24px; text-align: center;
  font-size: 14px; color: #a89a86;
  background: #0c0907;
}
.vf-fallback .big { font-size: 40px; }
.vf-fallback input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
#flash {
  position: fixed; inset: 0; z-index: 50; background: #fff;
  opacity: 0; pointer-events: none;
}
#flash.go { animation: flash 0.35s ease-out; }
@keyframes flash { 0% { opacity: 0.95; } 100% { opacity: 0; } }

.films { display: flex; gap: 8px; overflow-x: auto; padding: 14px 2px 4px; scrollbar-width: none; }
.films::-webkit-scrollbar { display: none; }
.film {
  flex-shrink: 0;
  background: var(--input-bg); color: var(--t2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 7px 14px;
  font-family: var(--font-display); font-size: 12px;
  cursor: pointer;
}
.film.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.camera-controls {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding-top: 14px;
}
.cam-side {
  justify-self: center;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--input-bg); border: 1px solid var(--border);
  color: var(--t1); font-size: 20px; cursor: pointer;
  position: relative; overflow: hidden;
}
.cam-side input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.shutter {
  width: 78px; height: 78px; border-radius: 50%;
  background: var(--shutter);
  border: 5px solid var(--shutter-ring);
  box-shadow: 0 0 0 3px #0c0907, 0 6px 16px rgba(0,0,0,0.35);
  cursor: pointer;
  transition: transform 0.1s;
}
[data-theme="modern"] .shutter { box-shadow: 0 0 0 3px var(--shutter), 0 6px 16px rgba(255,90,95,0.35); }
.shutter:active { transform: scale(0.92); }

/* ── FOTO (Polaroid bzw. Karte) ────────────────────── */
.polaroid {
  background: var(--paper);
  padding: 10px 10px 12px;
  border-radius: var(--photo-radius);
  box-shadow: var(--photo-shadow);
  color: var(--ink);
}
.polaroid img, .polaroid canvas { width: 100%; aspect-ratio: 1/1; display: block; background: #222; }
[data-theme="modern"] .polaroid img, [data-theme="modern"] .polaroid canvas { border-radius: 9px; }
.polaroid-caption {
  font-family: var(--font-hand); font-weight: var(--caption-weight);
  font-size: var(--caption-size); line-height: 1.15;
  padding: 8px 2px 2px; min-height: 34px;
  text-align: center;
  overflow-wrap: anywhere;
}
.polaroid-meta {
  font-family: var(--font-display); font-size: 10px;
  color: var(--photo-meta); text-align: center; padding-top: 4px;
}
.review-polaroid { margin: 4px 16px 18px; animation: develop 1.6s ease-out; }
[data-theme="vintage"] .review-polaroid { transform: rotate(-1.5deg); }
@keyframes develop {
  0%   { filter: brightness(2.2) blur(6px) saturate(0); }
  100% { filter: none; }
}
[data-theme="modern"] .review-polaroid { animation: fadeUp 0.4s ease; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--input-bg); border: 1px solid var(--border);
  color: var(--t1); font-size: 22px; cursor: pointer;
}
.stepper .val {
  flex: 1; text-align: center;
  font-family: var(--font-display); font-size: 28px; color: var(--accent);
}

/* ── GALERIE ───────────────────────────────────────── */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 12px; padding: 6px 2px; }
.wall .polaroid { padding: 6px 6px 8px; cursor: pointer; }
.wall .polaroid-caption { font-size: calc(var(--caption-size) * 0.76); min-height: 24px; padding-top: 5px; }

#lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10,7,5,0.92);
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
#lightbox.open { display: flex; }
#lightbox .polaroid { width: 100%; max-width: 420px; }

/* ── BOTTOM NAV ────────────────────────────────────── */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: 10px;
  padding: 10px 18px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--nav-fade) 60%, transparent);
}
.nav button {
  flex: 1; max-width: 220px;
  background: var(--card); color: var(--t2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 10px;
  font-family: var(--font-display); font-size: 14px;
  cursor: pointer;
}
.nav button.on { color: var(--accent); border-color: var(--border-a); }

#toast {
  position: fixed; left: 50%; top: 22px; z-index: 70;
  transform: translate(-50%, -80px);
  background: var(--paper); color: var(--ink);
  font-family: var(--font-display); font-size: 14px;
  padding: 12px 18px 10px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  transition: transform 0.3s;
  white-space: nowrap;
}
#toast.show { transform: translate(-50%, 0); }

.fade-in { animation: fadeUp 0.35s ease forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
