/* Checklist Raic Food · Design System v1.0 */

@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/barlow-condensed-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 900;
  font-display: swap;
  src: url('/assets/fonts/barlow-condensed-900.woff2') format('woff2');
}
@font-face {
  font-family: 'Urbanist';
  font-weight: 300 900;
  font-display: swap;
  src: url('/assets/fonts/urbanist-var.woff2') format('woff2');
}

:root {
  --brand: #FF8601;
  --gold: #FF9726;
  --deep: #A25500;
  --deep-hover: #C06500;
  --grad-fire: linear-gradient(90deg, #FF8601, #A25500);
  --grad-fire-135: linear-gradient(135deg, #FF8601, #A25500);
  --grad-text: linear-gradient(90deg, #FF8601, #FF9726);
  --ease-apple: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --on-brand: #ffffff;
  --radius: 4px;
  --font-title: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Urbanist', system-ui, sans-serif;
  --pad-x: clamp(1.25rem, 4vw, 2.75rem);
}

[data-theme='dark'] {
  --bg: #2E2A26;
  --bg-elev: #050505;
  --card: rgba(17, 17, 17, 0.82);
  --card-solid: #111111;
  --fill-1: rgba(255, 255, 255, 0.015);
  --fill-2: rgba(255, 255, 255, 0.03);
  --fill-3: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.06);
  --t1: #ffffff;
  --t2: rgba(255, 255, 255, 0.72);
  --t3: rgba(255, 255, 255, 0.5);
  --t5: rgba(255, 255, 255, 0.32);
  --t6: rgba(255, 255, 255, 0.14);
  --shadow-card: 0 1.5rem 5rem -1rem rgba(0, 0, 0, 0.9);
  /* Laranja como texto: passa 4,5:1 no fundo escuro. */
  --accent-text: #FF8601;
  color-scheme: dark;
}

[data-theme='light'] {
  --bg: #f4f4f1;
  --bg-elev: #ffffff;
  --card: rgba(255, 255, 255, 0.9);
  --card-solid: #ffffff;
  --fill-1: rgba(0, 0, 0, 0.015);
  --fill-2: rgba(0, 0, 0, 0.028);
  --fill-3: rgba(0, 0, 0, 0.05);
  --line: rgba(0, 0, 0, 0.1);
  --line-2: rgba(0, 0, 0, 0.07);
  --t1: #0b0b0b;
  --t2: rgba(0, 0, 0, 0.74);
  --t3: rgba(0, 0, 0, 0.58);
  --t5: rgba(0, 0, 0, 0.42);
  --t6: rgba(0, 0, 0, 0.2);
  --shadow-card: 0 1.5rem 4rem -1.2rem rgba(0, 0, 0, 0.16);
  /* No fundo claro o #FF8601 não passa 4,5:1 como texto; usar a cor profunda. */
  --accent-text: #A25500;
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--t2);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

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

#svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 1.5rem; height: 1.5rem; flex-shrink: 0;
  stroke: currentColor; fill: none; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 1rem; height: 1rem; }

.boot { text-align: center; padding: 30vh 1rem; color: var(--t3); }

/* ---------- Estrutura ---------- */

.shell {
  max-width: 42rem;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) var(--pad-x) max(1.5rem, env(safe-area-inset-bottom));
}

/* ---------- Cabeçalho ---------- */

.header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0 1.25rem;
}
.header-logo { width: 2.5rem; height: 2.5rem; object-fit: contain; flex-shrink: 0; margin-top: 0.15rem; }
.header-text { flex: 1; min-width: 0; }
.header-title {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 900;
  font-size: clamp(1.5rem, 6vw, 2.25rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--t1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.header-date { margin: 0.2rem 0 0; font-size: 0.875rem; color: var(--t3); }
.header-date::first-letter { text-transform: uppercase; }
.header-actions { display: flex; gap: 0.15rem; flex-shrink: 0; margin-right: -0.5rem; }

.icon-btn {
  width: 44px; height: 44px;
  display: inline-grid; place-items: center;
  background: none; border: 0; border-radius: var(--radius);
  color: var(--t2);
  transition: color 120ms linear, background 120ms linear;
}
.icon-btn:hover { color: var(--accent-text); background: var(--fill-3); }

/* ---------- Abas ---------- */

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.tab {
  min-height: 44px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem;
  padding: 0.7rem 0.9rem;
  background: var(--fill-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  transition: border-color 150ms linear, background 150ms linear;
}
.tab-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--t1);
}
.tab-count { font-size: 0.8rem; color: var(--t3); }
.tab.active { border-color: var(--brand); background: var(--fill-3); box-shadow: inset 0 -2px 0 var(--brand); }
.tab.active .tab-count { color: var(--accent-text); font-weight: 700; }

.using { margin: 1rem 0 0.5rem; font-size: 0.875rem; color: var(--t3); }
.using strong { color: var(--t1); font-weight: 700; }
.link-btn {
  background: none; border: 0; padding: 0.6rem 0.25rem; margin: -0.6rem -0.25rem;
  color: var(--accent-text); font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- Progresso ---------- */

.progress { margin: 0.5rem 0 1.5rem; }
.progress-head {
  display: flex; justify-content: space-between;
  font-size: 0.875rem; color: var(--t3); margin-bottom: 0.4rem;
}
.progress-pct { color: var(--accent-text); font-weight: 700; }
.progress-track { height: 6px; background: var(--fill-3); border-radius: 9999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--grad-fire); border-radius: 9999px; transition: width 300ms var(--ease-apple); }

/* ---------- Grupos e itens ---------- */

.groups { display: grid; gap: 1.5rem; }
.group-title {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 0 0 0.5rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--t3);
}
.group-count { letter-spacing: 0.05em; }

.items {
  list-style: none; margin: 0; padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.item {
  display: flex; gap: 0.25rem;
  padding: 0.35rem 0.85rem 0.35rem 0.25rem;
  border-top: 1px solid var(--line-2);
}
.item:first-child { border-top: 0; }

.item-check {
  position: relative;
  width: 44px; height: 44px; flex-shrink: 0;
  display: grid; place-items: center;
  cursor: pointer;
}
.item-check input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.box {
  width: 1.5rem; height: 1.5rem;
  display: grid; place-items: center;
  border: 1.6px solid var(--t5);
  border-radius: var(--radius);
  transition: background 150ms linear, border-color 150ms linear, transform 250ms var(--ease-back);
}
.box-icon { width: 1.1rem; height: 1.1rem; color: var(--on-brand); opacity: 0; stroke-width: 2.2; }
.item-check input:focus-visible + .box { outline: 2px solid var(--brand); outline-offset: 2px; }
.item.done .box { background: var(--grad-fire-135); border-color: transparent; transform: scale(1.04); }
.item.done .box-icon { opacity: 1; }

.item-body { flex: 1; min-width: 0; padding: 0.6rem 0; }
.item-text { display: block; color: var(--t1); line-height: 1.4; cursor: pointer; }
.item.done .item-text { color: var(--t3); text-decoration: line-through; text-decoration-color: var(--t5); }
.item-meta { margin: 0.2rem 0 0; font-size: 0.8rem; color: var(--t3); }
.item-hint { margin: 0.4rem 0 0; font-size: 0.8rem; color: var(--accent-text); }

.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; }
.tag {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.05rem 0.55rem;
  font-size: 0.72rem; font-weight: 600;
  color: var(--t2);
  border: 1px solid var(--line);
  border-radius: 9999px;
}

.empty { text-align: center; color: var(--t3); padding: 2rem 0; }

/* ---------- Botões ---------- */

.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 44px;
  padding: 0.9rem 1.8rem;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid transparent; border-radius: var(--radius);
  transition: transform 250ms var(--ease-back), background 150ms linear, border-color 150ms linear;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.btn.primary { background: var(--grad-fire); color: var(--on-brand); }
.btn.outline { background: transparent; border-color: var(--line); color: var(--t1); }
.btn.outline:hover { border-color: var(--brand); }
.btn.solid { background: #0b0b0b; color: #ffffff; }
.btn-sm { padding: 0.55rem 1rem; margin-top: 0.5rem; }

/* ---------- Formulários ---------- */

.form { display: grid; gap: 0.5rem; }
.label {
  margin-top: 0.5rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--t3);
}
.input {
  width: 100%; min-height: 48px;
  padding: 0.75rem 0.9rem;
  background: var(--fill-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--t1);
  font-size: 1rem;
}
.input:focus { outline: none; border-color: var(--brand); }
.form .btn { margin-top: 0.75rem; }
.form-error { min-height: 1.4em; margin: 0.25rem 0 0; font-size: 0.875rem; color: var(--accent-text); }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0.5rem; }
.chip {
  min-height: 44px; padding: 0.5rem 1.1rem;
  background: var(--fill-2);
  border: 1px solid var(--line);
  border-radius: 9999px;
  color: var(--t1); font-weight: 600;
}
.chip:hover, .chip.active { border-color: var(--brand); }

/* ---------- Login ---------- */

.login {
  max-width: 24rem;
  margin: 0 auto;
  padding: 12vh var(--pad-x) 2rem;
}
.login-logo { display: block; width: 4.5rem; height: 4.5rem; object-fit: contain; margin-bottom: 1.5rem; }
.login-title {
  margin: 0;
  font-family: var(--font-title); font-weight: 900;
  font-size: clamp(2.5rem, 10vw, 3.5rem); line-height: 1; letter-spacing: -0.03em;
  text-transform: uppercase; color: var(--t1);
}
.login-text { margin: 0.75rem 0 1.25rem; color: var(--t3); }

/* ---------- Modal ---------- */

.backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: end center;
  background: rgba(0, 0, 0, 0.6);
  animation: fade 200ms linear;
}
.modal {
  width: 100%; max-width: 32rem;
  max-height: 90dvh; overflow: auto;
  padding: 1.5rem var(--pad-x) max(1.5rem, env(safe-area-inset-bottom));
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-card);
  animation: rise 500ms var(--ease-apple);
}
@media (min-width: 640px) {
  .backdrop { place-items: center; }
  .modal { border-radius: var(--radius); }
}
.modal-title {
  margin: 0;
  font-family: var(--font-title); font-weight: 900;
  font-size: 1.75rem; line-height: 1.05; text-transform: uppercase; color: var(--t1);
}
.modal-text { margin: 0.5rem 0 0; color: var(--t3); }

/* Pop-up de conclusão: cartão laranja na frente da tela. Texto escuro para passar no contraste. */
.backdrop:has(.celebrate) { place-items: center; padding: 1.25rem; }
.modal.celebrate {
  max-width: 22rem;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  background: linear-gradient(135deg, #FF8601, #FF9726);
  border: 0;
  border-radius: var(--radius);
  color: #0b0b0b;
  animation: pop 450ms var(--ease-back);
}
.celebrate-icon { width: 3.5rem; height: 3.5rem; stroke-width: 1.6; color: #0b0b0b; }
.celebrate-title {
  margin: 0.75rem 0 1.5rem;
  font-family: var(--font-title); font-weight: 900;
  font-size: 2.25rem; line-height: 1; letter-spacing: -0.02em; text-transform: uppercase;
  color: #0b0b0b;
}
.modal.celebrate .btn { width: 100%; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(2rem); opacity: 0; } }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }

/* ---------- Aviso e rodapé ---------- */

.toast {
  position: fixed; left: 50%; bottom: max(1.25rem, env(safe-area-inset-bottom)); z-index: 60;
  max-width: calc(100% - 2.5rem);
  padding: 0.75rem 1.1rem;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  color: var(--t1); font-size: 0.875rem;
  transform: translate(-50%, 200%);
  transition: transform 350ms var(--ease-apple);
}
.toast.show { transform: translate(-50%, 0); }

.signature {
  margin-top: 2.5rem;
  padding: 1rem 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--t3);
}
.signature .heart { color: #FF8601; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

/* ---------- Fase 2: modo dono, barra inferior e edição ---------- */

.shell { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem;
  max-width: 42rem; margin: 0 auto;
  padding: 0.6rem var(--pad-x) max(0.6rem, env(safe-area-inset-bottom));
  background: var(--card-solid);
  border-top: 1px solid var(--line);
}
.bar-btn {
  min-height: 48px; padding: 0.5rem 0.4rem;
  background: var(--fill-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--t1);
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  transition: border-color 150ms linear, background 150ms linear;
}
.bar-btn:hover { border-color: var(--brand); }
.bar-btn.active { background: var(--grad-fire); border-color: transparent; color: var(--on-brand); }

.owner-badge {
  display: inline-block; padding: 0 0.55rem;
  font-size: 0.72rem; font-weight: 700;
  color: var(--accent-text);
  border: 1px solid var(--brand); border-radius: 9999px;
}

.item-actions { display: flex; align-items: center; flex-shrink: 0; margin-right: -0.5rem; }
.item.off .item-text { color: var(--t3); }
.item-check input:disabled { cursor: default; }
.item-check input:disabled + .box { opacity: 0.4; }
button.item-hint { margin: 0.4rem 0 0; padding: 0.5rem 0; font-size: 0.8rem; }

/* Formulário de item */
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.counter { font-size: 0.75rem; color: var(--t3); }
.hint { display: block; margin: 0; font-size: 0.8rem; color: var(--t3); font-weight: 400; letter-spacing: 0; text-transform: none; }
.options { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.option { position: relative; }
.option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.option span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0.4rem 1rem;
  background: var(--fill-2);
  border: 1px solid var(--line);
  border-radius: 9999px;
  color: var(--t2); font-weight: 600; font-size: 0.875rem;
  transition: border-color 120ms linear, background 120ms linear, color 120ms linear;
}
.option input:checked + span { border-color: var(--brand); background: var(--fill-3); color: var(--t1); box-shadow: inset 0 0 0 1px var(--brand); }
.option input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-top: 0.75rem; padding: 0.75rem 0;
  border-top: 1px solid var(--line-2);
  color: var(--t1); cursor: pointer;
}
.switch-row strong { display: block; font-weight: 700; }
.switch-row input {
  appearance: none; -webkit-appearance: none; flex-shrink: 0;
  width: 3rem; height: 1.75rem; margin: 0;
  background: var(--fill-3); border: 1px solid var(--line); border-radius: 9999px;
  position: relative; cursor: pointer;
  transition: background 150ms linear;
}
.switch-row input::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  background: var(--t2);
  transition: transform 250ms var(--ease-back);
}
.switch-row input:checked { background: var(--grad-fire); border-color: transparent; }
.switch-row input:checked::after { transform: translateX(1.25rem); background: #ffffff; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 1.25rem; }
.owner-box { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line-2); display: grid; gap: 0.75rem; }
.input.pin { font-size: 1.5rem; letter-spacing: 0.4em; text-align: center; }

/* Sugestões */
.sug-group { margin-top: 1.25rem; }
.sug-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.sug {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.6rem 0.85rem; border-top: 1px solid var(--line-2);
}
.sug:first-child { border-top: 0; }
.sug-text { display: grid; color: var(--t1); line-height: 1.35; }
.sug-area { font-size: 0.75rem; color: var(--t3); }
.sug .btn-sm { margin-top: 0; flex-shrink: 0; }
