:root {
  --bg: #0b0b1a;
  --card: #15152b;
  --card-border: #2c2c58;
  --text: #f3f3fb;
  --muted: #a4a4c4;
  --accent: #46e6d4;       /* teal glow */
  --accent-ink: #04201d;   /* text on accent buttons */
  --accent2: #8d6bff;      /* violet glow */
  --danger: #ff6b81;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 0%, rgba(141, 107, 255, 0.20), transparent 45%),
    radial-gradient(circle at 92% 8%, rgba(70, 230, 212, 0.13), transparent 40%),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: auto, auto, 36px 36px, 36px 36px;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5rem; letter-spacing: 0.01em; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--accent); }

.container { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 3rem; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0.75rem 1rem;
  background: rgba(11, 11, 26, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--card-border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand img { width: 36px; height: 36px; border-radius: 8px; }
.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-email {
  color: var(--muted); font-size: 0.85rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 0 24px rgba(141, 107, 255, 0.08);
}
.card h2 { display: flex; align-items: center; gap: 8px; }
.card h2::before {
  content: ""; width: 4px; height: 1.1em; border-radius: 2px;
  background: linear-gradient(var(--accent), var(--accent2));
}

.hint { color: var(--muted); font-size: 0.88rem; margin: 0 0 0.6rem; }
.error { color: var(--danger); }
.empty { color: var(--muted); font-style: italic; margin-bottom: 0.75rem; }

/* ---------- Forms ---------- */
label.field { display: block; font-weight: 600; font-size: 0.92rem; margin: 0.9rem 0 0.25rem; }

input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px; /* prevents zoom on iPhones */
  color: var(--text);
  background: #0e0e22;
  border: 1px solid var(--card-border);
  border-radius: 10px;
}
textarea { resize: vertical; }
select option { background: var(--card); color: var(--text); }
input::placeholder, textarea::placeholder { color: #6f6f94; }

input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, .switch input:focus-visible + .track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.input-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 0.5rem; }
.input-row input { flex: 1 1 160px; width: auto; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 14px; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 44px;
  padding: 10px 18px;
  font: inherit; font-weight: 700;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), #7ad8ff);
  border: none; border-radius: 10px; cursor: pointer;
  box-shadow: 0 0 16px rgba(70, 230, 212, 0.35);
  transition: transform 0.1s, box-shadow 0.2s;
}
.btn:hover { box-shadow: 0 0 24px rgba(70, 230, 212, 0.6); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: wait; box-shadow: none; }
.btn-big { width: 100%; font-size: 1.1rem; padding: 14px 18px; margin-top: 0.75rem; }

.btn-ghost {
  min-height: 40px; padding: 8px 14px;
  font: inherit; font-size: 0.9rem; font-weight: 600;
  color: var(--text); background: transparent;
  border: 1px solid var(--card-border); border-radius: 10px; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Chips (pantry + cookware items) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 0.5rem; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 6px 6px 12px;
  background: #1d1d3d; border: 1px solid var(--card-border); border-radius: 999px;
  font-size: 0.95rem;
}
.chip button {
  width: 28px; height: 28px; padding: 0;
  font-size: 1.1rem; line-height: 1;
  color: var(--muted); background: transparent;
  border: none; border-radius: 50%; cursor: pointer;
}
.chip button:hover { color: var(--danger); background: rgba(255, 107, 129, 0.12); }

/* ---------- Toggle switch ---------- */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; margin-top: 0.4rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  position: relative; width: 46px; height: 26px; flex: none;
  background: #0e0e22; border: 1px solid var(--card-border); border-radius: 999px;
  transition: background 0.2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: var(--muted);
  transition: transform 0.2s, background 0.2s;
}
.switch input:checked + .track { background: rgba(70, 230, 212, 0.25); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); background: var(--accent); }

/* ---------- Welcome steps ---------- */
.welcome { border-color: var(--accent2); box-shadow: 0 0 28px rgba(141, 107, 255, 0.25); }
.steps { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.steps li { margin-bottom: 0.3rem; }

/* ---------- Recipes ---------- */
#recipe-results { margin-top: 1rem; }
.recipe-card {
  background: #101024;
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.recipe-card h3 { color: var(--accent); font-size: 1.15rem; }
.recipe-card h4 { margin-top: 0.9rem; color: var(--accent2); }
.recipe-card ul, .recipe-card ol { padding-left: 1.4rem; margin: 0.4rem 0 0.75rem; }
.recipe-card li { margin-bottom: 0.3rem; }

/* ---------- Login page ---------- */
.hero { text-align: center; padding: 2.5rem 0 1rem; }
.hero img { width: 96px; height: 96px; border-radius: 20px; box-shadow: 0 0 32px rgba(141, 107, 255, 0.5); }
.hero h1 { font-size: 2rem; margin-top: 1rem; }
.hero p { color: var(--muted); font-size: 1.05rem; max-width: 460px; margin: 0.5rem auto 1.5rem; }
.feature-list { display: grid; gap: 12px; margin: 1.5rem 0; }
.feature-list .card { margin: 0; padding: 1rem 1.1rem; }
.feature-list h3 { color: var(--accent); margin-bottom: 0.2rem; }
.feature-list p { color: var(--muted); margin: 0; }

.disclaimer {
  margin-top: 2rem; padding-top: 1rem;
  border-top: 1px solid var(--card-border);
  font-size: 0.82rem; color: var(--muted);
}

@media (max-width: 480px) {
  .user-email { display: none; }
  .hero h1 { font-size: 1.6rem; }
}