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

:root {
  --bg:             #0b0b12;
  --surface:        #13131e;
  --surface-raised: #1a1a28;
  --border:         #252535;
  --border-subtle:  #1d1d2d;
  --text:           #e8e9f0;
  --text-secondary: #9192a8;
  --text-muted:     #55566a;
  --accent:         #2563eb;
  --accent-hover:   #1d4ed8;
  --accent-subtle:  rgba(37, 99, 235, .12);
  --success:        #10d98a;
  --success-bg:     rgba(16, 217, 138, .08);
  --success-border: rgba(16, 217, 138, .2);
  --error:          #f45c7a;
  --error-subtle:   rgba(244, 92, 122, .12);
  --star:           #ffc857;
  --star-hover:     #ffe08a;
  --star-empty:     #2a2a3a;
  --radius:         8px;
  --radius-lg:      12px;
  --shadow:         0 1px 3px rgba(0,0,0,.45), 0 8px 24px rgba(0,0,0,.3);
  --font:           'Inter', system-ui, -apple-system, sans-serif;
}

body {
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── App Layout ──────────────────────────────────────────── */
.app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 11, 18, .85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 30px;
  width: auto;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}

.app-main {
  flex: 1;
  padding: 40px 24px 64px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

/* ─── Step Progress ───────────────────────────────────────── */
.step-progress {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
  background: var(--surface);
  transition: background .2s, border-color .2s;
  flex-shrink: 0;
}

.step-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  transition: color .2s;
}

.step-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color .2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-item.active .step-dot {
  background: var(--accent-subtle);
  border-color: var(--accent);
}
.step-item.active .step-number { color: var(--accent); }
.step-item.active .step-label  { color: var(--text); }

.step-item.done .step-dot {
  background: var(--accent);
  border-color: var(--accent);
}
.step-item.done .step-number { font-size: 0; }
.step-item.done .step-number::before {
  content: '✓';
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.step-item.done .step-label { color: var(--text); }

.step-connector {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 10px;
  min-width: 12px;
}

/* ─── Form Step Visibility ────────────────────────────────── */
/* The JS toggles `.hidden` on/off (not `.active`); step1 starts visible by default. */
.form-step.hidden { display: none !important; }

/* ─── Card ────────────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card-header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.015em;
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ─── Field Groups ────────────────────────────────────────── */
.field-group {
  padding: 22px 28px;
  border-bottom: 1px solid var(--border-subtle);
}
.field-group:last-of-type { border-bottom: none; }

.group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Centered question (used as in-card prompt) */
.centered-question {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  margin-bottom: 14px;
  letter-spacing: -.005em;
  line-height: 1.45;
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}
.form-row:last-child { margin-bottom: 0; }

.form-group { flex: 1; min-width: 0; }

/* ─── Labels ──────────────────────────────────────────────── */
.form-group > label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

/* ─── Inputs ──────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

textarea,
.feedback-textarea {
  resize: vertical;
  line-height: 1.6;
  min-height: 110px;
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  padding: 12px;
}

.invalid-field {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 3px var(--error-subtle) !important;
}

/* ─── Star Rating ─────────────────────────────────────────── */
.star-rating-wrapper {
  padding: 36px 28px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.star-rating {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: center;
  gap: 4px;
}

.star-rating input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.star-rating label {
  font-size: 56px;
  line-height: 1;
  color: var(--star-empty);
  cursor: pointer;
  padding: 0 4px;
  transition: color .15s ease, transform .12s ease;
  user-select: none;
  text-shadow: none;
}

/* Selected and to the left (visual: stars to the left of/including checked become gold) */
.star-rating input[type="radio"]:checked ~ label {
  color: var(--star);
  text-shadow: 0 0 18px rgba(255, 200, 87, .25);
}

/* Hover lights up from right to left */
.star-rating label:hover,
.star-rating label:hover ~ label {
  color: var(--star-hover);
  transform: scale(1.06);
}

.rating-description {
  margin-top: 18px;
  font-size: 14px;
  color: var(--text-secondary);
  min-height: 1.5em;
  text-align: center;
  font-weight: 500;
}

/* ─── Chip Container & Chip ───────────────────────────────── */
.chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
  user-select: none;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-subtle);
}

.chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .3);
}

/* ─── Contact Inputs Grid ─────────────────────────────────── */
.contact-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

/* ─── Form Actions ────────────────────────────────────────── */
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  margin-top: 0;
  text-align: initial;
}

.form-actions--right { justify-content: flex-end; }
.form-actions--single { justify-content: flex-end; }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn,
.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .1s, opacity .15s, color .15s, border-color .15s;
  white-space: nowrap;
  outline: none;
  position: relative;
  line-height: 1;
  background: var(--accent);
  color: #fff;
}

.btn-primary,
.submit-button:not(.secondary-button):not(.btn-ghost) {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled),
.submit-button:not(.secondary-button):not(.btn-ghost):hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, .4);
}

.btn-primary:active:not(:disabled),
.submit-button:not(.secondary-button):active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.btn-ghost,
.secondary-button {
  background: transparent !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border) !important;
  margin-right: 0;
}

.btn-ghost:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
  background: var(--surface-raised) !important;
  color: var(--text) !important;
  border-color: var(--text-muted) !important;
  transform: none;
  box-shadow: none;
}

.btn:disabled,
.submit-button:disabled {
  opacity: .38;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ─── Spinner (inside button) ─────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-left: 6px;
}

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

/* ─── Review templates ────────────────────────────────────── */
.review-templates-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 120px;
}

#loadingMessage {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13.5px;
  padding: 8px 0;
}

#generatedReviews {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.generated-review-item {
  position: relative;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 56px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.7;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-family: var(--font);
}

.generated-review-item:hover {
  border-color: var(--accent);
  background: rgba(37, 99, 235, .06);
}

.generated-review-item::after {
  content: 'Kopieren';
  position: absolute;
  right: 14px;
  bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-subtle);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(37, 99, 235, .25);
  transition: background .15s, color .15s;
}

.generated-review-item:hover::after {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.generated-review-item.copied {
  border-color: var(--success);
  background: var(--success-bg);
}

.generated-review-item.copied::after {
  content: 'Kopiert ✓';
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

/* ─── Loading bar (review generation) ─────────────────────── */
.review-loading-bar-container,
.loading-bar-container {
  width: 100%;
  height: 4px;
  background: var(--surface-raised);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  margin-bottom: 12px;
}

.review-loading-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  animation: fillBar 18s linear forwards;
  width: 0%;
}

.loading-bar {
  height: 100%;
  width: 40%;
  background: var(--accent);
  border-radius: 999px;
  animation: indeterminate 1.4s ease-in-out infinite;
  position: absolute;
  left: 0;
}

@keyframes fillBar {
  0%   { width: 0%; }
  100% { width: 100%; }
}

@keyframes indeterminate {
  0%   { left: -40%; }
  100% { left: 100%; }
}

.submission-loading-container {
  padding: 20px 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13.5px;
}

/* ─── Antwort Box (Notification card) ─────────────────────── */
#antwortBox {
  display: none;
  background: var(--surface);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin: 8px 0 0 0;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.65;
  text-align: center;
  box-shadow: var(--shadow);
  white-space: pre-wrap;
}

#antwortBox::before {
  content: '';
  display: block;
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--success-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2310d98a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/22px no-repeat;
  border: 1px solid var(--success-border);
}

/* ─── Popup Modal ─────────────────────────────────────────── */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn .15s ease-out;
}

.popup-overlay.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.popup-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px 24px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 480px;
  position: relative;
  color: var(--text);
  animation: popIn .2s cubic-bezier(.2,.9,.3,1.2);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}

.popup-content h3 {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.015em;
  margin: 0 0 16px;
  padding-right: 28px;
}

.popup-content p {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 22px;
  text-align: left;
}

.popup-content ol {
  padding-left: 20px;
  margin: 0;
}

.popup-content ol li {
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.popup-content ol li::marker {
  color: var(--accent);
  font-weight: 700;
}

.popup-content br { display: none; }

.popup-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text-muted);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
  line-height: 1;
  user-select: none;
}

.close-button:hover {
  background: var(--surface-raised);
  color: var(--text);
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 620px) {
  .app-header  { padding: 0 16px; }
  .app-main    { padding: 24px 16px 48px; }
  .card-header { padding: 20px 20px 16px; }
  .field-group { padding: 18px 20px; }
  .form-row    { flex-direction: column; gap: 12px; }
  .contact-inputs-grid { grid-template-columns: 1fr; }
  .star-rating label { font-size: 44px; padding: 0 2px; }
  .star-rating-wrapper { padding: 28px 16px 22px; }
  .step-label { display: none; }
  .step-connector { margin: 0 6px; }
  .popup-content { padding: 22px 22px 18px; }
}
