/* ═══════════════════════════════════════
   SLOT MACHINE — Design System
   FGP brand: bordeaux / cream / white
═══════════════════════════════════════ */

:root {
  --red:         #C41230;   /* FGP crimson */
  --red-dark:    #A00E27;   /* hover / pressed state */
  --red-light:   #FCEAED;   /* tint for selected chips */
  --cream:       #F7F3ED;   /* page background */
  --white:       #FFFFFF;   /* card / content surfaces */
  --ink:         #1C1410;   /* primary text */
  --ink-mid:     #5A4A42;   /* secondary text */
  --ink-faint:   #9E8E87;   /* hints / placeholders */
  --border:      #E2D9D1;   /* dividers */
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;

  /* Typography — 5 sizes max */
  --fs-title:  2rem;       /* step title */
  --fs-large:  1.125rem;   /* section headings */
  --fs-mid:    1rem;       /* body / chips */
  --fs-small:  0.875rem;   /* hints / labels */
  --fs-accent: 0.75rem;    /* badges / confirms */
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100dvh;
}

/* ── NAV ─────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  height: 52px;
  background: var(--red);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-logo {
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-right: auto;
}

.nav-link {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: var(--fs-small);
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-height: 44px;
}
.nav-link[data-active="true"] {
  background: rgba(255,255,255,0.18);
  color: var(--white);
}
.nav-link:hover { background: rgba(255,255,255,0.12); color: var(--white); }

/* ── VIEWS ───────────────────────────── */
.view { display: block; }
.view.hidden { display: none; }

/* ── PROGRESS BAR ────────────────────── */
.progress-track {
  height: 3px;
  background: var(--border);
}
.progress-bar {
  height: 100%;
  background: var(--red);
  width: 20%;
  transition: width 0.35s ease;
}

/* ── STEPS ───────────────────────────── */
.step {
  max-width: 520px;
  margin: 0 auto;
  padding: 36px 20px 100px;
}
.step.hidden { display: none; }

.step-header { margin-bottom: 28px; }

.step-title {
  font-size: var(--fs-title);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
}

.step-hint {
  font-size: var(--fs-small);
  color: var(--ink-faint);
  margin-top: 6px;
}

.back-btn {
  background: none;
  border: none;
  color: var(--ink-mid);
  font-size: var(--fs-small);
  cursor: pointer;
  padding: 0;
  margin-bottom: 16px;
  display: block;
  min-height: 44px;
  line-height: 44px;
}
.back-btn:hover { color: var(--red); }

/* ── CHIP GRID ───────────────────────── */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  padding: 0 20px;
  height: 48px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: var(--white);
  color: var(--ink);
  font-size: var(--fs-mid);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
  min-height: 44px;
}

.chip:hover {
  border-color: var(--red);
  color: var(--red);
}

.chip.selected {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
  font-weight: 600;
}

/* ── LIST SELECT (profiles / calendars) ─ */
.list-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 28px;
}

.list-item {
  padding: 16px 20px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 44px;
}
.list-item:hover { border-color: var(--red); }
.list-item.selected {
  border-color: var(--red);
  background: var(--red-light);
}

.list-item-title {
  font-size: var(--fs-mid);
  font-weight: 600;
  color: var(--ink);
}
.list-item-sub {
  font-size: var(--fs-accent);
  color: var(--ink-faint);
  margin-top: 3px;
}

.list-group-label {
  font-size: var(--fs-accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  padding: 4px 4px 2px;
}

.list-empty {
  font-size: var(--fs-small);
  color: var(--ink-faint);
  padding: 12px 4px;
}

/* ── STEP FOOTER ─────────────────────── */
.step-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 16px 20px;
  background: var(--cream);
  border-top: 1px solid var(--border);
}

.step-footer .btn-primary,
.step-footer .btn-ghost {
  max-width: 520px;
  margin: 0 auto;
  display: block;
  width: 100%;
}

/* ── BUTTONS ─────────────────────────── */
.btn-primary {
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--red);
  color: var(--white);
  font-size: var(--fs-mid);
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 44px;
}
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-ghost {
  height: 52px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink-mid);
  font-size: var(--fs-mid);
  font-weight: 600;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  min-height: 44px;
}
.btn-ghost:hover { border-color: var(--red); color: var(--red); }

.btn-sm {
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  background: var(--red);
  color: var(--white);
  font-size: var(--fs-small);
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 44px;
}
.btn-sm:hover { background: var(--red-dark); }

.btn-outline {
  background: transparent;
  color: var(--red);
  border: 2px solid var(--red);
}
.btn-outline:hover { background: var(--red-light); }

/* ── TEXT INPUT ──────────────────────── */
.text-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px; /* never below 16px — prevents iOS zoom */
  color: var(--ink);
  background: var(--white);
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
.text-input:focus {
  outline: none;
  border-color: var(--red);
}
.text-input::placeholder { color: var(--ink-faint); }

.custom-input-wrap {
  margin-top: 16px;
}
.custom-input-wrap.hidden { display: none; }

/* ── GENERATE / LINK RESULT ──────────── */
.generate-area {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.link-box {
  width: 100%;
  padding: 14px 16px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  color: var(--ink-mid);
  word-break: break-all;
  border: 1px solid var(--border);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.btn-copy {
  width: 100%;
  margin-top: 4px;
}

.copy-confirm {
  font-size: var(--fs-small);
  color: var(--red);
  font-weight: 600;
  text-align: center;
}
.copy-confirm.hidden { display: none; }

/* ── SPINNER ─────────────────────────── */
.spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--ink-faint);
  font-size: var(--fs-small);
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SETTINGS ────────────────────────── */
.settings-container {
  max-width: 560px;
  margin: 0 auto;
  padding: 36px 20px 60px;
}

.settings-title {
  font-size: var(--fs-title);
  font-weight: 800;
  margin-bottom: 32px;
}

.settings-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.settings-section-title {
  font-size: var(--fs-large);
  font-weight: 700;
  margin-bottom: 6px;
}

.settings-section-hint {
  font-size: var(--fs-small);
  color: var(--ink-faint);
  margin-bottom: 16px;
}

/* ── CHECKBOX LIST ───────────────────── */
.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
}

.checkbox-item input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--red);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-label {
  font-size: var(--fs-small);
  color: var(--ink);
}
.checkbox-sublabel {
  font-size: var(--fs-accent);
  color: var(--ink-faint);
  display: block;
}

.save-confirm {
  font-size: var(--fs-accent);
  color: var(--red);
  font-weight: 600;
  margin-left: 10px;
}
.save-confirm.hidden { display: none; }

/* ── PROFILES LIST ───────────────────── */
.profiles-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.profile-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  gap: 12px;
  min-height: 44px;
}

.profile-row-name {
  flex: 1;
  font-size: var(--fs-mid);
  font-weight: 500;
}

.profile-row-blocks {
  font-size: var(--fs-accent);
  color: var(--ink-faint);
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--ink-faint);
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  min-height: 44px;
  min-width: 44px;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--red); background: var(--red-light); }

/* ── PROFILE MODAL ───────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 20, 16, 0.5);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 28px 24px 36px;
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  overflow-y: auto;
}

.modal-title {
  font-size: var(--fs-large);
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.modal-footer .btn-ghost { flex: 1; }
.modal-footer .btn-primary { flex: 2; }

/* ── BLOCKS LIST (in modal) ──────────── */
.blocks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.block-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.block-row select,
.block-row input[type="time"] {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--white);
  color: var(--ink);
  min-height: 44px;
}

.block-row select option {
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.block-row select { min-width: 80px; }
.block-row .time-sep { color: var(--ink-faint); font-size: var(--fs-small); }

.block-summary {
  font-size: var(--fs-accent);
  color: var(--ink-faint);
  width: 100%;
  padding-left: 4px;
  margin-top: 2px;
}

/* ── UTILITIES ───────────────────────── */
.hidden { display: none !important; }
