/* =========================================================================
   Tela do eleitor (pagina publica /c/:slug) — tema CLARO, estilo mockup.
   Isolada do painel admin (que continua no style.css escuro).
   ========================================================================= */
:root {
  --ink: #14345f;          /* azul-marinho dos titulos */
  --ink-2: #1e4a86;        /* azul secundario */
  --muted: #64748b;        /* texto apagado */
  --line: #e5eaf2;         /* bordas suaves */
  --bg: #ffffff;
  --bg-soft: #f4f7fb;
  --chip: #eef2f8;         /* fundo dos botoes de acao */
  --chip-hover: #e4eaf3;
  --green: #1e8a4d;        /* verde do botao ENVIAR FOTO */
  --green-d: #17703f;
  --brand: var(--green);   /* usado por JS (dropzone/badge) */
  --red: #dc2626;
  --shadow: 0 8px 24px rgba(20, 40, 80, 0.10);
  --shadow-sm: 0 4px 14px rgba(20, 40, 80, 0.08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(900px 380px at 108% 6%, rgba(255, 209, 0, 0.10), transparent 60%),
    radial-gradient(900px 420px at -8% 96%, rgba(30, 74, 134, 0.10), transparent 60%),
    var(--bg);
  color: var(--ink);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ---------- Cabecalho: logo centralizada ---------- */
.v-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 26px 18px 8px;
}
.v-logo { display: inline-flex; align-items: center; }
.v-logo .logo-img {
  height: 46px; width: auto; max-width: 240px; object-fit: contain; display: block;
}
/* Sem logo enviada: emoji dentro de um selo verde */
.v-logo:not(:has(.logo-img)) {
  width: 46px; height: 46px; border-radius: 12px; justify-content: center;
  background: linear-gradient(135deg, var(--green), var(--ink-2)); font-size: 22px;
}
.v-brandname { font-weight: 800; font-size: 1.25rem; color: var(--ink); }
/* Garantia no lado do cliente: se HA imagem de logo, ela ja traz o nome ->
   esconde o texto ao lado. */
.v-header:has(.logo-img) .v-brandname { display: none; }
/* No modo "so nome" o selo do logo fica vazio -> nao mostra. */
.v-logo:empty { display: none; }

/* ---------- Container ---------- */
.v-wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 8px 18px 56px;
}

/* ---------- Estados (carregando / erro) ---------- */
.v-state {
  text-align: center; color: var(--muted); padding: 48px 16px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-sm); margin-top: 20px;
}
.v-state h3 { color: var(--ink); margin: 0 0 6px; }

/* ---------- Titulo ---------- */
.v-eyebrow {
  text-align: center; margin: 4px 0 0; font-weight: 800; letter-spacing: 0.02em;
  color: var(--ink-2); font-size: 0.9rem; text-transform: uppercase;
}
.v-title {
  text-align: center; font-size: 1.7rem; font-weight: 800; color: var(--ink);
  margin: 6px 0 4px; letter-spacing: -0.01em;
}
.v-desc { text-align: center; color: var(--muted); margin: 0 0 18px; font-size: 0.95rem; }
.muted { color: var(--muted); }

/* ---------- Grade de molduras ---------- */
.frames {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.frame-card {
  appearance: none; text-align: left; font: inherit; cursor: pointer;
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 18px;
  padding: 10px; box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.frame-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #cfdaeb; }
.frame-card:active { transform: translateY(-1px); }
.frame-card.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(30, 138, 77, 0.22), var(--shadow);
}
.frame-card .thumb {
  width: 100%; aspect-ratio: 1 / 1; border-radius: 13px; overflow: hidden;
  display: grid; place-items: center;
  background:
    repeating-conic-gradient(#eef2f8 0% 25%, #ffffff 0% 50%) 50% / 18px 18px;
  border: 1px solid var(--line);
}
.frame-card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.frame-card .cap {
  text-align: center; font-size: 0.84rem; font-weight: 700; color: var(--ink);
  margin: 9px 4px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.frames-empty {
  grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 34px 16px;
  background: var(--bg); border: 1px dashed var(--line); border-radius: 16px;
}

/* ---------- Editor ---------- */
.link-back {
  appearance: none; border: none; background: transparent; cursor: pointer;
  color: var(--ink-2); font: inherit; font-weight: 700; font-size: 0.9rem;
  padding: 6px 2px; margin-bottom: 6px;
}
.link-back:hover { text-decoration: underline; }

.stage-wrap { margin: 2px auto 16px; }
.editor-stage {
  position: relative; width: 100%; max-width: 420px; margin: 0 auto;
  background: repeating-conic-gradient(#eef2f8 0% 25%, #ffffff 0% 50%) 50% / 22px 22px;
  border-radius: 20px; overflow: hidden; touch-action: none;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.editor-stage canvas { display: block; width: 100%; height: auto; cursor: grab; }
.editor-stage canvas:active { cursor: grabbing; }

/* Botao grande ENVIAR FOTO */
.btn-send {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 17px 20px; border-radius: 16px; cursor: pointer;
  background: linear-gradient(135deg, var(--green), var(--green-d));
  color: #fff; font-weight: 800; font-size: 1.05rem; letter-spacing: 0.02em;
  border: none; box-shadow: 0 10px 22px rgba(30, 138, 77, 0.30);
  transition: filter 0.15s ease, transform 0.06s ease;
}
.btn-send:hover { filter: brightness(1.05); }
.btn-send:active { transform: translateY(1px); }
.btn-send svg { width: 22px; height: 22px; }
.send-hint { text-align: center; color: var(--muted); font-size: 0.86rem; margin: 12px 0 0; }

/* Painel de ajuste (zoom) */
.adjust-panel {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px; margin-bottom: 14px;
}
.zoom-row { display: flex; align-items: center; gap: 12px; }
.zoom-row .zl { font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.zoom-row input[type=range] { flex: 1; accent-color: var(--green); }
.adjust-hint { color: var(--muted); font-size: 0.8rem; margin: 10px 0 0; text-align: center; }

/* Barra de acoes: Ajustar / Aplicar / Baixar */
.action-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.act {
  appearance: none; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 6px; border-radius: 16px;
  background: var(--chip); border: 1.5px solid transparent; color: var(--ink);
  font-weight: 700; font-size: 0.86rem;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.06s ease;
}
.act:hover { background: var(--chip-hover); }
.act:active { transform: translateY(1px); }
.act svg { width: 26px; height: 26px; }
.act.active { background: #e3f1e9; border-color: rgba(30, 138, 77, 0.45); color: var(--green-d); }
.act.primary { background: linear-gradient(135deg, var(--green), var(--green-d)); color: #fff; box-shadow: 0 8px 18px rgba(30, 138, 77, 0.28); }
.act.primary:hover { filter: brightness(1.05); background: linear-gradient(135deg, var(--green), var(--green-d)); }

.change-photo-row { text-align: center; margin-top: 14px; }

/* ---------- Selo do plano gratis ---------- */
#brandingBadge a { font-weight: 700; color: var(--ink-2); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 100;
  font-size: 0.9rem; font-weight: 600;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
#toast.error { border-color: var(--red); color: var(--red); }
#toast.ok { border-color: var(--green); color: var(--green-d); }

/* ---------- Responsivo ---------- */
@media (max-width: 380px) {
  .v-wrap { padding: 8px 14px 48px; }
  .frames { gap: 11px; }
  .act { font-size: 0.8rem; padding: 12px 4px; }
}
