/* ============================================================
   VESTA — Components
   ============================================================ */

/* ---- App shell ---- */
.shell {
  max-width: var(--app-max);
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  background: var(--bg);
  display: flex; flex-direction: column;   /* main cresce, nav gruda no fim */
}
.shell > main { flex: 1 0 auto; width: 100%; }
@media (min-width: 560px) {
  body { background: #E8E4DE; }
  .shell { box-shadow: 0 0 0 1px var(--line), 0 18px 60px rgba(48,36,26,.14); }
}

.screen {
  display: none;
  padding-bottom: var(--sp-8);   /* a nav agora é sticky em fluxo, não cobre conteúdo */
  min-height: calc(100dvh - var(--nav-h) - var(--safe-b));
}
.screen.active { display: block; animation: screen-in var(--t-slow) var(--ease-out) both; }
.screen.leaving { animation: screen-out var(--t-fast) var(--ease-in) both; }

.screen-pad { padding-inline: var(--sp-5); }

/* ---- Top bar inside screens ---- */
.topbar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
}
.topbar .serif { font-size: var(--fs-24); }
.topbar-spacer { flex: 1; }

.back-btn {
  width: 44px; height: 44px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.back-btn svg { width: 18px; height: 18px; }

/* ---- Section headers ---- */
.sec {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: var(--sp-8) 0 var(--sp-4);
}
.sec h2 { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-20); }
.sec .link { font-size: var(--fs-13); font-weight: 500; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 4px; transition: color var(--t-fast) var(--ease-out); }
.sec .link:hover { color: var(--rust); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 48px; padding: 0 var(--sp-6);
  border-radius: var(--r-pill);
  font-weight: 600; font-size: var(--fs-15);
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out),
              opacity var(--t-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }

.btn-primary { background: var(--chrome); color: var(--on-chrome); box-shadow: var(--shadow-1); }
.btn-primary:hover { background: #1C1C23; box-shadow: var(--shadow-2); }
.btn-rust { background: var(--rust); color: #fff; box-shadow: var(--shadow-1); }
.btn-rust:hover { background: var(--rust-deep); box-shadow: var(--shadow-2); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink-soft); }
.btn-soft { background: var(--rust-tint); color: var(--rust-deep); }
.btn-soft:hover { background: #F2DFD5; }
.btn-sm { min-height: 38px; padding: 0 var(--sp-4); font-size: var(--fs-13); }
.btn-block { width: 100%; }

.btn .spinner { display: none; }
.btn.loading { pointer-events: none; }
.btn.loading .spinner { display: block; }
.btn.loading .btn-label { opacity: .6; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite;
}

/* ---- Icon button ---- */
.icon-btn {
  width: 44px; height: 44px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---- Heart ---- */
.heart-btn { color: var(--ink-soft); }
.heart-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; transition: fill var(--t-fast), color var(--t-fast); }
.heart-btn.on { color: var(--rust); }
.heart-btn.on svg { fill: var(--rust); animation: heart-pop 460ms var(--ease-spring); }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.card-line { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }

/* ---- Pills / chips ---- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line);
  font-size: var(--fs-12); font-weight: 500; color: var(--ink-soft);
}
.chip-row { display: flex; gap: var(--sp-2); overflow-x: auto; padding-block: 2px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 9px 18px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line-strong);
  font-size: var(--fs-13); font-weight: 500; color: var(--ink-soft);
  transition: background var(--t-base) var(--ease-out), color var(--t-base) var(--ease-out),
              border-color var(--t-base) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.chip:active { transform: scale(.95); }
.chip.on { background: var(--chrome); color: var(--on-chrome); border-color: var(--chrome); }

/* ---- Segmented tabs (underline style) ---- */
.tabs { display: flex; gap: var(--sp-6); border-bottom: 1px solid var(--line); position: relative; }
.tabs .tab {
  padding: var(--sp-3) 2px; font-size: var(--fs-14); font-weight: 500; color: var(--ink-faint);
  transition: color var(--t-base) var(--ease-out);
  position: relative;
}
.tabs .tab.on { color: var(--ink); }
.tabs .tab-ink {
  position: absolute; bottom: -1px; left: 0; height: 2px; width: 1px;
  background: var(--ink); border-radius: 2px;
  transform-origin: 0 50%;
  transition: transform var(--t-slow) var(--ease-out);
}

/* ---- Inputs ---- */
.field { display: grid; gap: 6px; }
.field label { font-size: var(--fs-13); font-weight: 500; color: var(--ink-soft); }
.input {
  width: 100%; min-height: 50px; padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface); border: 1.5px solid var(--line-strong);
  transition: border-color var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out);
}
.input::placeholder { color: #9A968E; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(37,37,45,.08); }
.input.err { border-color: var(--danger); }
.field .msg { font-size: var(--fs-12); color: var(--danger); min-height: 1em; }

/* ---- Bottom navigation ----
   Sticky no fim do shell: dimensiona pelo shell (nunca pela viewport com
   scrollbar), fica sempre centrada e sempre visível ao rolar. */
.bottom-nav {
  position: sticky; bottom: 0;
  width: 100%; margin-top: auto;
  background: var(--chrome);
  padding-bottom: var(--safe-b);
  box-shadow: var(--shadow-nav);
  z-index: 60;
  border-radius: 18px 18px 0 0;
}
.bottom-nav .nav-row {
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: var(--nav-h); align-items: center; position: relative;
}
.nav-item {
  display: grid; justify-items: center; gap: 3px;
  color: var(--on-chrome-soft);
  font-size: 0.625rem; font-weight: 500; letter-spacing: .02em;
  transition: color var(--t-base) var(--ease-out), transform var(--t-fast) var(--ease-out);
  position: relative; z-index: 1;
}
.nav-item svg { width: 22px; height: 22px; transition: transform var(--t-base) var(--ease-spring); }
.nav-item:active svg { transform: scale(.85); }
.nav-item.on { color: var(--on-chrome); }
.nav-item.on svg { transform: translateY(-1px); }
.nav-dot {
  position: absolute; top: 6px; height: 3px; width: 20px; border-radius: 3px;
  background: var(--rust-ember);
  transition: left var(--t-slow) var(--ease-out);
}
.nav-fab {
  width: 48px; height: 48px; border-radius: var(--r-pill);
  background: var(--on-chrome); color: var(--chrome);
  display: grid; place-items: center; margin: 0 auto;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  transition: transform var(--t-fast) var(--ease-spring), background var(--t-fast) var(--ease-out);
}
.nav-fab:active { transform: scale(.9) rotate(90deg); }
.nav-fab svg { width: 22px; height: 22px; }

/* ---- Overlay / modal / sheet ---- */
.overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(30, 26, 22, .45);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: fade-in var(--t-base) var(--ease-out) both;
  display: flex; align-items: flex-end; justify-content: center;
}
.overlay.center { align-items: center; padding: var(--sp-5); }
.overlay.closing { animation: fade-out var(--t-fast) var(--ease-in) both; }

.sheet {
  width: 100%; max-width: var(--app-max);
  max-height: 88dvh; overflow-y: auto; overflow-x: hidden;  /* sheet nunca arrasta de lado */
  background: var(--bg-warm);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--sp-3) var(--sp-5) calc(var(--sp-8) + var(--safe-b));
  animation: sheet-up var(--t-slow) var(--ease-out) both;
}
.overlay.closing .sheet { animation: sheet-down var(--t-base) var(--ease-in) both; }
.sheet-grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: var(--sp-2) auto var(--sp-4); }

.dialog {
  width: 100%; max-width: 420px;
  background: var(--bg-warm);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  animation: pop-in var(--t-slow) var(--ease-out) both;
  max-height: 86dvh; overflow-y: auto; overflow-x: hidden;
}
.overlay.closing .dialog { animation: fade-out var(--t-fast) var(--ease-in) both; }

/* ---- Toast ---- */
.toast-wrap {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--safe-b) + var(--sp-4));
  z-index: 120; display: grid; gap: var(--sp-2); justify-items: center;
  pointer-events: none; width: min(92vw, 420px);
}
.toast {
  background: var(--chrome); color: var(--on-chrome);
  border-radius: var(--r-md); padding: 11px 18px;
  font-size: var(--fs-13); font-weight: 500;
  box-shadow: var(--shadow-2);
  animation: pop-in var(--t-base) var(--ease-out) both;
  display: flex; gap: 8px; align-items: center;
}
.toast.bye { animation: fade-out var(--t-base) var(--ease-in) both; }
.toast.ok::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #74C69D; }
.toast.err::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #E07A5F; }

/* ---- Horizontal scrollers ---- */
.hscroll {
  display: flex; gap: var(--sp-3);
  overflow-x: auto; overscroll-behavior-x: contain;
  padding: 2px var(--sp-5) var(--sp-2);
  margin-inline: calc(-1 * var(--sp-5));
  scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex: 0 0 auto; }

/* ---- Empty state ---- */
.empty {
  display: grid; justify-items: center; gap: var(--sp-3);
  padding: var(--sp-10) var(--sp-6); text-align: center;
}
.empty .empty-art {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--surface-2); display: grid; place-items: center; color: var(--ink-faint);
}
.empty .empty-art svg { width: 30px; height: 30px; }
.empty h3 { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-16); }
.empty p { font-size: var(--fs-13); color: var(--ink-soft); max-width: 30ch; }

/* ---- Match badge ---- */
.match-badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(255,255,255,.92);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  border-radius: var(--r-pill); padding: 4px 10px;
  font-size: var(--fs-11); font-weight: 600; color: var(--ink);
  display: inline-flex; align-items: center; gap: 4px;
}
.match-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

/* ---- Image frame with built-in shimmer until loaded ---- */
.imgbox { position: relative; overflow: hidden; background: #E9E5DF; }
.imgbox img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--t-slow) var(--ease-out); }
.imgbox img.ready { opacity: 1; }
.imgbox::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, #E9E5DF 40%, #F5F2ED 50%, #E9E5DF 60%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  transition: opacity var(--t-base);
  pointer-events: none;   /* decorativo: ficava invisível POR CIMA da foto engolindo toques (zoom do chat nunca abria no dedo) */
}
.imgbox.loaded::before { opacity: 0; animation: none; }

/* ---- Tutorial "adicione à tela inicial" (pin.js, 1x pra conta nova) ---- */
.pin-tuto { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); padding-top: var(--sp-2); }
.pin-icone { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow-2); margin-bottom: var(--sp-2); }
.pin-titulo { font-size: 22px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; margin: 0; }
.pin-sub { font-size: 14px; color: var(--ink-soft); line-height: 1.5; margin: 0 var(--sp-3) var(--sp-2); }
.pin-passos { list-style: none; margin: 0 0 var(--sp-3); padding: 0; width: 100%; display: flex; flex-direction: column; gap: var(--sp-2); text-align: left; }
.pin-passo { display: flex; align-items: center; gap: var(--sp-3); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; padding: 12px 14px; }
.pin-n { flex: none; width: 24px; height: 24px; border-radius: 9999px; background: var(--rust); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.pin-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--rust-tint); color: var(--rust-deep); display: inline-flex; align-items: center; justify-content: center; }
.pin-ico svg { width: 20px; height: 20px; }
.pin-passo p { margin: 0; font-size: 14px; color: var(--ink); line-height: 1.4; }
.pin-passo b { font-weight: 600; }
.pin-tuto .btn + .btn { margin-top: calc(var(--sp-2) * -1 + 4px); }
