/* ═══════════════════════════════════════════════
   GERADOR WHATSAPP — identidade papel·tinta
   ═══════════════════════════════════════════════ */

:root {
  --paper: #f4f1ea;
  --paper-2: #ece8de;
  --ink: #191713;
  --ink-soft: #4a463e;
  --ink-faint: #67635a;
  --line: #d8d3c6;
  --line-strong: #b8b2a2;
  --cobalt: #1d3fd6;
  --stamp: #b33d1b;
  --wa: #0e7340;
  --wa-dim: rgba(18, 140, 75, 0.08);
  --green: #0e7340;
  --red: #b3341a;
  --white: #ffffff;

  --accent: var(--wa);
  --surface2: var(--white);
  --border: var(--line-strong);
  --border2: var(--line);
  --muted: var(--ink-faint);
  --wa-text: #0e7340;
  --chat-bg: #efe7dd;
  --bubble: #d9fdd3;
  --bubble-ink: #111b21;

}


[hidden] { display: none !important; }

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

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; overflow: hidden; }

body {
  font-family: "Archivo", sans-serif;
  background: var(--paper);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--wa); color: var(--paper); }

button, select { font-family: inherit; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--wa-text);
  outline-offset: 2px;
}

/* ── HEADER ── */
.header {
  padding: 10px 20px;
  border-bottom: 1px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--paper);
  flex-shrink: 0;
  z-index: 200;
}

.header-left { display: flex; align-items: center; gap: 16px; min-width: 0; }

.header-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-size: 1.15rem;
  background: var(--ink);
  color: var(--paper);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding-bottom: 3px;
  flex-shrink: 0;
}

.brand-text {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.05rem;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.tool-switch {
  display: flex;
  gap: 2px;
  background: var(--paper-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px;
}

.tool-tab {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 5px 14px;
  border-radius: 999px;
  transition: color 0.2s, background-color 0.2s;
}

.tool-tab:hover { color: var(--ink); }
.tool-tab.active { background: var(--ink); color: var(--paper); }

.btn-copy {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 8px 15px;
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.18s, background-color 0.18s, border-color 0.18s;
  white-space: nowrap;
}

.btn-copy:hover:not(:disabled) { background: var(--wa); border-color: var(--wa); }
.btn-copy:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── TOASTS ── */
.toast-zone {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 900;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: var(--paper);
  border-left: 3px solid var(--wa);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(25, 23, 19, 0.35);
  animation: toastIn 0.25s ease, toastOut 0.3s ease 2.7s forwards;
  white-space: nowrap;
}

@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ── WORKSPACE ── */
.workspace {
  display: grid;
  grid-template-columns: 420px 1fr;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── SIDEBAR ── */
.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--ink);
  overflow-y: auto;
  padding: 18px 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

.section-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.optional-label {
  color: var(--ink-faint);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.divider-line { height: 1px; background: var(--line); flex-shrink: 0; }

.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.field-hint { font-size: 0.68rem; color: var(--ink-faint); }
.field-hint.error { color: var(--stamp); font-weight: 500; }

.phone-row {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.18s, box-shadow 0.18s;
  background: var(--white);
}

.phone-row:focus-within {
  border-color: var(--wa);
  box-shadow: 0 0 0 3px var(--wa-dim);
}

.phone-row.invalid { border-color: var(--stamp); }

.phone-prefix {
  background: var(--paper-2);
  color: var(--ink-soft);
  padding: 9px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  font-family: "IBM Plex Mono", monospace;
  border-top: none;
  border-bottom: none;
  border-left: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%234a463e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.phone-prefix:focus-visible { outline-offset: -2px; }

.ddi-input {
  width: 64px;
  flex: 0 0 64px !important;
  border-right: 1px solid var(--line) !important;
}

.phone-row input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 0.86rem;
  padding: 9px 12px;
  outline: none;
  font-family: "IBM Plex Mono", monospace;
}

.field textarea {
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: 0 0 8px 8px;
  color: var(--ink);
  font-size: 0.84rem;
  padding: 10px 11px;
  outline: none;
  transition: border-color 0.18s;
  width: 100%;
  resize: none;
  line-height: 1.6;
  font-family: "Archivo", sans-serif;
}

.field textarea:focus { border-color: var(--wa); }
.field textarea::placeholder { color: var(--ink-faint); }

/* ── TOOLBAR ── */
.msg-toolbar {
  display: flex;
  gap: 3px;
  align-items: center;
  padding: 6px 8px;
  background: var(--paper-2);
  border: 1px solid var(--line-strong);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.tb-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  transition: color 0.15s, background-color 0.15s;
}

.tb-btn:hover { background: var(--white); color: var(--ink); }

.tb-sep { flex: 1; }

.char-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

.char-count.warn { color: var(--stamp); }

/* ── TEMPLATES ── */
.templates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.template-btn {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: "Archivo", sans-serif;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 11px 12px;
  text-align: left;
  transition: color 0.18s, background-color 0.18s, border-color 0.18s;
  line-height: 1.4;
}

.template-btn:hover {
  border-color: var(--wa);
  color: var(--ink);
  background: var(--wa-dim);
}

/* ── RESULT AREA ── */
.result-area {
  background: var(--paper-2);
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.result-inner { width: 100%; max-width: 480px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 60px 20px;
}

.empty-icon { color: var(--line-strong); margin-bottom: 8px; }

.empty-title {
  font-family: "Fraunces", serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.empty-sub { font-size: 0.85rem; color: var(--ink-faint); }

.result-card {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 16px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 14px 40px rgba(25, 23, 19, 0.12);
}

.result-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wa-text);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wa);
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.link-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
}

.link-text {
  flex: 1;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--ink-soft);
  font-family: "IBM Plex Mono", monospace;
  word-break: break-all;
  max-height: 6.2em;
  overflow-y: auto;
  user-select: all;
}

.link-box-short .link-text { font-size: 0.9rem; font-weight: 500; color: var(--ink); }

.link-group { display: flex; flex-direction: column; gap: 6px; }

.link-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.link-len { font-family: "IBM Plex Mono", monospace; font-weight: 400; color: var(--ink-faint); font-size: 0.66rem; }

.btn-shorten {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--wa-dim);
  border: 1px dashed var(--wa);
  border-radius: 10px;
  color: var(--wa-text);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 11px;
  transition: background-color 0.18s;
}

.btn-shorten:hover:not(:disabled) { background: rgba(18, 140, 75, 0.16); }
.btn-shorten:disabled { cursor: progress; opacity: 0.6; }
.btn-shorten.loading svg { animation: spin 0.9s linear infinite; }

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

.short-result { display: flex; flex-direction: column; gap: 6px; }

.short-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  color: var(--ink-faint);
}

.link-btn {
  background: none;
  border: none;
  color: var(--wa-text);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* prévia da conversa */
.chat {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper-2);
  padding: 9px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
}

.chat-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--line-strong);
}

.chat-body {
  background: var(--chat-bg);
  padding: 16px 12px;
  display: flex;
  justify-content: flex-end;
}

.bubble {
  background: var(--bubble);
  color: var(--bubble-ink);
  border-radius: 8px 0 8px 8px;
  padding: 7px 10px 6px;
  max-width: 85%;
  font-size: 0.86rem;
  line-height: 1.45;
  word-wrap: break-word;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

.bubble code { font-family: "IBM Plex Mono", monospace; font-size: 0.8rem; }

.bubble-time {
  float: right;
  margin: 6px 0 -4px 10px;
  font-size: 0.64rem;
  opacity: 0.6;
}

.bubble-empty { font-style: italic; opacity: 0.7; font-size: 0.8rem; }

/* QR */
.qr {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.qr canvas {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  border: 1px solid var(--line);
  flex-shrink: 0;
  image-rendering: pixelated;
}

.qr-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.qr-title { font-family: "IBM Plex Mono", monospace; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; }
.qr-text { font-size: 0.76rem; color: var(--ink-faint); line-height: 1.5; }

.result-actions { display: flex; gap: 10px; }

.btn-whatsapp {
  flex: 1;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--wa);
  color: #fff;
  border: 1px solid var(--wa);
  border-radius: 999px;
  padding: 13px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: color 0.18s, background-color 0.18s, border-color 0.18s;
}

.btn-whatsapp:hover { background: #0d6b39; border-color: #0d6b39; }

.btn-copy-full {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.18s, background-color 0.18s, border-color 0.18s;
  white-space: nowrap;
}

.btn-copy-full:hover { background: var(--ink); color: var(--paper); }


/* ── RESPONSIVE ── */
@media (max-width: 780px) {
  html, body { overflow: auto; }

  .header { flex-wrap: wrap; padding: 10px 14px; }
  .btn-label { display: none; }
  .brand-text { display: none; }
  .btn-copy { padding: 8px 11px; }

  .workspace { grid-template-columns: 1fr; overflow: visible; }

  .sidebar { border-right: none; border-bottom: 1px solid var(--ink); overflow: visible; }

  .result-area { min-height: 320px; padding: 24px 16px; }
  .result-card { padding: 20px; }
  .result-actions { flex-direction: column; }

  .toast { white-space: normal; max-width: 90vw; }
}


/* ── CRÉDITO ── */
.sidebar-credit {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  text-align: center;
}

.sidebar-credit a {
  font-family: "Instrument Sans", sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

/* sublinhado: o link precisa se distinguir do texto ao redor além da cor */
.sidebar-credit a {
  display: inline-block;
  min-height: 24px;
  line-height: 24px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.sidebar-credit a:hover { text-decoration-thickness: 2px; }

/* ponto final translúcido da marca (joaoa.com.br) */
.sidebar-credit a span { opacity: 0.35; }



/* ── CABEÇALHO MAIS ALTO E BOTÕES MAIORES ── */
.header { padding: 14px 28px; min-height: 72px; gap: 20px; }
.header-left { gap: 24px; }
.header-actions { gap: 10px; }
.brand-mark { width: 36px; height: 36px; font-size: 1.3rem; }
.brand-text { font-size: 1.2rem; }
.tool-switch { padding: 4px; }
.tool-tab { font-size: 0.84rem; padding: 8px 20px; }
.btn-new, .btn-gmail, .btn-copy { font-size: 0.86rem; padding: 11px 20px; gap: 8px; }
.btn-new svg, .btn-gmail svg, .btn-copy svg { width: 15px; height: 15px; }
.save-badge { font-size: 0.8rem; }

@media (max-width: 1180px) {
  .btn-new, .btn-gmail, .btn-copy { padding: 11px 14px; }
}

@media (max-width: 920px) {
  .header { padding: 12px 16px; min-height: 0; }
  .header-left { gap: 14px; }
}

/* texto só para leitores de tela e buscadores */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
