/* =====================================================
   AuraBlend - style.css
   Mobile-first web app styles (works on desktop too).
   Smooth scrolling is switched on in the html rule below.
   ===================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
  --plum: #3B0F24;
  --berry: #A3254A;
  --berry-dark: #8A1E3E;
  --blush: #F0D5DD;
  --petal: #F8EAEE;
  --page: #FFF9FA;
  --white: #FFFFFF;
  --muted: #6B5560;
  --line: #E8D3DA;
  --ok: #1E7B4F;
  --ok-bg: #E3F3EA;
  --gold: #B8893A;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --app-width: 430px;
  --tab-height: 72px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- 2. Base + smooth scrolling ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;                       /* smooth scroll for anchors and scrollTo */
  scroll-padding-top: 16px;
  scroll-padding-bottom: calc(var(--tab-height) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #F3E4E9;
  color: var(--plum);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg, img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

:focus-visible { outline: 3px solid var(--berry); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- 3. App shell ---------- */
.app {
  position: relative;
  max-width: var(--app-width);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--page);
  padding-bottom: calc(var(--tab-height) + 24px);
  box-shadow: 0 0 40px rgba(59, 15, 36, 0.08);
}
.app--no-nav { padding-bottom: 32px; }

main { padding: 6px 20px 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack--lg { gap: 22px; }
.stack--sm { gap: 8px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 20px 12px;
}
.topbar--column { flex-direction: column; align-items: stretch; gap: 12px; padding-bottom: 10px; }
.topbar--with-back { padding: 16px 12px 8px; justify-content: flex-start; gap: 4px; }

.logo,
.title,
.h-display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.logo { font-size: 26px; }
.title { font-size: 26px; line-height: 1.2; }
.h2 { font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 1.2; }
.h3 { font-family: var(--font-display); font-weight: 600; font-size: 18px; }

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--berry);
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.note { font-size: 12px; line-height: 1.45; color: var(--muted); }
.tagline {
  margin-top: 56px;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--muted);
}

/* ---------- 4. Pills, dots, chips ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--white);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
}
.pill--demo {
  min-height: 32px;
  border: 0;
  background: var(--petal);
  color: var(--berry);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.dot--off { background: var(--muted); }
.dot--busy { background: var(--berry); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; }
.chips--scroll::-webkit-scrollbar { display: none; }
.chips--equal .chip { flex: 1; min-height: 44px; border-color: var(--plum); }

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 14px;
  font-weight: 700;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.chip[aria-pressed="true"],
.chip.is-active {
  background: var(--plum);
  border-color: var(--plum);
  color: var(--white);
}

/* ---------- 5. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--berry);
  background: var(--white);
  color: var(--berry);
  font-size: 15px;
  font-weight: 700;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.btn:hover { box-shadow: 0 6px 16px rgba(163, 37, 74, 0.18); }
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--berry); color: var(--white); }
.btn--primary:hover { background: var(--berry-dark); }
.btn--block { width: 100%; min-height: 52px; font-size: 16px; }
.btn--sm { min-height: 48px; padding: 0 18px; border-radius: var(--radius-sm); }
.btn--round-sm { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn[disabled],
.btn[aria-disabled="true"] {
  background: var(--blush);
  border-color: transparent;
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.text-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-weight: 700;
  color: var(--berry);
}
.link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  font-size: 14px;
  color: var(--berry);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
}

/* ---------- 6. Hero + lipstick illustration ---------- */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 22px 20px;
  border-radius: var(--radius-lg);
  background: var(--petal);
  overflow: hidden;
}
.hero h1 { max-width: 200px; font-family: var(--font-display); font-weight: 600; font-size: 30px; line-height: 1.1; }
.hero--compact h1 { font-size: 32px; max-width: 220px; }
.hero p { max-width: 210px; color: var(--muted); font-size: 14px; }
.hero .lipstick { position: absolute; right: 22px; bottom: 0; }

.lipstick { display: flex; flex-direction: column; align-items: center; }
.lipstick__bullet {
  width: 46px; height: 78px;
  background: var(--shade, var(--berry));
  border-radius: 23px 23px 3px 3px;
  clip-path: polygon(0 24%, 50% 6%, 100% 0, 100% 100%, 0 100%);
  transition: background 0.25s var(--ease);
}
.lipstick__collar { width: 58px; height: 12px; background: var(--gold); }
.lipstick__tube { width: 58px; height: 64px; background: var(--plum); border-radius: 3px 3px 0 0; }
.lipstick--sm .lipstick__bullet { width: 44px; height: 70px; }
.lipstick--sm .lipstick__collar { width: 56px; height: 10px; }
.lipstick--sm .lipstick__tube { width: 56px; height: 40px; }

/* ---------- 7. Cards and lists ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
}
.card--selected { border: 2px solid var(--berry); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.swatch-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.swatch-row::-webkit-scrollbar { display: none; }
.swatch { flex: 1 0 72px; display: flex; flex-direction: column; align-items: center; gap: 6px; scroll-snap-align: start; }
.swatch__dot { width: 56px; height: 56px; border-radius: 50%; background: var(--c); }
.swatch__name { font-size: 12px; color: var(--muted); text-align: center; }

.pick { display: flex; align-items: center; gap: 14px; }
.pick__color { width: 64px; height: 64px; border-radius: 16px; background: var(--c); flex-shrink: 0; }
.pick__body { flex: 1; min-width: 0; }
.pick__name { font-weight: 700; font-size: 16px; }

/* ---------- 8. Segmented control ---------- */
.segmented { display: flex; padding: 4px; border-radius: var(--radius-pill); background: var(--blush); }
.segmented > * {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  transition: background 0.2s var(--ease);
}
.segmented .is-active { background: var(--white); color: var(--plum); box-shadow: 0 1px 4px rgba(59, 15, 36, 0.08); }

/* ---------- 9. Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 700; }
.input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 16px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.input::placeholder { color: #8C7A83; }
.input:focus { outline: none; border-color: var(--berry); box-shadow: 0 0 0 3px rgba(163, 37, 74, 0.15); }
.input--compact { min-height: 48px; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 52px; }
.input-wrap__btn { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.hint { font-size: 12px; color: var(--muted); }
.form-error { padding: 10px 14px; border-radius: var(--radius-sm); background: #FBE3E8; color: var(--berry-dark); font-size: 14px; font-weight: 500; }

.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--muted); }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--berry); flex-shrink: 0; }
.check a { color: var(--berry); font-weight: 700; }

.divider { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.divider::before,
.divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.search-row { display: flex; gap: 8px; }
.search-row .input { flex: 1; min-width: 0; min-height: 48px; }

/* ---------- 10. Sliders and shade preview ---------- */
.preview {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  background: var(--petal);
}
.preview__hex { font-family: var(--font-display); font-weight: 600; font-size: 34px; line-height: 1; margin: 4px 0; }
.preview__bar { margin-top: 8px; width: 120px; height: 14px; border-radius: 7px; background: var(--shade, var(--berry)); transition: background 0.25s var(--ease); }

.slider { display: flex; flex-direction: column; gap: 2px; }
.slider__row { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; }
input[type="range"] { width: 100%; height: 32px; margin: 0; accent-color: var(--berry); cursor: pointer; }

/* ---------- 11. Ideas + collection ---------- */
.idea { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--radius-md); background: var(--white); border: 1px solid var(--line); }
.idea--top { border: 2px solid var(--berry); }
.idea__color { width: 60px; height: 60px; border-radius: 16px; background: var(--c); flex-shrink: 0; }
.idea__body { flex: 1; min-width: 0; }
.idea__name { font-weight: 700; font-size: 16px; }
.idea .eyebrow { font-size: 11px; letter-spacing: 0.08em; }
.idea[hidden] { display: none; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.shade-card { overflow: hidden; border-radius: var(--radius-md); background: var(--white); border: 1px solid var(--line); animation: pop 0.35s var(--ease) both; }
.shade-card[hidden] { display: none; }
.shade-card__color { height: 92px; background: var(--c); }
.shade-card__body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.shade-card__name { font-weight: 700; font-size: 15px; }
.meta { font-size: 12px; color: var(--muted); }
.badge { margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--berry); }
.badge--plain { font-weight: 500; color: var(--muted); }

.fab {
  position: fixed;
  bottom: calc(var(--tab-height) + 16px);
  right: calc(max(0px, (100vw - var(--app-width)) / 2) + 20px);
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 26px;
  background: var(--berry);
  color: var(--white);
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(163, 37, 74, 0.3);
  transition: transform 0.2s var(--ease);
}
.fab:hover { transform: translateY(-2px); }

/* ---------- 12. Virtual try-on ---------- */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--petal);
  text-align: center;
}
.stage svg { width: 200px; height: 228px; }
.stage img { width: 100%; max-height: 300px; object-fit: cover; border-radius: var(--radius-md); }
#lips { fill: var(--shade, #C7566B); fill-opacity: var(--strength, 0.7); transition: fill 0.25s var(--ease), fill-opacity 0.2s var(--ease); }

.dots { display: flex; align-items: center; gap: 14px; }
.dot-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--c); transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease); }
.dot-btn[aria-pressed="true"] { transform: scale(1.1); box-shadow: 0 0 0 3px var(--page), 0 0 0 5px var(--plum); }

/* ---------- 13. Machine pages ---------- */
.setup-hero { display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: var(--radius-lg); background: var(--petal); }
.setup-hero h1 { font-family: var(--font-display); font-weight: 600; font-size: 32px; line-height: 1.1; max-width: 220px; }
.setup-hero p { color: var(--muted); font-size: 14px; }
.setup-hero__top { display: flex; align-items: center; gap: 12px; }

.icon-circle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--white); color: var(--berry); flex-shrink: 0; }
.icon-circle--ok { background: var(--ok-bg); color: var(--ok); }
.icon-circle--solid { background: var(--berry); color: var(--white); }
.is-ok { color: var(--ok); }

.machine-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius-md); background: var(--white); border: 1px solid var(--line); }
.machine-card--selected { border: 2px solid var(--berry); }
.machine-card__icon { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 14px; background: var(--petal); color: var(--berry); flex-shrink: 0; }
.machine-card__body { flex: 1; min-width: 0; }
.machine-card__label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.machine-card__name { font-weight: 700; font-size: 16px; }
.radio { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--berry); flex-shrink: 0; }
.radio::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--berry); }

.info { display: flex; gap: 10px; align-items: flex-start; }
.info svg { flex-shrink: 0; margin-top: 2px; color: var(--berry); }
.info strong { display: block; font-size: 14px; }
.info p { font-size: 14px; color: var(--muted); }

.fill { display: flex; flex-direction: column; min-height: calc(100vh - 96px - var(--tab-height) - 24px); }
.push { margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; gap: 4px; }

.progress { height: 10px; border-radius: 5px; background: var(--white); overflow: hidden; }
.progress--tint { background: var(--blush); }
.progress > span { display: block; height: 100%; width: var(--p, 0%); border-radius: 5px; background: var(--berry); transition: width 0.6s var(--ease); }
.progress--indeterminate > span { width: 35%; animation: slide 1.4s ease-in-out infinite alternate; }
.progress-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.progress-labels strong { color: var(--plum); }

.spin { animation: spin 1.2s linear infinite; }

.recipe { display: flex; flex-direction: column; gap: 12px; }
.recipe__head { display: flex; align-items: center; gap: 14px; }
.recipe__swatch { width: 52px; height: 52px; border-radius: 14px; background: var(--c); flex-shrink: 0; }
.recipe__name { font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1.15; }
.recipe__batch { margin-left: auto; font-size: 13px; color: var(--muted); }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.bar-row b { width: 56px; }
.bar-row span { width: 36px; text-align: right; }
.bar { flex: 1; height: 10px; border-radius: 5px; background: var(--blush); overflow: hidden; }
.bar > i { display: block; height: 100%; width: var(--v); background: var(--c); }

.tanks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tank { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: var(--radius-sm); background: var(--white); border: 1px solid var(--line); font-size: 12px; }
.tank--low { border-color: var(--berry); }
.tank--low .tank__level { color: var(--berry); font-weight: 700; }
.tank__vessel { display: flex; align-items: flex-end; width: 20px; height: 44px; border-radius: 6px; background: var(--blush); overflow: hidden; }
.tank__vessel i { display: block; width: 100%; height: var(--lvl); background: var(--c); border-radius: 6px; }
.tank__level { color: var(--muted); }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius-sm); background: var(--petal); }
.alert[hidden] { display: none; }
.alert strong { display: block; font-size: 14px; }
.alert p { font-size: 14px; color: var(--muted); }

.job { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--petal); }
.job__head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }

/* ---------- 14. Bottom tab bar ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  display: flex;
  width: 100%;
  max-width: var(--app-width);
  height: var(--tab-height);
  transform: translateX(-50%);
  background: var(--white);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.2s var(--ease);
}
.tab:hover { color: var(--berry); }
.tab[aria-current="page"] { color: var(--berry); box-shadow: inset 0 3px 0 var(--berry); }

/* ---------- 15. Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide { from { margin-left: 0; } to { margin-left: 65%; } }

@media (prefers-reduced-motion: no-preference) {
  main { animation: rise 0.5s var(--ease) both; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- 16. Larger screens ---------- */
@media (min-width: 768px) {
  body { padding: 24px 0; }
  .app { min-height: calc(100vh - 48px); border-radius: 32px; overflow: hidden; }
  .tabbar { bottom: 24px; border-radius: 0 0 32px 32px; }
  .fab { bottom: calc(var(--tab-height) + 40px); }
}
