/* BADGENAU Forms - Main Styles (komplett neu geschrieben für absolute Einheitlichkeit) */

/* ===== Typography & Fonts ===== */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/opensans-regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Open Sans';
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/OpenSans-Medium.woff2') format('woff2');
}

@font-face {
  font-family: 'Open Sans';
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/OpenSans-Bold.woff2') format('woff2');
}

/* ===== CSS Variables ===== */
:root {
  --primary: #6A6440;
  --secondary: #7A6853;
  --accent: #DE8865;
  --neutral-warm: #CDC0A1;
  --neutral-light: #F9EBD7;
  --neutral-cool: #ADBAC2;
  --bg: #FAFAFA;
  --card: #FFFFFF;
  --ink: #1F2937;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --anim: 0.3s;
  
  /* Spacing-Variablen für Konsistenz */
  --space-xs: 0.25rem;  /* 4px */
  --space-sm: 0.5rem;   /* 8px */
  --space-md: 0.75rem;  /* 12px */
  --space-lg: 1rem;     /* 16px */
  --space-xl: 1.5rem;   /* 24px */
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Open Sans', system-ui, sans-serif;
  font-weight: 400;
  background: var(--bg);
  background-image: url('/assets/bg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ===== Layout Container ===== */
.app-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.5rem);
}

/* ===== Header ===== */
header {
  text-align: center;
  margin-bottom: 1.5rem;
}

header img {
  max-width: 180px;
  height: auto;
  margin: 0 auto 1.5rem;
  display: block;
}

header h1 {
  font-size: clamp(1.6rem, 3.6vw, 2.6rem);
  font-weight: 600;
  margin: 0.25rem 0 0.5rem;
  color: var(--ink);
}

header p {
  color: var(--ink);
}

/* ===== Cards - EINHEITLICH ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
}

.card h2 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  margin: 0 0 var(--space-xs) 0;
  color: var(--ink);
}

.card .header-with-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: var(--space-md);
}

.card .header-with-badge h2 {
  margin: 0;
}

.card .step-description {
  font-size: 1rem;
  font-weight: 400;
  color: #444;
  margin-bottom: var(--space-md);
}

/* ===== Type Badge ===== */
.type-badge {
  background: rgba(106, 100, 64, 0.08);
  color: var(--primary);
  border: 1px solid var(--neutral-warm);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== Navigation Chips ===== */
.steps-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-evenly;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chip {
  background: var(--neutral-warm);
  color: #222;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.3s ease;
  opacity: 0.6;
}

.chip.completed {
  background: #4caf50;
  color: #fff;
  opacity: 0.85;
}

.chip[aria-current="step"],
.chip.active {
  background: var(--accent);
  color: #fff;
  opacity: 1;
}

/* ===== Progress Bar ===== */
.progress {
  height: 6px;
  background: var(--neutral-warm);
  border-radius: 4px;
  overflow: hidden;
  margin: var(--space-sm) 0 var(--space-lg);
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  width: 0;
  transition: width var(--anim) ease;
}

/* ===== Form Elements - EINHEITLICH =====*/

/* Layout Grids */
.layout-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .layout-cols {
    grid-template-columns: repeat(2, 1fr);
  }
}

.layout-cols.contact-optional {
  margin-top: 0.75rem;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 var(--space-md) 0;
}

legend {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: var(--space-xs);
  color: var(--ink);
}

label {
  display: block;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: var(--space-xs);
  color: var(--ink);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: 'Open Sans', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  border-radius: 10px;
  border: 1px solid #D1D5DB;
  background: #FFFFFF;
  color: var(--ink);
  transition: all 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: #9CA3AF;
  opacity: 1;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(106, 100, 64, 0.08);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236A6440' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
  appearance: none;
}

/* ===== Radio Options - EINHEITLICH ===== */
.options {
  display: grid;
  gap: var(--space-md);
}

.radio-option {
  background: #fff;
  border: 1px solid var(--neutral-warm);
  padding: 1rem 1.25rem;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  font-weight: 400;
  font-size: 1rem;
  gap: var(--space-md);
}

.radio-option input {
  margin-right: var(--space-sm);
}

.radio-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(222, 136, 101, 0.08);
}

/* Type Grid - Quadratische Buttons */
.options.type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.options.type-grid .radio-option {
  flex-direction: column;
  justify-content: center;
  text-align: center;
  height: 100px;
  padding: 1rem 0.75rem;
  gap: var(--space-sm);
}

.options.type-grid .radio-option input {
  margin: 0;
}

/* ===== Preset-or-Custom System - EINHEITLICH ===== */
.preset-or-custom-container {
  position: relative;
  min-height: 40px;
  margin-bottom: 0;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: flex-start;
  justify-content: flex-start;
}

.preset-btn {
  padding: 0.45rem 0.75rem;
  min-width: 80px;
  background: #fff;
  border: 1px solid var(--neutral-warm);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  flex-shrink: 0;
}

.preset-btn:hover {
  border-color: var(--primary);
  background: rgba(106, 100, 64, 0.04);
}

.preset-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.preset-btn.preset-custom {
  background: rgba(106, 100, 64, 0.08);
  border-color: var(--primary);
  font-weight: 600;
}

/* Custom Input mit X-Button */
.custom-input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.custom-input {
  flex: 1;
  max-width: 300px;
}

.close-custom {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: 6px;
  padding: var(--space-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.close-custom:hover {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.5);
}

.close-custom svg {
  width: 18px;
  height: 18px;
  color: #dc2626;
}

/* ===== Buttons - EINHEITLICH ===== */
button,
.btn-primary,
.btn-secondary {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fff;
  font: inherit;
  padding: 0.85rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
}

button:focus-visible,
.btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:hover,
.btn-primary:hover {
  transform: scale(1.03);
  background: #d17a55;
  box-shadow: 0 4px 12px rgba(222, 136, 101, 0.3);
}

button:active,
.btn-primary:active {
  transform: scale(0.97);
}

button:disabled,
.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  opacity: 0.6;
}

.btn-secondary {
  background: transparent;
  color: var(--secondary);
  border: 1px solid var(--neutral-warm);
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.btn-secondary:hover {
  background: rgba(122, 104, 83, 0.08);
  border-color: var(--secondary);
}

.button-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

/* ===== Icons ===== */
.icon-arrow,
.icon-arrow-left,
.icon-check {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ===== Review Section ===== */
.review-block {
  background: #fff;
  border: 1px solid var(--neutral-cool);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: var(--space-md);
  font-size: 0.85rem;
}

.review-block h3 {
  font-size: 1rem;
  margin-bottom: var(--space-sm);
  color: var(--primary);
  font-weight: 700;
}

.review-block ul {
  list-style: none;
  padding: 0;
}

.review-block li {
  padding: 0.3rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.review-block li:last-child {
  border-bottom: none;
}

/* ===== Details/Summary ===== */
details {
  margin: var(--space-md) 0 0;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
  padding: var(--space-sm) 0;
  list-style: none;
  user-select: none;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::before {
  content: '+ ';
  margin-right: var(--space-sm);
}

details[open] summary::before {
  content: '− ';
}

details[open] .layout-cols {
  margin-top: var(--space-md);
}

/* ===== Layout Grid ===== */
@media (min-width: 768px) {
  .layout-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
  }
}

/* ===== Utilities ===== */

/* Loading States */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  z-index: 9999;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(106, 100, 64, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Accessibility */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.honey {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* ===== Animations ===== */
.fade-move {
  animation: fadeMove var(--anim) both;
}

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

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

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

/* ===== Mobile Optimizations ===== */
@media (max-width: 768px) {
  .options.type-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .button-group {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .btn-secondary {
    order: 2;
  }
  
  .btn-primary {
    order: 1;
    width: 100%;
    justify-content: center;
  }
  
  .chip {
    font-size: 0.7rem;
    padding: 0.4rem 0.65rem;
  }
}

@media (max-width: 480px) {
  .options.type-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
  
  .options.type-grid .radio-option {
    height: 90px;
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
  }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Footer ===== */
footer {
  margin-top: 3rem;
  font-size: 0.65rem;
  color: #333;
  text-align: center;
}
