/* PassThePlan — visual design
   Light, calendar/event-app aesthetic: white cards on a soft cool-grey canvas,
   indigo brand + amber accent (matching the app icon), colour-stripped event
   cards. Light-only by design for consistent contrast. */

:root {
  color-scheme: light;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --accent: #f59e0b;
  --accent-soft: #fff7ed;
  --danger: #dc2626;
  --bg: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e8f0;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px rgba(16, 24, 40, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 560px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App bar */
.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.appbar-title { font-size: 1.1rem; margin: 0; font-weight: 700; }
.appbar-spacer { flex: 1; }
.brand-mark {
  display: inline-block;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.icon-btn {
  border: none; background: transparent; color: var(--text);
  font-size: 1.3rem; cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.icon-btn:active { background: var(--border); }

/* Content */
.content {
  flex: 1;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 96px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.content.centered { justify-content: center; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.section-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 8px 2px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Buttons */
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  font-size: 1rem; font-weight: 600; padding: 12px 18px; border-radius: var(--radius-sm);
  transition: transform 0.05s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-dark); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger.ghost { border-color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { padding: 8px 12px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; margin-top: 10px; }
.btn-row.spread { justify-content: space-between; margin-top: 16px; }
.btn-row .btn { flex: 1; }

/* ============================ Landing (marketing) ======================== */
.landing-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: rgba(255, 255, 255, 0.85); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-name { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }

.landing { padding: 0 16px calc(env(safe-area-inset-bottom) + 96px); }

.hero { text-align: center; padding: 36px 8px 28px; }
.hero-mark {
  width: 76px; height: 76px; margin: 0 auto 20px; border-radius: 22px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.35);
}
.hero-title {
  font-size: 2.1rem; line-height: 1.1; margin: 0 0 12px; letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--primary-dark), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { font-size: 1.05rem; color: var(--muted); margin: 0 auto 24px; max-width: 30rem; line-height: 1.5; }
.hero-cta { display: flex; flex-direction: column; gap: 10px; max-width: 22rem; margin: 0 auto; }
.hero-note { margin-top: 14px; font-size: 0.82rem; color: var(--muted); }

.features { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 8px; }
.feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.feature-icon { font-size: 1.5rem; margin-bottom: 8px; }
.feature h3 { margin: 0 0 4px; font-size: 0.98rem; }
.feature p { margin: 0; font-size: 0.85rem; line-height: 1.45; }

.how { margin: 32px 0 8px; }
.how-title, .closing h2 { text-align: center; font-size: 1.4rem; margin: 0 0 18px; letter-spacing: -0.01em; }
.steps { display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step-num {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-dark);
  display: grid; place-items: center; font-weight: 800;
}
.step h3 { margin: 2px 0 2px; font-size: 1rem; }
.step p { margin: 0; font-size: 0.9rem; line-height: 1.45; }

.closing { text-align: center; margin: 40px 0 8px; padding: 28px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

.landing-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border);
}
.footer-link { color: var(--primary-dark); font-weight: 600; font-size: 0.85rem; text-decoration: none; }
.footer-link:hover { text-decoration: underline; }

/* Install gate (create is app-only) */
.install-gate { text-align: center; }
.gate-mark {
  width: 64px; height: 64px; margin: 4px auto 14px; border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.32);
}
.install-gate h2 { margin: 0 0 8px; }
.install-steps {
  text-align: left; margin: 18px auto 6px; padding-left: 22px; max-width: 22rem;
  line-height: 1.5; color: var(--text);
}
.install-steps li { margin: 8px 0; }
.gate-note {
  margin: 16px 0 4px; padding: 10px 12px; font-size: 0.85rem;
  background: var(--primary-soft); color: var(--primary-dark); border-radius: var(--radius-sm);
}

/* Privacy / legal */
.legal h2 { margin: 0 0 4px; }
.legal h3 { margin: 22px 0 6px; font-size: 1.02rem; }
.legal p { line-height: 1.55; margin: 8px 0; }
.legal .lead { font-weight: 600; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; }
.legal ul { margin: 8px 0; padding-left: 20px; line-height: 1.55; }
.legal li { margin: 4px 0; }

@media (min-width: 420px) {
  .hero-title { font-size: 2.4rem; }
}

/* FAB */
.fab {
  position: fixed;
  right: max(16px, calc(50% - var(--maxw) / 2 + 16px));
  bottom: calc(env(safe-area-inset-bottom) + 76px);
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none;
  font-size: 1.8rem; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
  z-index: 20;
}

/* Empty state */
.empty { text-align: center; padding: 40px 16px; }
.empty-mark {
  width: 72px; height: 72px; margin: 0 auto 16px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  opacity: 0.9;
}
.empty h2 { margin: 0 0 8px; }
.empty .btn { margin-top: 16px; }

/* Plan cards — calendar-event style with a coloured left strip */
.plan-card {
  position: relative; width: 100%; text-align: left; cursor: pointer;
  color: var(--text); /* buttons don't inherit text colour — set it explicitly */
  display: flex; gap: 12px; align-items: stretch; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px 14px 20px; margin-bottom: 10px;
  box-shadow: var(--shadow); overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.05s ease;
}
.plan-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
}
.plan-card:hover { box-shadow: 0 2px 4px rgba(16,24,40,.08), 0 8px 20px rgba(16,24,40,.10); }
.plan-card:active { transform: scale(0.995); background: var(--primary-soft); }
.plan-card.is-past { opacity: 0.55; }
.plan-card.is-past::before { background: var(--border); }
.plan-card-title { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.plan-card-meta { color: var(--primary-dark); font-size: 0.9rem; font-weight: 600; margin-top: 3px; }
.plan-card-loc { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.plan-card-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.chip {
  display: inline-block; background: var(--primary-soft); color: var(--primary-dark);
  border-radius: 999px; padding: 3px 10px; font-size: 0.78rem; font-weight: 600; white-space: nowrap;
}
.chip.subtle { background: var(--border); color: var(--muted); }
.chip.inline { margin-left: 8px; }

/* Past */
.past { background: transparent; }
.past > summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: 8px 0; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 600; font-size: 0.9rem; }
.field-hint { font-size: 0.8rem; color: var(--muted); }
.row { display: flex; gap: 12px; }
.row .field { flex: 1; }
input, textarea {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
textarea { resize: vertical; }
.code-field { display: flex; gap: 8px; align-items: stretch; }
.code-field input { text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }
.code-field .btn { white-space: nowrap; }

.warn-inline {
  background: var(--accent-soft); color: #9a3412; border: 1px solid #fed7aa;
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.85rem;
}

/* Share screen */
.success-card { text-align: center; }
.success-mark {
  width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 50%;
  background: #dcfce7; color: #16a34a; display: grid; place-items: center; font-size: 1.6rem; font-weight: 700;
}
.share-block {
  text-align: left; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; margin-top: 14px;
}
.share-block.emphasis { border-color: var(--primary); background: var(--primary-soft); }
.share-label { font-size: 0.8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.share-value { margin: 8px 0; word-break: break-all; font-size: 0.9rem; }
.code-display {
  font-size: 2rem; font-weight: 800; letter-spacing: 0.3em; text-align: center;
  font-family: ui-monospace, monospace; color: var(--primary-dark); padding: 8px 0;
}

/* Unlock screen */
.unlock-card { text-align: center; }
.lock-mark { font-size: 2.4rem; margin-bottom: 8px; }
.code-entry {
  text-align: center; font-size: 1.6rem; font-weight: 800; letter-spacing: 0.3em;
  text-transform: uppercase; margin: 16px 0; font-family: ui-monospace, monospace;
}
.error-text { color: var(--danger); }
.install-hint {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  font-size: 0.85rem; color: var(--muted); text-align: left;
}

/* Plan detail */
.result-banner { padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 600; }
.result-banner.added { background: #dcfce7; color: #166534; }
.result-banner.updated { background: var(--primary-soft); color: var(--primary-dark); }
.organiser { font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.detail-title { margin: 0 0 14px; font-size: 1.4rem; }
.detail-row { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.detail-icon { font-size: 1.1rem; }
.notes { margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); white-space: pre-wrap; border: 1px solid var(--border); }
.past-flag { margin-top: 12px; color: var(--muted); font-style: italic; font-size: 0.9rem; }

/* Reminders */
.reminders-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.reminders-head h3 { margin: 0; }
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.reminder-chip {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 999px; padding: 8px 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.reminder-chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.reminder-chip:disabled { opacity: 0.5; cursor: not-allowed; }
.notif-note { margin: 10px 0 0; }
.plan-actions { display: flex; flex-direction: column; gap: 10px; }

/* Due banner */
.due-banner {
  margin: 0 16px; background: var(--primary-soft); border: 1px solid var(--primary);
  border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
}
.due-row { display: flex; justify-content: space-between; gap: 12px; cursor: pointer; font-size: 0.9rem; }

/* Ad banner */
.ad-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  max-width: var(--maxw); margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.ad-slot { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 52px; }
.ad-tag { font-size: 0.65rem; background: var(--border); color: var(--muted); padding: 2px 6px; border-radius: 4px; text-transform: uppercase; }
.ad-placeholder { flex: 1; color: var(--muted); font-size: 0.85rem; }
.ad-remove { border: 1px solid var(--border); background: transparent; color: var(--primary); border-radius: 8px; padding: 6px 10px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 80px);
  transform: translateX(-50%) translateY(20px);
  background: #1f2430; color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  z-index: 100; max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: #16a34a; }
.toast-error { background: var(--danger); }
