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

:root {
  --paper: #f4f1ea;
  --paper-2: #ece8de;
  --ink: #191713;
  --ink-soft: #4a463e;
  --ink-faint: #8a857a;
  --line: #d8d3c6;
  --line-strong: #b8b2a2;
  --cobalt: #1d3fd6;
  --stamp: #c8451f;
  --wa: #128c4b;
  --wa-dim: rgba(18, 140, 75, 0.08);
  --green: #128c4b;
  --red: #b3341a;
  --white: #ffffff;

  --accent: var(--wa);
  --surface2: var(--white);
  --border: var(--line-strong);
  --border2: var(--line);
  --muted: var(--ink-faint);
}

* { 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 { font-family: inherit; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--wa);
  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: all 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: all 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); }

.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-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;
}

.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: all 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: all 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);
  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-header { display: flex; align-items: center; justify-content: space-between; }

.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);
}

.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.76rem;
  color: var(--ink-soft);
  font-family: "IBM Plex Mono", monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-copy-btn {
  background: transparent;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  transition: color 0.18s;
  flex-shrink: 0;
}

.link-copy-btn:hover { color: var(--wa); }

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

.btn-whatsapp {
  flex: 1;
  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: all 0.18s;
}

.btn-whatsapp:hover { background: var(--ink); border-color: var(--ink); }

.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: all 0.18s;
  white-space: nowrap;
}

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

.result-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--ink-faint);
  line-height: 1.55;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.result-tip svg { flex-shrink: 0; margin-top: 1px; }

/* ── 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; }

  .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;
}

.sidebar-credit a:hover { text-decoration: underline; }


