/* ============================================================================
   Corretor avulso — mini-app (order bump, cobrado por crédito)
   Mesma identidade visual do app principal (css/styles.css), versão reduzida:
   só o essencial pra tela de login e a tela de correção.

   TEMA: claro (creme) é o padrão (:root). O escuro fica em [data-theme="dark"],
   ligado pelo botão de alternar tema (ver js/theme.js) e lembrado no
   localStorage.
   ============================================================================ */

:root {
  --bg:        #faf6ec;
  --bg-2:      #f3ecda;
  --card:      #ffffff;
  --card-2:    #f7f1e2;
  --line:      #e7dcc3;
  --text:      #2b2419;
  --text-soft: #4d4330;
  --muted:     #8c7f66;
  --purple:    #5b3dc0;
  --purple-2:  #7a5aeb;
  --orange:    #e8501f;
  --orange-2:  #ff7a58;
  --lime:      #6e7c1c;
  --lime-2:    #566016;
  --green:     #1c8f63;
  --red:       #c93548;
  --lime-tint: rgba(110,124,28,.08);
  --red-tint:  rgba(201,53,72,.08);
  --gate-glow: #f7ecc9;
  --radius:    16px;
  --shadow:    0 16px 50px rgba(60,45,10,.10);
}

:root[data-theme="dark"] {
  --bg:        #100e22;
  --bg-2:      #17142e;
  --card:      #1e1a38;
  --card-2:    #262048;
  --line:      #342e56;
  --text:      #eeeaf8;
  --text-soft: #ded8ee;
  --muted:     #9f97c0;
  --purple:    #6a4bd6;
  --purple-2:  #8c6dff;
  --orange:    #ff5c33;
  --orange-2:  #ff7a58;
  --lime:      #cbe84a;
  --lime-2:    #dbf16f;
  --green:     #2fc281;
  --red:       #ff6b7a;
  --lime-tint: rgba(203,232,74,.08);
  --red-tint:  rgba(255,107,122,.1);
  --gate-glow: #2a1f52;
  --shadow:    0 16px 50px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
  transition: background-color .15s ease, color .15s ease;
}
h1, h2, h3, h4 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; line-height: 1.15; }
a { color: var(--lime-2); }
.gold { color: var(--lime); }

/* ---------- Botão de alternar tema ---------- */
.theme-toggle {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.theme-toggle:hover { border-color: var(--purple); }

/* ---------- Tela de login (só e-mail) ---------- */
.gate {
  min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative;
  background: radial-gradient(1100px 600px at 50% -10%, var(--gate-glow) 0%, var(--bg) 55%);
}
.gate-theme-toggle { position: absolute; top: 18px; right: 18px; }
.gate-card {
  width: 100%; max-width: 430px; background: var(--card); border: 1px solid var(--line);
  border-radius: 22px; padding: 40px 32px; text-align: center; box-shadow: var(--shadow);
}
.gate-badge {
  display: inline-block; font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--lime); border: 1px solid rgba(110,124,28,.35); border-radius: 999px; padding: 6px 14px; margin-bottom: 22px;
}
:root[data-theme="dark"] .gate-badge { border-color: rgba(203,232,74,.35); }
.gate-title { font-size: 40px; margin: 0 0 10px; }
.gate-sub { color: var(--muted); margin: 0 0 24px; font-size: 15px; }
#gate-email-form { display: flex; flex-direction: column; gap: 12px; }
#gate-email {
  padding: 15px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2);
  color: var(--text); font-size: 16px; text-align: center; font-family: inherit;
}
#gate-email:focus { outline: none; border-color: var(--purple); }
#gate-email-form button {
  padding: 15px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
  color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; font-family: inherit;
}
#gate-email-form button:disabled { opacity: .6; cursor: wait; }
.gate-error { color: var(--red); font-size: 14px; margin: 14px 0 0; line-height: 1.5; }
.gate-ok { color: var(--green); font-size: 14px; margin: 14px 0 0; line-height: 1.5; }
.gate-help { color: var(--muted); font-size: 14px; margin: 22px 0 0; }

/* ---------- App (após login) ---------- */
.app-shell { max-width: 760px; margin: 0 auto; padding: 28px 20px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; gap: 12px; flex-wrap: wrap; }
.brand-name { font-family: 'Fraunces', serif; font-size: 21px; font-weight: 700; }
.saldo-badge {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 16px; font-size: 13.5px; font-weight: 600;
}
.saldo-badge b { color: var(--lime); font-family: 'Fraunces', serif; font-size: 16px; }
.sair-link { background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; text-decoration: underline; }

.page-head { margin-bottom: 20px; }
.page-title { font-size: 26px; margin: 0 0 6px; }
.page-sub { color: var(--muted); margin: 0; font-size: 15px; }

.saldo-zero-box {
  background: var(--card); border: 1px solid var(--orange); border-radius: var(--radius);
  padding: 24px; text-align: center; margin-bottom: 20px;
}
.saldo-zero-box h3 { margin: 0 0 8px; font-size: 18px; }
.saldo-zero-box p { color: var(--muted); margin: 0 0 20px; font-size: 14px; }

.planos-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; text-align: center; }
.plano-card {
  position: relative; background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px 16px 18px; display: flex; flex-direction: column; align-items: center;
}
.plano-card.destaque { border-color: var(--lime); background: var(--card-2); }
.plano-card.assinatura { border-color: var(--purple-2); background: var(--card-2); }
.plano-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--lime); color: #fff; font-size: 11px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px; letter-spacing: .02em; white-space: nowrap;
}
:root[data-theme="dark"] .plano-badge { color: #1a2200; }
.plano-badge.badge-assinatura { background: var(--purple-2); color: #fff; }
:root[data-theme="dark"] .plano-badge.badge-assinatura { color: #1c1436; }
.plano-nome { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
.plano-creditos { font-family: 'Fraunces', serif; font-size: 26px; font-weight: 700; color: var(--text); }
.plano-creditos span { font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 400; color: var(--muted); }
.plano-equiv { font-size: 12.5px; color: var(--muted); margin: 4px 0 14px; }
.plano-preco { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 700; color: var(--lime); margin-bottom: 4px; }
.plano-preco .plano-periodo { font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 400; color: var(--muted); }
.plano-recorrencia { font-size: 11px; color: var(--muted); margin-bottom: 14px; }
.plano-btn { width: 100%; text-align: center; text-decoration: none; box-sizing: border-box; }

@media (max-width: 860px) {
  .planos-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .planos-grid { grid-template-columns: 1fr; }
}

.corrigir-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin: 4px 0 6px; font-weight: 500; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.field-label-row .field-label { margin: 4px 0; }
.corrigir-card textarea { margin-bottom: 0; }
.tema-row { display: flex; gap: 8px; margin-bottom: 6px; }
#tema, #redacao { width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; color: var(--text); font-family: inherit; font-size: 15px; padding: 14px; }
#tema:focus, #redacao:focus { outline: none; border-color: var(--purple); }
#redacao { resize: vertical; line-height: 1.6; }

.foto-hint { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.foto-status { font-size: 13px; padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.foto-status.loading { background: var(--lime-tint); border: 1px solid var(--lime); color: var(--text); }
.foto-status.erro { background: var(--red-tint); border: 1px solid var(--red); color: var(--red); }
.foto-status.ok { background: var(--lime-tint); border: 1px solid var(--lime); color: var(--text); }
.foto-status .mini-spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--lime); border-radius: 50%; animation: spin .8s linear infinite; flex: 0 0 auto; }

.editor-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 12px; flex-wrap: wrap; }
.editor-info { display: flex; flex-direction: column; gap: 2px; }
.contador { font-size: 13px; color: var(--muted); }
.restantes { font-size: 11.5px; color: var(--lime); }

.ghost-btn { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 10px 14px; border-radius: 10px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.ghost-btn:hover { border-color: var(--purple); color: var(--text); }
.ghost-btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.ghost-btn:disabled { opacity: .5; cursor: not-allowed; }
.primary-btn { background: linear-gradient(135deg, var(--orange), var(--orange-2)); border: none; color: #fff; padding: 13px 24px; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer; }
.primary-btn:disabled { opacity: .5; cursor: not-allowed; }

.corrigindo { text-align: center; padding: 30px; color: var(--muted); }
.spinner { width: 38px; height: 38px; margin: 0 auto 14px; border: 3px solid var(--line); border-top-color: var(--lime); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.resultado { margin-top: 24px; }
.nota-hero { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 26px; margin-bottom: 18px; }
.nota-hero .big { font-family: 'Fraunces', serif; font-size: 60px; font-weight: 700; color: var(--lime); line-height: 1; }
.nota-hero .max { color: var(--muted); font-size: 20px; }
.nota-hero .label { color: var(--muted); margin-top: 6px; font-size: 14px; }
.comp-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 10px; }
.comp-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.comp-nome { font-size: 14px; font-weight: 600; }
.comp-nota { font-family: 'Fraunces', serif; font-weight: 700; font-size: 20px; }
.comp-bar { height: 6px; background: var(--bg-2); border-radius: 999px; margin: 10px 0; overflow: hidden; }
.comp-bar-fill { height: 100%; border-radius: 999px; }
.comp-coment { font-size: 14px; color: var(--muted); line-height: 1.55; }
.feedback-grid { display: grid; gap: 12px; margin-top: 14px; }
.fb-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.fb-card h4 { margin: 0 0 10px; font-size: 14px; font-family: 'Inter', sans-serif; }
.fb-card.good h4 { color: var(--green); }
.fb-card.bad h4 { color: var(--lime); }
.fb-card ul { margin: 0; padding-left: 18px; }
.fb-card li { font-size: 14px; color: var(--muted); margin: 6px 0; line-height: 1.5; }
.fb-geral { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-top: 12px; color: var(--text-soft); line-height: 1.6; font-size: 15px; }
.erro-box { background: var(--red-tint); border: 1px solid var(--red); color: var(--red); padding: 16px; border-radius: 12px; font-size: 14px; }

@media (max-width: 480px) {
  .gate-card { padding: 30px 22px; }
  .gate-title { font-size: 32px; }
}
