/* ============================================================
   KAMINABEND – Abfrage-App Stylesheet
   Subdomain: abfrage.kamin-abend.de
   Design: Premium, minimalistisch, Apple-Style, Mobile-First
   ============================================================ */

/* ---- CSS Custom Properties (Design Tokens) ---- */
:root {
  /* Farben */
  --color-bg:           #0d0f14;
  --color-surface:      #13161e;
  --color-surface-2:    #1a1e28;
  --color-border:       rgba(255, 255, 255, 0.08);
  --color-border-focus: rgba(224, 123, 57, 0.6);
  --color-text:         #f0ece4;
  --color-text-muted:   rgba(240, 236, 228, 0.5);
  --color-text-subtle:  rgba(240, 236, 228, 0.3);
  --color-accent:       #e07b39;
  --color-accent-hover: #d06a28;
  --color-success:      #4caf7d;
  --color-error:        #e05555;

  /* Typografie */
  --font-serif:   'Playfair Display', Georgia, serif;
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Abstände */
  --space-xs:   0.375rem;
  --space-sm:   0.75rem;
  --space-md:   1.25rem;
  --space-lg:   2rem;
  --space-xl:   3rem;

  /* Radien */
  --radius-sm:  10px;
  --radius-md:  16px;
  --radius-lg:  24px;
  --radius-full: 9999px;

  /* Schatten */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-input: 0 2px 8px rgba(0, 0, 0, 0.2);

  /* Übergänge */
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height für Mobile */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: opacity var(--transition);
}
a:hover { opacity: 0.8; }

/* ---- Header ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 15, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 1.5rem;
}

.header-inner {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-logo {
  height: 36px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

.header-logo-text {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--color-text);
}

/* ---- Haupt-Container ---- */
.main-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

/* ---- Hero-Bereich ---- */
.hero-section {
  text-align: center;
  padding: 2.5rem 0 2rem;
}

.hero-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  background: rgba(224, 123, 57, 0.1);
  border: 1px solid rgba(224, 123, 57, 0.25);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.9rem;
  margin-bottom: 1rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 8vw, 2.8rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  max-width: 340px;
  margin: 0 auto;
}

/* ---- Formular-Bereich ---- */
.form-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow-card);
}

/* Fortschrittsbalken */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.progress-bar {
  flex: 1;
  height: 3px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 33.33%;
}

.progress-label {
  font-size: 0.75rem;
  color: var(--color-text-subtle);
  white-space: nowrap;
  font-weight: 500;
}

/* Formular-Schritt */
.form-step {
  animation: stepIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-step--hidden {
  display: none !important;
}

@keyframes stepIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Schritt-Header */
.step-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.step-number {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  opacity: 0.8;
}

.step-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-text);
}

/* Feld-Gruppe */
.field-group {
  margin-bottom: 1.25rem;
}

.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 0.45rem;
  letter-spacing: 0.02em;
}

.required {
  color: var(--color-accent);
  margin-left: 2px;
}

.optional {
  color: var(--color-text-subtle);
  font-weight: 400;
  font-size: 0.78rem;
}

.field-subtext {
  font-size: 0.78rem;
  color: var(--color-text-subtle);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

/* Input-Felder */
.field-input,
.field-textarea {
  width: 100%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 0.85rem 1rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.field-input::placeholder,
.field-textarea::placeholder {
  color: var(--color-text-subtle);
}

.field-input:focus,
.field-textarea:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(224, 123, 57, 0.1);
  background: rgba(224, 123, 57, 0.03);
}

/* Datepicker-Styling */
.field-input--date {
  cursor: pointer;
  color-scheme: dark;
}

.field-textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

/* Fehler-Zustand */
.field-input.error,
.field-textarea.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(224, 85, 85, 0.1);
}

.field-error {
  display: none;
  font-size: 0.78rem;
  color: var(--color-error);
  margin-top: 0.4rem;
}

.field-error.show {
  display: block;
  animation: errorIn 0.2s ease;
}

@keyframes errorIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Checkbox */
.field-group--checkbox {
  margin-top: 1.5rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
}

.checkbox-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-custom {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: var(--color-surface-2);
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  margin-top: 1px;
  transition: all var(--transition);
  position: relative;
}

.checkbox-input:checked + .checkbox-custom {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.checkbox-input:checked + .checkbox-custom::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 7px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.checkbox-text {
  font-size: 0.83rem;
  color: var(--color-text-muted);
  line-height: 1.55;
}

/* Globale Fehlermeldung */
.form-error-global {
  background: rgba(224, 85, 85, 0.1);
  border: 1px solid rgba(224, 85, 85, 0.3);
  border-radius: var(--radius-sm);
  color: var(--color-error);
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

/* Schritt-Navigation */
.step-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.85rem 1.75rem;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  flex: 1;
  box-shadow: 0 4px 16px rgba(224, 123, 57, 0.3);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(224, 123, 57, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--color-text);
}

.btn-full {
  width: 100%;
}

.btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-icon--left {
  order: -1;
}

/* Submit-Button Spinner */
.btn-submit {
  position: relative;
  overflow: hidden;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Success-Screen ---- */
.success-section {
  padding: 2rem 0;
  animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.success-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.75rem;
  text-align: center;
  box-shadow: var(--shadow-card);
}

/* Animiertes Häkchen */
.success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.5rem;
}

.checkmark {
  width: 72px;
  height: 72px;
}

.checkmark-circle {
  stroke: var(--color-success);
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: drawCircle 0.6s cubic-bezier(0.65, 0, 0.45, 1) 0.1s forwards;
}

.checkmark-check {
  stroke: var(--color-success);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: drawCheck 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.7s forwards;
}

@keyframes drawCircle {
  to { stroke-dashoffset: 0; }
}

@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

.success-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.success-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

/* Reward-Box */
.reward-box {
  background: var(--color-surface-2);
  border: 1px solid rgba(224, 123, 57, 0.25);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
}

.reward-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}

.reward-url {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--color-text);
  font-weight: 600;
  margin-bottom: 1rem;
}

.reward-divider {
  height: 1px;
  background: var(--color-border);
  margin: 1rem 0;
}

.reward-pw-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
  margin-bottom: 0.5rem;
}

.reward-password {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--color-accent);
  background: rgba(224, 123, 57, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  display: inline-block;
}

.success-note {
  font-size: 0.8rem;
  color: var(--color-text-subtle);
  margin-top: 1.25rem;
  line-height: 1.6;
}

/* ---- Footer ---- */
.app-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.78rem;
  color: var(--color-text-subtle);
  line-height: 1.8;
}

.app-footer a {
  color: var(--color-text-subtle);
  transition: color var(--transition);
}

.app-footer a:hover {
  color: var(--color-accent);
}

/* ---- Responsive (Tablet+) ---- */
@media (min-width: 600px) {
  .main-container {
    padding: 0 2rem 4rem;
  }

  .form-section {
    padding: 2.5rem 2.25rem;
  }

  .hero-section {
    padding: 3.5rem 0 2.5rem;
  }

  .hero-title {
    font-size: 3rem;
  }
}
