/* ============================================
   MUNCHY UMFRAGE — styles.css
   Mobile-first, Instagram Story Style
   ============================================ */

:root {
  --primary: #D85A30;
  --primary-dark: #B84820;
  --primary-light: #F5E8E2;
  --bg: #FFF8F5;
  --text: #1A1A1A;
  --text-muted: #888;
  --chip-border: #DDD;
  --chip-bg: #FFF;
  --error: #E53E3E;
  --success: #38A169;
  --shadow: 0 4px 24px rgba(216,90,48,0.12);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 16px;
  --radius-chip: 999px;
  --font: 'Nunito', sans-serif;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---- App Wrapper ---- */
.app-wrapper {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
}

/* ---- Progress Dots ---- */
.progress-dots {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 100;
  transition: opacity 0.3s;
}

.progress-dots.hidden {
  opacity: 0;
  pointer-events: none;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #DDD;
  transition: all 0.3s ease;
}

.dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--primary);
}

.dot.done {
  background: var(--primary);
  opacity: 0.4;
}

/* ---- Back Button ---- */
.back-btn {
  position: absolute;
  top: 52px;
  left: 16px;
  z-index: 100;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.back-btn:active {
  transform: scale(0.93);
  background: #EEE;
}

.back-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ---- Screens ---- */
.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: transform var(--transition);
  will-change: transform;
}

.screen.active {
  transform: translateX(0);
}

.screen.slide-left {
  transform: translateX(-100%);
}

.screen.slide-right {
  transform: translateX(100%);
}

/* ---- Screen Content ---- */
.screen-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0 24px;
  padding-top: 100px;
  padding-bottom: 32px;
}

.screen-content.center-layout {
  justify-content: space-between;
}

.screen-content.scrollable {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Scrollbar hidden */
.screen-content.scrollable::-webkit-scrollbar {
  display: none;
}

.screen-top {
  flex: 1;
}

.screen-bottom {
  padding-top: 20px;
  flex-shrink: 0;
}

.screen-bottom.sticky {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 0%, var(--bg) 30%);
  padding-top: 32px;
  padding-bottom: 8px;
  margin: 0 -24px;
  padding-left: 24px;
  padding-right: 24px;
}

.screen-bottom.col-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- Screen Label ---- */
.screen-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ---- Typography ---- */
h1 {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 12px;
  color: var(--text);
}

h2 {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 8px;
  color: var(--text);
}

.subtext {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.subtext.large {
  font-size: 17px;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 20px;
}

/* ---- Emoji Hero ---- */
.emoji-hero {
  font-size: 56px;
  margin-bottom: 20px;
  display: block;
}

.party-anim {
  animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes pop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ---- Info Box ---- */
.info-box {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 8px;
}

.info-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.info-box p {
  font-size: 14px;
  line-height: 1.5;
  color: #6B3520;
  font-weight: 600;
}

/* ---- Buttons ---- */
.btn-primary {
  width: 100%;
  padding: 16px 24px;
  border-radius: var(--radius-chip);
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, #E8703A 100%);
  color: #FFF;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(216,90,48,0.35);
  transition: all 0.2s;
  letter-spacing: 0.01em;
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(216,90,48,0.25);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  width: 100%;
  padding: 14px 24px;
  border-radius: var(--radius-chip);
  border: 2px solid var(--chip-border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost:active {
  background: #F0F0F0;
  transform: scale(0.97);
}

/* ---- Search Input (Screen 2) ---- */
.search-wrapper {
  position: relative;
  margin-bottom: 8px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  pointer-events: none;
}

.search-wrapper input {
  width: 100%;
  padding: 16px 48px 16px 48px;
  border-radius: var(--radius);
  border: 2px solid var(--chip-border);
  background: #FFF;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(216,90,48,0.12);
}

.search-wrapper input::placeholder {
  color: #BBB;
}

.clear-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: #EEE;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 12px;
  cursor: pointer;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clear-btn.hidden {
  display: none;
}

/* Selected place card */
.selected-place {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #F0FAF0;
  border: 2px solid var(--success);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  animation: fadeIn 0.25s ease;
}

.selected-place.hidden {
  display: none;
}

.place-check {
  font-size: 20px;
  color: var(--success);
  flex-shrink: 0;
}

.place-info {
  display: flex;
  flex-direction: column;
}

.place-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.place-address {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Google Places dropdown override */
.pac-container {
  border-radius: var(--radius) !important;
  border: 2px solid var(--primary) !important;
  box-shadow: var(--shadow) !important;
  font-family: var(--font) !important;
  margin-top: 4px;
  overflow: hidden;
}

.pac-item {
  padding: 10px 16px !important;
  font-family: var(--font) !important;
  font-size: 14px !important;
  cursor: pointer;
}

.pac-item:hover {
  background: var(--primary-light) !important;
}

.pac-item-selected, .pac-item:focus {
  background: var(--primary-light) !important;
}

.pac-matched {
  font-weight: 800 !important;
  color: var(--primary) !important;
}

/* ---- Chip Sections ---- */
.chip-section {
  margin-bottom: 24px;
}

.chip-label {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 9px 16px;
  border-radius: var(--radius-chip);
  border: 2px solid var(--chip-border);
  background: var(--chip-bg);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

.chip:active {
  transform: scale(0.95);
}

.chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFF;
  box-shadow: 0 2px 8px rgba(216,90,48,0.3);
}

/* ---- Textarea Groups ---- */
.textarea-group {
  margin-bottom: 20px;
}

.textarea-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.textarea-label-row label {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.badge-optional {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: #EEE;
  border-radius: 4px;
  padding: 2px 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.textarea-wrapper {
  position: relative;
}

.textarea-wrapper textarea {
  width: 100%;
  padding: 14px 52px 14px 14px;
  border-radius: var(--radius);
  border: 2px solid var(--chip-border);
  background: #FFF;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.textarea-wrapper textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(216,90,48,0.12);
}

.textarea-wrapper textarea::placeholder {
  color: #BBB;
  font-size: 14px;
}

/* ---- Mic Button ---- */
.mic-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--primary-light);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.mic-btn:active {
  transform: scale(0.9);
}

.mic-btn.recording {
  background: var(--primary);
  animation: pulse-ring 1s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(216,90,48,0.4); }
  70%  { box-shadow: 0 0 0 10px rgba(216,90,48,0); }
  100% { box-shadow: 0 0 0 0 rgba(216,90,48,0); }
}

.mic-btn.hidden {
  display: none;
}

/* ---- Error Hints ---- */
.error-hint {
  font-size: 13px;
  color: var(--error);
  font-weight: 700;
  margin-top: 6px;
  display: none;
}

.error-hint.visible {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* ---- Shake Animation ---- */
@keyframes shake {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-6px); }
  30%  { transform: translateX(6px); }
  45%  { transform: translateX(-5px); }
  60%  { transform: translateX(5px); }
  75%  { transform: translateX(-3px); }
  90%  { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

.shake {
  animation: shake 0.45s ease both;
  border-color: var(--error) !important;
}

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

/* ---- Screen 5: Danke ---- */
.center-layout .screen-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 40px;
}

.thanks-headline {
  font-size: 34px;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 12px;
}

.thank-you-card {
  background: linear-gradient(135deg, var(--primary-light) 0%, #FFF 100%);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  box-shadow: var(--shadow);
  width: 100%;
}

.thank-you-card p {
  font-size: 15px;
  font-weight: 600;
  color: #6B3520;
  line-height: 1.6;
  text-align: center;
}

/* ---- Done State ---- */
.done-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 24px;
  text-align: center;
}

.done-overlay .emoji-hero {
  margin-bottom: 16px;
}

.done-overlay p {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
}

/* ---- Speech Error ---- */
.speech-error {
  font-size: 13px;
  color: var(--error);
  font-weight: 600;
  line-height: 1.4;
  margin-top: 6px;
  display: none;
  background: #FFF5F5;
  border: 1px solid #FED7D7;
  border-radius: 8px;
  padding: 8px 10px;
}

.speech-error.visible {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* ---- Loading Spinner ---- */
.btn-primary.loading {
  pointer-events: none;
  opacity: 0.8;
}

.btn-primary.loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #FFF;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

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

/* ---- Landscape / Large Screen ---- */
@media (min-height: 700px) {
  .screen-content {
    padding-top: 110px;
  }
}

@media (min-width: 430px) {
  .app-wrapper {
    box-shadow: 0 0 40px rgba(0,0,0,0.12);
  }

  body {
    background: #F0EAE6;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
