/* ===================================================================
   ferramentas.css — Páginas de ferramentas gratuitas (/ferramentas/*)
   Complementa main.css. Prefixo .wv- = visualizador de WhatsApp,
   .wl- = gerador de link (reaproveita .wv-header, .wv-msg e .wv-btn).
   =================================================================== */

:root {
  --wa-bg:       #efeae2;
  --wa-out:      #d9fdd3;
  --wa-in:       #ffffff;
  --wa-header:   #075e54;
  --wa-meta:     #5b6b63;
  --focus-ring:  0 0 0 3px rgba(34,133,66,.45);
}

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }

/* ── HERO ── */
.tool-hero {
  background: linear-gradient(135deg, #f0fdf4 0%, #e8f5e9 100%);
  border-bottom: 1px solid var(--gray-200);
  padding: 56px 0 40px; text-align: center;
}
.tool-hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 3rem); font-weight: 900;
  color: var(--gray-900); line-height: 1.1; margin: 16px auto 14px; max-width: 760px;
}
.tool-hero p { color: var(--gray-600); font-size: 1.08rem; max-width: 640px; margin: 0 auto; }
.tool-trust {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px;
  list-style: none; margin-top: 22px; font-size: .88rem; color: var(--gray-700); font-weight: 500;
}
.tool-trust li { display: flex; align-items: center; gap: 6px; }
.tool-trust svg { color: var(--green-mid); flex-shrink: 0; }

/* ── ÁREA DA FERRAMENTA ── */
.tool-main { padding: 40px 0 72px; }
#wvViewer, #wvUpload { scroll-margin-top: 84px; }
.tool-card {
  max-width: 880px; margin: 0 auto; background: var(--white);
  border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}

.wv-upload { padding: 28px; }
.wv-drop {
  border: 2px dashed rgba(34,133,66,.45); border-radius: var(--radius-md);
  background: var(--off-white); padding: 40px 20px; text-align: center;
  transition: background .15s, border-color .15s;
}
.wv-drop.is-over { background: var(--green-pale); border-color: var(--green-mid); }
.wv-drop-icon { color: var(--green-mid); margin-bottom: 12px; }
.wv-drop h2 { font-size: 1.2rem; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.wv-drop p { color: var(--gray-600); font-size: .92rem; margin-bottom: 20px; }
.wv-drop-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.wv-drop-hint { font-size: .8rem !important; color: var(--gray-500) !important; margin: 16px 0 0 !important; }
.wv-hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.wv-status { margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: .9rem; }
.wv-status--loading { background: var(--green-pale); color: var(--green-dark); }
.wv-status--error { background: #fef2f2; color: #991b1b; border-left: 4px solid #dc2626; }

/* ── VISUALIZADOR ── */
.wv-header {
  display: flex; align-items: center; gap: 12px;
  background: var(--wa-header); color: #fff; padding: 12px 16px;
}
.wv-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem;
}
.wv-header-info { min-width: 0; flex: 1; }
.wv-header-info h2 { font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wv-header-info p { font-size: .8rem; opacity: .85; }

.wv-toolbar {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 12px; align-items: end;
  padding: 14px 16px; border-bottom: 1px solid var(--gray-200); background: var(--gray-50);
}
.wv-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wv-field label { font-size: .75rem; font-weight: 600; color: var(--gray-600); }
.wv-field select, .wv-field input {
  font: inherit; font-size: .9rem; color: var(--gray-800);
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  padding: 9px 12px; background: #fff; width: 100%; min-height: 42px;
}
.wv-field select:focus-visible, .wv-field input:focus-visible { border-color: var(--green-mid); }
.wv-toolbar-actions { display: flex; gap: 8px; }
.wv-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px;
  font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200); background: #fff; color: var(--gray-700);
  white-space: nowrap; transition: background .15s, color .15s;
}
.wv-btn:hover { background: var(--green-pale); color: var(--green-dark); }
.wv-search-status { font-size: .78rem; color: var(--gray-600); padding: 6px 16px 0; min-height: 1.4em; background: var(--gray-50); }

.wv-scroll {
  height: min(70vh, 720px); overflow-y: auto; overscroll-behavior: contain;
  background-color: var(--wa-bg);
  background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1.2px);
  background-size: 18px 18px;
}
.wv-messages { padding: 12px 6% 20px; display: flex; flex-direction: column; }

.wv-day { display: flex; flex-direction: column; content-visibility: auto; contain-intrinsic-size: auto 600px; }
.wv-day-chip {
  position: sticky; top: 8px; z-index: 2; align-self: center;
  background: #fff; color: var(--wa-meta); font-size: .75rem; font-weight: 600;
  padding: 5px 12px; border-radius: 8px; margin: 12px 0 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,.08);
}

.wv-system {
  align-self: center; max-width: 85%; text-align: center;
  background: #fff8c5; color: #54513a; font-size: .78rem;
  padding: 6px 12px; border-radius: 8px; margin: 6px 0;
  box-shadow: 0 1px 1px rgba(0,0,0,.06); white-space: pre-wrap; overflow-wrap: anywhere;
}

.wv-msg {
  max-width: min(78%, 520px); padding: 6px 9px 4px; border-radius: 8px;
  font-size: .92rem; line-height: 1.42; color: #111b21;
  box-shadow: 0 1px 1px rgba(0,0,0,.1); margin-top: 8px; position: relative;
}
.wv-msg--cont { margin-top: 2px; }
.wv-msg--in  { align-self: flex-start; background: var(--wa-in); }
.wv-msg--out { align-self: flex-end;   background: var(--wa-out); }
.wv-msg--in:not(.wv-msg--cont)  { border-top-left-radius: 0; }
.wv-msg--out:not(.wv-msg--cont) { border-top-right-radius: 0; }
.wv-sender { font-size: .8rem; font-weight: 700; margin-bottom: 2px; }
.wv-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.wv-text a { color: #027eb5; }
.wv-text--deleted { font-style: italic; color: var(--wa-meta); }
.wv-meta { font-size: .68rem; color: var(--wa-meta); text-align: right; margin-top: 2px; }

.wv-media {
  display: flex; align-items: center; gap: 10px; margin: 2px 0 4px;
  background: rgba(0,0,0,.04); border-radius: 6px; padding: 8px 10px; min-width: 200px;
}
.wv-media.is-loading { opacity: .6; }
.wv-media.is-loaded { display: block; padding: 0; background: none; min-width: 0; }
.wv-media-icon { font-size: 1.5rem; line-height: 1; }
.wv-media-info { display: flex; flex-direction: column; font-size: .8rem; color: var(--wa-meta); min-width: 0; }
.wv-media-info strong { color: #111b21; font-size: .85rem; }
.wv-media-name { overflow-wrap: anywhere; }
.wv-media-error { color: #991b1b; }
.wv-media-link { display: block; }
.wv-media-img { display: block; max-width: 100%; max-height: 340px; border-radius: 6px; }
.wv-media--sticker .wv-media-img { width: 140px; height: 140px; object-fit: contain; }
.wv-media-video { display: block; width: 100%; max-height: 360px; border-radius: 6px; background: #000; }
.wv-media-audio { display: block; width: 260px; max-width: 100%; height: 40px; }
.wv-media-file { display: inline-block; padding: 8px 10px; font-size: .85rem; color: #027eb5; overflow-wrap: anywhere; }

/* ── ESTATÍSTICAS ── */
.wv-stats { padding: 20px 16px 24px; border-top: 1px solid var(--gray-200); }
.wv-stats h3 { font-size: .95rem; font-weight: 700; color: var(--gray-900); margin-bottom: 12px; }
.wv-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 20px; }
.wv-stat { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-sm); padding: 12px; }
.wv-stat dt { font-size: .75rem; color: var(--gray-600); font-weight: 500; }
.wv-stat dd { font-size: 1.25rem; font-weight: 800; color: var(--green-dark); }
.wv-stat--wide dd { font-size: .95rem; padding-top: 4px; }
.wv-ranking { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.wv-rank { display: grid; grid-template-columns: minmax(80px, 180px) 1fr auto; gap: 10px; align-items: center; font-size: .85rem; }
.wv-rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.wv-rank-bar { height: 8px; background: var(--gray-100); border-radius: 99px; overflow: hidden; }
.wv-rank-fill { display: block; height: 100%; background: var(--green-bright); border-radius: 99px; }
.wv-rank-count { color: var(--gray-600); font-variant-numeric: tabular-nums; }

/* ── GERADOR DE LINK (prefixo .wl-) ── */
.wl-card {
  max-width: 1040px; display: grid; grid-template-columns: minmax(0, 1fr);
}
.wl-form, .wl-result { padding: 24px 20px; min-width: 0; }
.wl-result { background: var(--gray-50); border-top: 1px solid var(--gray-200); }
.wl-title { font-size: 1.05rem; font-weight: 700; color: var(--gray-900); margin-bottom: 14px; }
.wl-title--link { margin-top: 24px; }
.wl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wl-form .wl-field, .wl-phone { margin-bottom: 20px; }
.wl-phone { border: 0; min-width: 0; }
.wl-form .wl-phone-row .wl-field { margin-bottom: 0; }
.wl-phone legend, .wl-field > label, .wl-label-row label {
  font-size: .85rem; font-weight: 600; color: var(--gray-800); margin-bottom: 6px; display: block;
}
.wl-phone-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; }
.wl-phone-row label { font-size: .75rem; font-weight: 600; color: var(--gray-600); margin-bottom: 4px; display: block; }
.wl-field { display: flex; flex-direction: column; min-width: 0; }
.wl-field input, .wl-field textarea, .wl-link {
  font: inherit; font-size: 1rem; color: var(--gray-800);
  border: 1px solid #8a94a3; border-radius: var(--radius-sm);
  padding: 10px 12px; background: #fff; width: 100%; min-height: 46px;
}
.wl-field textarea { resize: vertical; line-height: 1.5; min-height: 120px; }
.wl-field input:focus-visible, .wl-field textarea:focus-visible, .wl-link:focus-visible { border-color: var(--green-mid); }
.wl-field input[aria-invalid="true"] { border-color: #b91c1c; }
.wl-ddi-wrap {
  display: flex; align-items: center; border: 1px solid #8a94a3; border-radius: var(--radius-sm);
  background: #fff; padding-left: 10px; color: var(--gray-600); font-weight: 600;
}
.wl-ddi-wrap:focus-within { border-color: var(--green-mid); box-shadow: var(--focus-ring); }
.wl-ddi-wrap input { border: 0; padding-left: 4px; min-width: 0; }
.wl-ddi-wrap input:focus-visible { box-shadow: none; }
.wl-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.wl-count { font-size: .78rem; color: var(--gray-600); font-variant-numeric: tabular-nums; }
.wl-optional { font-weight: 400; color: var(--gray-600); }
.wl-help { font-size: .8rem; color: var(--gray-600); margin-top: 6px; line-height: 1.5; }
.wl-help code { font-size: .78rem; background: var(--gray-100); padding: 1px 4px; border-radius: 4px; }
.wl-msg { font-size: .8rem; margin-top: 4px; }
.wl-msg:empty { display: none; }
.wl-msg--error { color: #991b1b; font-weight: 500; }
.wl-msg--warn { color: #854d0e; }
.wl-msg--info { color: var(--green-dark); }
.wl-format { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.wl-format-btn { min-width: 44px; justify-content: center; font-size: .95rem; }

.wl-phone-mock { border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm); }
.wl-chat-name { font-size: 1rem !important; font-weight: 600; opacity: 1 !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-chat {
  display: flex; flex-direction: column; padding: 16px 14px 20px; min-height: 140px;
  background-color: var(--wa-bg);
  background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1.2px);
  background-size: 18px 18px;
}
.wl-bubble { max-width: 88%; }
.wl-bubble code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .86rem; }
.wl-bubble.is-placeholder .wv-text { color: var(--wa-meta); font-style: italic; }
.wl-ticks { color: #027eb5; letter-spacing: -3px; margin-left: 2px; }

.wl-link-box { margin-bottom: 14px; }
.wl-link {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85rem;
  resize: none; overflow-wrap: anywhere; word-break: break-all;
}
.wl-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.wl-actions .btn { min-height: 46px; justify-content: center; }
.wl-actions .btn:disabled, .wl-actions .btn.is-disabled, .wv-btn:disabled {
  opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; pointer-events: none;
}
#wlCopy.is-done { background: var(--green-dark); }
.wl-status { font-size: .85rem; color: var(--green-dark); font-weight: 500; margin-top: 10px; min-height: 1.3em; }

.wl-qr { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--gray-200); text-align: center; }
.wl-qr .wl-title { text-align: left; }
.wl-qr-box {
  width: min(240px, 100%); aspect-ratio: 1; margin: 0 auto; background: #fff;
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm); padding: 6px;
}
.wl-qr-box svg { display: block; width: 100%; height: 100%; }
.wl-qr-box.is-empty {
  background: repeating-linear-gradient(45deg, var(--gray-50), var(--gray-50) 10px, var(--gray-100) 10px, var(--gray-100) 20px);
}
.wl-qr .wl-help { margin: 10px auto 12px; max-width: 320px; }

.wl-uses .tool-step-card p { color: var(--gray-700); font-size: .92rem; }

@media (min-width: 900px) {
  .wl-card { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  .wl-form, .wl-result { padding: 28px; }
  .wl-result { border-top: 0; border-left: 1px solid var(--gray-200); }
}

@media (max-width: 480px) {
  .wl-actions .btn { flex: 1 1 100%; }
}

/* ── CONTEÚDO (como exportar, FAQ) ── */
.tool-content { padding: 72px 0; background: var(--off-white); border-top: 1px solid var(--gray-200); }
.tool-content .section-title { margin-bottom: 36px; }
.tool-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; max-width: 880px; margin: 0 auto; }
.tool-step-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-md); padding: 24px; }
.tool-step-card h3 { font-size: 1.05rem; font-weight: 700; color: var(--gray-900); margin-bottom: 12px; }
.tool-step-card ol { padding-left: 20px; color: var(--gray-700); font-size: .92rem; display: flex; flex-direction: column; gap: 6px; }
.tool-note { max-width: 880px; margin: 20px auto 0; font-size: .88rem; color: var(--gray-600); text-align: center; }

.tool-faq { padding: 72px 0; }
.tool-faq-list { max-width: 780px; margin: 0 auto; }
.tool-faq-list details { border-bottom: 1px solid var(--gray-200); }
.tool-faq-list summary {
  cursor: pointer; list-style: none; padding: 18px 32px 18px 0; position: relative;
  font-weight: 600; color: var(--gray-800); font-size: .97rem;
}
.tool-faq-list summary::-webkit-details-marker { display: none; }
.tool-faq-list summary::after {
  content: '+'; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-size: 1.3rem; color: var(--green-mid); font-weight: 400;
}
.tool-faq-list details[open] summary::after { content: '−'; }
.tool-faq-list details p { color: var(--gray-600); font-size: .92rem; padding: 0 0 18px; }

/* ── NAV SIMPLIFICADA ── */
.tool-nav .nav-inner { gap: 12px; }
.tool-nav-back {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  color: var(--gray-600); font-size: .875rem; font-weight: 500; padding: 6px 10px; border-radius: var(--radius-sm);
}
.tool-nav-back:hover { color: var(--green-mid); background: var(--green-pale); }

@media (max-width: 720px) {
  .tool-hero { padding: 40px 0 28px; }
  .tool-main { padding: 20px 0 48px; }
  .tool-main .container { padding: 0 12px; }
  .wv-upload { padding: 16px; }
  .wv-drop { padding: 28px 14px; }
  .wv-toolbar { grid-template-columns: 1fr; }
  .wv-toolbar-actions .wv-btn { flex: 1; justify-content: center; }
  .wv-messages { padding: 8px 10px 16px; }
  .wv-msg { max-width: 88%; }
  .wv-rank { grid-template-columns: minmax(70px, 120px) 1fr auto; }
  .tool-nav-back span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ── IMPRESSÃO / PDF ── */
@media print {
  .nav, .tool-hero, .wv-upload, .wv-toolbar, .wv-search-status, .tool-content, .tool-faq,
  .cta-band, .footer, .wa-float { display: none !important; }
  body { background: #fff; }
  .tool-main { padding: 0; }
  .tool-card { box-shadow: none; border: none; max-width: none; }
  .wv-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .wv-scroll { height: auto; overflow: visible; background: #fff; }
  .wv-day { content-visibility: visible; }
  .wv-day-chip { position: static; box-shadow: none; border: 1px solid #ddd; }
  .wv-msg { break-inside: avoid; box-shadow: none; border: 1px solid #e2e2e2; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .wv-media-video, .wv-media-audio { display: none; }
}
