/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --pink: #EC4899;
  --purple: #8B5CF6;
  --gold: #F59E0B;
  --green: #10B981;
  --bg: #FDF4FF;
  --surface: #FFFFFF;
  --text: #1F2937;
  --muted: #6B7280;
  --border: #E5E7EB;
  --shadow: 0 4px 20px rgba(139,92,246,.12);
  --radius: 16px;
  --nav-h: 68px;
  --bar-h: 56px;
}

html { height: 100%; scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

/* ── Top Bar ─────────────────────────────────────────────────────────────── */
.top-bar {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  text-align: center;
  padding: 16px 20px 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(139,92,246,.3);
}

.top-bar h1 {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -.3px;
}

.top-sub {
  font-size: 0.78rem;
  opacity: .85;
  margin-top: 2px;
  font-weight: 600;
}

/* ── Bottom Nav ──────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1.5px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(0,0,0,.07);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  transition: color .2s;
  padding: 8px 4px 4px;
}

.nav-item.active { color: var(--pink); }
.nav-item .nav-icon { font-size: 1.35rem; line-height: 1; }

/* ── Page Content ────────────────────────────────────────────────────────── */
#page-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(var(--nav-h) + 8px);
}

.page { padding: 16px; max-width: 520px; margin: 0 auto; }

/* ── HOME PAGE ───────────────────────────────────────────────────────────── */
.home-hero {
  text-align: center;
  padding: 28px 16px 24px;
}

.home-hero-emoji { font-size: 4rem; margin-bottom: 12px; animation: bounce 2s infinite; }
@keyframes bounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.home-hero h2 {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--purple);
  margin-bottom: 8px;
}

.home-hero p {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.5;
}

.home-cards { display: flex; flex-direction: column; gap: 12px; }

.home-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: transform .15s, border-color .15s;
  text-align: left;
}

.home-card:active { transform: scale(0.98); }

.hc-icon { font-size: 2.2rem; flex-shrink: 0; }

.hc-info h3 { font-size: 0.95rem; font-weight: 800; color: var(--text); margin-bottom: 3px; }
.hc-info p  { font-size: 0.78rem; color: var(--muted); line-height: 1.4; font-weight: 600; }

.hc-arrow { color: var(--muted); font-size: 1.5rem; flex-shrink: 0; margin-left: auto; }

.home-tip {
  margin-top: 20px;
  background: linear-gradient(135deg, #FFF7ED, #FFF0EB);
  border: 1.5px solid #FFD4C2;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.82rem;
  color: #92400E;
  line-height: 1.5;
  font-weight: 600;
}

/* ── Section Headers ─────────────────────────────────────────────────────── */
.section-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--purple);
  margin-bottom: 4px;
}

.section-sub {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 18px;
  line-height: 1.4;
}

/* ── Form Card ───────────────────────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="tel"],
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  background: #FAFAFA;
  outline: none;
  transition: border-color .2s;
  -webkit-appearance: none;
}

.form-group input[type="text"],
.form-group input[type="tel"] {
  text-transform: uppercase;
}

.form-group input:focus,
.form-group select:focus { border-color: var(--pink); background: #fff; }

.form-group select { cursor: pointer; }

/* ── Radio Group ─────────────────────────────────────────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: 8px; }

.radio-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  transition: border-color .2s, background .2s;
}

.radio-opt:has(input:checked) {
  border-color: var(--pink);
  background: #FFF0F9;
}

.radio-opt input { accent-color: var(--pink); width: 16px; height: 16px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 16px rgba(236,72,153,.35);
}

.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  width: 100%;
  background: #F3F4F6;
  color: var(--purple);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s;
}

.btn-secondary:active { transform: scale(0.97); }

.btn-back {
  background: none;
  border: none;
  color: var(--purple);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  margin-bottom: 14px;
}

.btn-refazer {
  background: rgba(255,255,255,.2);
  border: 1.5px solid rgba(255,255,255,.5);
  color: #fff;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
}

/* ── Result Sections ─────────────────────────────────────────────────────── */
.resultado-hero {
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  color: #fff;
  margin-bottom: 16px;
}

.rh-emoji { font-size: 2.5rem; margin-bottom: 8px; }
.resultado-hero h2 { font-size: 1.3rem; font-weight: 900; margin-bottom: 4px; }
.resultado-hero p  { font-size: 0.82rem; opacity: .9; font-weight: 600; }

.result-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.rs-title {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
}

.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.result-item:last-child { border-bottom: none; }

.ri-name { font-size: 0.88rem; font-weight: 800; color: var(--text); }
.ri-obs  { font-size: 0.72rem; color: var(--muted); margin-top: 2px; font-weight: 600; }

.ri-qty { text-align: right; flex-shrink: 0; margin-left: 12px; }
.ri-num { font-size: 1.15rem; font-weight: 900; color: var(--pink); display: block; }
.ri-unit{ font-size: 0.68rem; color: var(--muted); font-weight: 700; }

/* ── Cardápio ─────────────────────────────────────────────────────────────── */
.cardapio-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.cardapio-item {
  background: #F0FDF4;
  border: 1.5px solid #BBF7D0;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #166534;
}

/* ── Cronograma ───────────────────────────────────────────────────────────── */
.cron-item {
  border-left: 3px solid var(--purple);
  padding: 10px 0 10px 14px;
  margin-bottom: 10px;
}

.cron-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.cron-dias { font-size: 0.82rem; font-weight: 900; color: var(--purple); }
.cron-data { font-size: 0.72rem; color: var(--muted); font-weight: 700; }

.cron-task {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 3px;
  line-height: 1.4;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.resultado-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

/* ── Temas Grid ──────────────────────────────────────────────────────────── */
.temas-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.tema-card {
  border-radius: var(--radius);
  padding: 0;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s;
  border: 2px solid transparent;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  position: relative;
}

.tema-card:active { transform: scale(0.95); }

.tc-emoji { font-size: 2rem; margin-bottom: 6px; }
.tc-name  { font-size: 0.68rem; font-weight: 800; color: #1F2937; line-height: 1.3; }

/* Nome sobre imagem */
.tc-name-img {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
  padding: 5px 4px;
  line-height: 1.2;
  border-radius: 0 0 var(--radius) var(--radius);
  text-align: center;
}

/* ── Tema Detalhe ────────────────────────────────────────────────────────── */
.tema-hero {
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  margin-bottom: 16px;
}

.th-emoji { font-size: 3.5rem; margin-bottom: 8px; }
.tema-hero h2 { font-size: 1.3rem; font-weight: 900; color: #1F2937; }

.tema-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.tema-item:last-child { border-bottom: none; }

.ti-num {
  background: var(--purple);
  color: #fff;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 900;
  flex-shrink: 0; margin-top: 1px;
}

.ti-txt { font-size: 0.85rem; font-weight: 700; color: var(--text); line-height: 1.4; }

/* ── Convite / Foto Upload ───────────────────────────────────────────────── */
.photo-upload {
  display: block;
  cursor: pointer;
  border: 2.5px dashed var(--pink);
  border-radius: 12px;
  overflow: hidden;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFF0F9;
}

.photo-placeholder {
  text-align: center;
  color: var(--pink);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 24px;
  line-height: 1.8;
}

.photo-placeholder span,
.photo-placeholder br + * { font-size: 2rem; }

.photo-preview-img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

/* ── Canvas / Convite Result ─────────────────────────────────────────────── */
.convite-result {
  margin-top: 16px;
}

.convite-canvas-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  margin-bottom: 14px;
}

.convite-canvas-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 12px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1F2937;
  color: #fff;
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  z-index: 9999;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Loading ─────────────────────────────────────────────────────────────── */
.loading-spinner {
  text-align: center;
  padding: 40px 20px;
  font-size: 2rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Tema Selected ───────────────────────────────────────────────────────────── */
.tema-selected {
  outline: 3px solid #fff;
  outline-offset: 2px;
  transform: scale(1.06);
  box-shadow: 0 0 0 5px var(--pink), 0 8px 24px rgba(236,72,153,.4);
}

/* ── Tema Pill ───────────────────────────────────────────────────────────────── */
.tema-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 7px 14px;
  border-radius: 100px;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}

/* ── Prompt Box ──────────────────────────────────────────────────────────────── */
.prompt-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  box-shadow: var(--shadow);
  border: 2px solid #E0E7FF;
}

.pb-titulo {
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--purple);
  margin-bottom: 14px;
}

.pb-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  background: #F5F3FF;
  border-radius: 12px;
  padding: 14px;
}

.pb-step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ps-num {
  background: var(--purple);
  color: #fff;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 900;
  flex-shrink: 0;
}

.ps-txt {
  font-size: 0.82rem;
  font-weight: 700;
  color: #374151;
}

.pb-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.pb-prompt {
  background: #F9FAFB;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.78rem;
  color: #374151;
  font-weight: 600;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  margin-bottom: 10px;
  user-select: text;
  -webkit-user-select: text;
}

.btn-copy {
  width: 100%;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s;
}

.btn-copy:active { transform: scale(0.97); }

.pb-aviso {
  margin-top: 12px;
  font-size: 0.75rem;
  color: #6B7280;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
}

.pb-placeholder {
  text-align: center;
  padding: 24px 16px;
  color: #9CA3AF;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--surface);
  border-radius: var(--radius);
  margin-top: 14px;
  border: 2px dashed var(--border);
}

.photo-tip {
  font-size: 0.72rem;
  color: #8B5CF6;
  font-weight: 700;
  margin-top: 6px;
  text-align: center;
}

/* ── Toggle Com/Sem foto ─────────────────────────────────────────────────────── */
.ft-toggle {
  display: flex;
  gap: 10px;
}

.ft-btn {
  flex: 1;
  padding: 13px 8px;
  border: 2.5px solid var(--border);
  border-radius: 12px;
  background: #F9FAFB;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
  transition: all .18s;
}

.ft-btn.ft-active {
  border-color: var(--pink);
  background: #FFF0F9;
  color: var(--pink);
  box-shadow: 0 2px 12px rgba(236,72,153,.2);
}

/* ── Seletor de Fundo ────────────────────────────────────────────────────────── */
.fundos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.fundo-opt {
  aspect-ratio: 9/16;
  border-radius: 10px;
  border: 3px solid transparent;
  background-size: cover;
  background-position: center top;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform .15s, border-color .15s;
}

.fundo-opt:active { transform: scale(0.96); }

.fundo-opt.fundo-active {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(236,72,153,.35);
}

.fundo-num {
  position: absolute;
  bottom: 5px;
  right: 7px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.fundo-placeholder {
  background: linear-gradient(135deg,#DC2626,#2563EB);
  display: flex; align-items: center; justify-content: center;
}

.fundo-loading {
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* ── Login Page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FDF4FF, #FFF0F9, #F5F3FF);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 40px 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(139,92,246,.15);
  border: 2px solid rgba(236,72,153,.12);
}

.login-emoji { font-size: 4rem; margin-bottom: 12px; animation: bounce 2s infinite; }

.login-title {
  font-size: 1.8rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 20px;
}

.login-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--pink), transparent);
  margin: 0 auto 24px;
  width: 60%;
}

.login-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}

.login-card input[type="text"] {
  width: 100%;
  padding: 16px;
  border: 2.5px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text);
  text-align: center;
  letter-spacing: 4px;
  background: #FAFAFA;
  outline: none;
  transition: border-color .2s;
  margin-bottom: 16px;
}

.login-card input[type="text"]:focus {
  border-color: var(--pink);
  background: #fff;
}

.login-error {
  color: #EF4444;
  font-size: 0.82rem;
  font-weight: 800;
  margin-top: 12px;
  min-height: 20px;
}

.login-hint {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 16px;
  line-height: 1.4;
}

/* ── Responsive fixes ────────────────────────────────────────────────────── */
@media (min-width: 420px) {
  .temas-grid { grid-template-columns: repeat(4, 1fr); }
}
