/* =========================================================
   Adorai — sistema de design compartilhado
   Escala de espaçamento e componentes consistentes
   ========================================================= */

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

:root {
  /* Espaçamento — escala de 4px */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s7: 32px;
  --s8: 40px;

  /* Raios */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 999px;

  /* Alvo de toque (mínimo acessível) */
  --tap: 56px;
  --tap-sm: 44px;

  /* Tipografia */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --t1: 28px;
  --t2: 22px;
  --t3: 17px;
  --t4: 15px;
  --t5: 13px;
  --t6: 11px;

  --lh-tight: 1.2;
  --lh-body: 1.5;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-2: 0 6px 20px rgba(0, 0, 0, .10);
  --shadow-3: 0 16px 44px rgba(0, 0, 0, .20);
}

html, body {
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--t3);
  line-height: var(--lh-body);
  color: var(--text, #111);
  background: var(--page, #f2f2f7);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p { margin: 0; }

img { max-width: 100%; display: block; }

/* Container mobile — centraliza em telas grandes */
.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--surface, #fff);
  position: relative;
  overflow-x: hidden;
}
@media (min-width: 520px) {
  .app { box-shadow: var(--shadow-2); }
}

/* =========================================================
   Botões
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  width: 100%;
  min-height: var(--tap);
  padding: var(--s4) var(--s5);
  border: 0;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: var(--t3);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.01em;
  color: inherit;
  background: transparent;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, filter .12s ease, background-color .12s ease;
  text-decoration: none;
}
.btn:active { transform: scale(.985); }
.btn:focus-visible { outline: 3px solid rgba(90, 70, 200, .35); outline-offset: 2px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.btn--primary {
  background: var(--brand, #4c3a86);
  color: #fff;
  box-shadow: 0 6px 18px rgba(76, 58, 134, .28);
}
.btn--primary:active { filter: brightness(.95); }

.btn--ghost {
  background: var(--soft, #f2f2f7);
  color: var(--text, #111);
}

.btn--big { min-height: 56px; font-size: 16px; border-radius: var(--r-md); }

/* =========================================================
   Cartões e blocos
   ========================================================= */
.card {
  background: var(--card, #fff);
  border: 1px solid var(--line, #ececf0);
  border-radius: var(--r-lg);
  padding: var(--s5);
}
.card + .card { margin-top: var(--s4); }

.stack > * + * { margin-top: var(--s4); }
.stack-sm > * + * { margin-top: var(--s3); }
.stack-lg > * + * { margin-top: var(--s6); }

/* =========================================================
   Barra de progresso
   ========================================================= */
.progress {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--line, #e6e6eb);
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--brand, #4c3a86);
  transition: width .35s cubic-bezier(.4, 0, .2, 1);
}

/* =========================================================
   Barra de instalação (morph do botão)
   ========================================================= */
.install-track {
  display: block;
  width: 100%;
  height: 8px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, .35);
  overflow: hidden;
}
.install-track > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #fff;
  transition: width .2s linear;
}

/* =========================================================
   Bottom sheet / modal
   ========================================================= */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  opacity: 0;
  visibility: hidden;
  transition: opacity .24s ease, visibility .24s ease;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-overlay.is-open { opacity: 1; visibility: visible; }

.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--card, #fff);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--s5) var(--s5) calc(var(--s6) + env(safe-area-inset-bottom, 0px));
  transform: translateY(101%);
  transition: transform .32s cubic-bezier(.32, .72, 0, 1);
  max-height: 92dvh;
  overflow-y: auto;
}
.sheet-overlay.is-open .sheet { transform: translateY(0); }

.sheet__handle {
  width: 40px;
  height: 5px;
  border-radius: var(--r-full);
  background: var(--line, #dcdce2);
  margin: 0 auto var(--s4);
}

/* =========================================================
   Linhas de lista
   ========================================================= */
.row {
  display: flex;
  align-items: center;
  gap: var(--s4);
}
.row + .row { margin-top: var(--s4); }
.row__grow { flex: 1; min-width: 0; }

/* =========================================================
   Utilidades
   ========================================================= */
.muted { color: var(--muted, #6b6b74); }
.small { font-size: var(--t4); }
.tiny { font-size: var(--t5); }
.bold { font-weight: 600; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Ícone do app (cantos arredondados) */
.app-icon {
  border-radius: 22.5%;
  object-fit: cover;
  background: #fff;
  box-shadow: var(--shadow-1);
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .3s ease both; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
