/* =========================================================
   EnlaceChat — estilos
   1. Variables · 2. Base · 3. Cabecera y hero · 4. Anuncios
   5. Herramienta · 6. Vista previa · 7. QR · 8. Secciones SEO
   9. Pie · 10. Pop-up y aviso · 11. Responsive
   ========================================================= */

/* 1. Variables */
:root {
  --green: #25d366;
  --green-soft: #dcf8c6;
  --brand: #0e8a54;
  --brand-dark: #0b6b5a;
  --deep: #0b3d33;
  --ink: #12211d;
  --muted: #5b6b67;
  --line: #e2e8e6;
  --bg: #f5f7f6;
  --card: #ffffff;
  --chat: #efeae2;
  --bubble: #d9fdd3;
  --warn-bg: #fff7e6;
  --warn: #8a5a00;
  --err: #b42318;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 40, 34, .05), 0 8px 24px rgba(16, 40, 34, .06);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 2. Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  line-height: 1.55; font-size: 16px; overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: #eaf2ef; padding: .08em .35em; border-radius: 5px; }
button { font: inherit; color: inherit; cursor: pointer; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid rgba(37, 211, 102, .55); outline-offset: 2px; }

/* 3. Cabecera y hero */
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.site-header__in { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--deep); font-weight: 700; font-size: 1.15rem; }
.logo b { color: var(--brand); }
.site-nav { display: flex; gap: 22px; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: .94rem; font-weight: 500; }
.site-nav a:hover { color: var(--brand); }

.hero { padding-top: 30px; padding-bottom: 6px; text-align: center; }
.hero h1 { font-size: clamp(1.5rem, 1.1rem + 2.1vw, 2.45rem); color: var(--deep); font-weight: 800; max-width: 860px; margin: 0 auto; }
.hero__sub { color: var(--muted); max-width: 720px; margin: 10px auto 0; font-size: clamp(.97rem, .92rem + .3vw, 1.08rem); }
.pills { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pills li { background: #e7f7ee; color: var(--brand-dark); font-size: .84rem; font-weight: 600; padding: 4px 11px; border-radius: 999px; }

/* 4. Anuncios (contenedores vacíos, listos para AdSense) */
.ad-slot {
  position: relative; display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(-45deg, #f0f3f2 0 10px, #eaeeed 10px 20px);
  border: 1.5px dashed #c5cfcc; border-radius: 12px; color: #8a9894; overflow: hidden;
}
.ad-slot__label { font-size: .78rem; font-weight: 700; letter-spacing: .18em; }
.ad-slot--leader { width: 100%; max-width: 728px; min-height: 90px; margin: 18px auto; }
.ad-slot--square { width: 100%; max-width: 300px; min-height: 250px; margin: 18px auto 0; }
.ad-slot--bottom { margin: 34px auto 40px; }
.ad-slot--modal { margin: 14px auto; }

/* 5. Herramienta */
.noscript { background: var(--warn-bg); color: var(--warn); padding: 14px; border-radius: 12px; text-align: center; }
.tool { padding-top: 4px; padding-bottom: 10px; }
.tool-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "form side" "result side"; align-items: start; }
.form-card { grid-area: form; }
.result-card { grid-area: result; }
.side { grid-area: side; position: sticky; top: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; min-width: 0; }
.card[hidden] { display: none; }
.card__title { font-size: 1.08rem; color: var(--deep); display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card__title--sub { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.step-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #063b22; font-size: .85rem; font-weight: 800; flex: none; }

.field-label { display: block; font-weight: 600; font-size: .93rem; margin-bottom: 7px; }
.opt { color: var(--muted); font-weight: 400; }
.input {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid #d3dcd9;
  border-radius: 12px; padding: 12px 14px; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(37, 211, 102, .18); }
.input.is-invalid { border-color: var(--err); box-shadow: 0 0 0 4px rgba(180, 35, 24, .1); }
.textarea { resize: vertical; min-height: 104px; line-height: 1.5; }
.hint { color: var(--muted); font-size: .84rem; margin: 7px 0 0; }
.hint.is-alert { color: var(--warn); }

.phone-row { display: flex; gap: 8px; }
.phone-input { flex: 1; min-width: 0; font-size: 1.05rem; letter-spacing: .02em; }

/* Selector de país */
.cc { position: relative; flex: none; }
.cc__btn {
  height: 100%; min-height: 50px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px;
  background: #f4f7f6; border: 1.5px solid #d3dcd9; border-radius: 12px; font-weight: 600;
}
.cc__btn:hover { border-color: #b5c4bf; }
.cc__flag { font-size: 1.3rem; line-height: 1; }
.flag-code { display: inline-grid; place-items: center; min-width: 26px; height: 19px; padding: 0 3px; font-size: .68rem; font-weight: 800; letter-spacing: .02em; border-radius: 4px; background: var(--deep); color: #fff; font-family: var(--font); }
.cc__chev { color: var(--muted); }
.cc__panel {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(320px, calc(100vw - 40px));
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(16, 40, 34, .16); padding: 8px;
}
.cc__search { width: 100%; font: inherit; border: 1.5px solid #d3dcd9; border-radius: 10px; padding: 9px 11px; }
.cc__search:focus { outline: none; border-color: var(--green); }
.cc__list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 290px; overflow-y: auto; overscroll-behavior: contain; }
.cc__list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: .94rem; }
.cc__list li .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc__list li .d { color: var(--muted); font-variant-numeric: tabular-nums; }
.cc__list li .f { font-size: 1.2rem; width: 28px; text-align: center; }
.cc__list li[aria-selected="true"], .cc__list li:hover { background: #ecf8f1; }
.cc__list li.is-active { outline: 2px solid var(--green); outline-offset: -2px; }
.cc__list .sep { height: 1px; background: var(--line); padding: 0; margin: 6px 4px; cursor: default; }
.cc__list .none { color: var(--muted); cursor: default; }

/* Mensaje */
.msg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 18px; }
.msg-head .field-label { margin-bottom: 7px; }
.fmt { display: flex; gap: 4px; margin-bottom: 6px; }
.fmt button { width: 34px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-size: .88rem; }
.fmt button:hover { background: #ecf8f1; border-color: #bfe6cf; }
.fmt code { background: none; padding: 0; font-size: .78rem; }
.msg-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-top: 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid #cfe9da; background: #f2fbf6; color: var(--brand-dark); font-size: .8rem; font-weight: 600; padding: 5px 11px; border-radius: 999px; }
.chip:hover { background: #e2f6ea; }
.counter { color: var(--muted); font-size: .8rem; white-space: nowrap; padding-top: 5px; font-variant-numeric: tabular-nums; }
.counter.is-high { color: var(--warn); font-weight: 600; }

.error { color: var(--err); background: #fdecea; border-radius: 10px; padding: 9px 12px; font-size: .9rem; margin: 14px 0 0; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  padding: 12px 18px; font-weight: 700; font-size: .96rem; text-decoration: none; white-space: nowrap;
  transition: background .15s, transform .08s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(14, 138, 84, .25); }
.btn--primary:hover { background: var(--brand-dark); }
.btn--ghost { background: #fff; color: var(--brand-dark); border: 1.5px solid #bfe0cf; }
.btn--ghost:hover { background: #f2fbf6; }
.btn--xl { width: 100%; margin-top: 18px; padding: 15px 18px; font-size: 1.06rem; }
.btn--block { width: 100%; }
.btn.is-done { background: #0b6b5a; }
.privacy { color: var(--muted); font-size: .82rem; text-align: center; margin: 12px 0 0; }

/* Resultado */
.link-box { display: flex; gap: 8px; }
.link-out { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; background: #f6faf8; color: var(--deep); }
.link-meta { margin: 9px 0 0; font-size: .86rem; color: var(--muted); }
.link-meta a { font-weight: 600; text-decoration: none; }

/* 6. Vista previa del chat */
.phone {
  width: 100%; max-width: 340px; margin: 0 auto; border-radius: 28px; overflow: hidden; background: #fff;
  border: 8px solid #1d2725; box-shadow: 0 18px 44px rgba(16, 40, 34, .18);
}
.phone__top { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px; background: #0b6b5a; color: #fff; }
.phone__back { flex: none; }
.phone__avatar { width: 34px; height: 34px; border-radius: 50%; background: #9fb8b1; display: grid; place-items: center; overflow: hidden; flex: none; }
.phone__avatar svg { margin-top: 6px; }
.phone__who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.phone__who b { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone__who small { font-size: .72rem; opacity: .85; }
.phone__icons { display: flex; gap: 12px; flex: none; }
.phone__chat {
  min-height: 300px; max-height: 420px; overflow-y: auto; padding: 12px 10px 14px; display: flex; flex-direction: column; gap: 8px;
  background-color: var(--chat);
  background-image: radial-gradient(rgba(11, 61, 51, .07) 1.2px, transparent 1.3px), radial-gradient(rgba(11, 61, 51, .05) 1px, transparent 1.1px);
  background-size: 22px 22px, 14px 14px; background-position: 0 0, 7px 9px;
}
.day-pill { align-self: center; background: #fff; color: #54656f; font-size: .7rem; padding: 3px 10px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
.sys-note { align-self: center; text-align: center; background: #fff3c4; color: #54656f; font-size: .68rem; padding: 5px 10px; border-radius: 8px; max-width: 88%; }
.bubble {
  align-self: flex-end; max-width: 86%; background: var(--bubble); border-radius: 10px 0 10px 10px; padding: 6px 8px 5px 10px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08); position: relative; font-size: .9rem; color: #111b21;
  animation: pop .18s ease-out;
}
.bubble::after { content: ""; position: absolute; top: 0; right: -7px; border-left: 8px solid var(--bubble); border-bottom: 9px solid transparent; }
.bubble[hidden] { display: none; }
.bubble__text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.bubble__text code { background: rgba(0, 0, 0, .06); }
.bubble__meta { float: right; display: inline-flex; align-items: center; gap: 3px; font-size: .66rem; color: #667781; margin: 6px 0 -2px 10px; }
.empty-note { align-self: center; font-size: .78rem; color: #54656f; background: rgba(255, 255, 255, .8); padding: 8px 12px; border-radius: 10px; margin: 18px 6px 0; text-align: center; }
.phone__bar { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--chat); }
.phone__input { flex: 1; background: #fff; border-radius: 999px; padding: 8px 13px; color: #8696a0; font-size: .86rem; }
.phone__send { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; flex: none; }
.side__cap { text-align: center; color: var(--muted); font-size: .82rem; margin: 12px auto 0; max-width: 320px; }
@keyframes pop { from { transform: scale(.96); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .bubble { animation: none; } }

/* 7. QR */
.qr-zone { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.qr-stage { text-align: center; }
.qr-canvas { width: 100%; aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--line); overflow: hidden; background: #fff; display: grid; place-items: center; }
.qr-canvas svg { width: 100%; height: 100%; display: block; }
.qr-info { font-size: .8rem; color: var(--muted); margin: 8px 0 0; }
.qr-controls { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ctrl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.color-field > span:first-child, .size-field > span, .seg-field legend { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 6px; padding: 0; }
.color-pick { display: flex; align-items: center; gap: 6px; border: 1.5px solid #d3dcd9; border-radius: 11px; padding: 4px; background: #fff; }
.color-pick input[type="color"] { width: 36px; height: 32px; border: 0; padding: 0; background: none; border-radius: 8px; cursor: pointer; flex: none; }
.color-pick input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-pick input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(0, 0, 0, .12); border-radius: 7px; }
.hex { width: 100%; min-width: 0; border: 0; font: inherit; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88rem; text-transform: uppercase; padding: 4px; }
.hex:focus { outline: none; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #cfd8d5; background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%); }
.sw:hover { box-shadow: 0 0 0 2px var(--green); }
.seg-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.seg { display: flex; background: #eef3f1; border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 8px 6px; font-size: .84rem; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--deep); box-shadow: 0 1px 3px rgba(16, 40, 34, .14); }
.warn { background: var(--warn-bg); color: var(--warn); font-size: .84rem; padding: 9px 11px; border-radius: 10px; margin: 0; }
.dl-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: center; }
.dl-row .size-field { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dl-row .size-field > span { margin: 0; }
.size-field .select { width: auto; min-width: 190px; padding: 10px 12px; }

/* 8. Secciones SEO */
.section { padding-top: 44px; }
.section__title { font-size: clamp(1.3rem, 1.05rem + 1.1vw, 1.8rem); color: var(--deep); text-align: center; margin-bottom: 22px; }
.section__lead { text-align: center; color: var(--muted); max-width: 760px; margin: -8px auto 22px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.step, .case { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.step h3, .case h3 { font-size: 1.05rem; color: var(--deep); margin: 12px 0 6px; }
.step p, .case p { margin: 0; color: var(--muted); font-size: .94rem; }
.step__icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: #e7f7ee; color: var(--brand); }
.cases { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.case__icon { font-size: 1.6rem; }
.prose { max-width: 820px; }
.prose h3 { font-size: 1.12rem; color: var(--deep); margin: 22px 0 6px; }
.prose p { color: #33433f; margin: 0 0 12px; }
.faq { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 18px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 15px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 16px; color: var(--muted); }

/* 9. Pie */
.site-footer { background: var(--deep); color: #cfe3dc; padding: 28px 0; font-size: .88rem; }
.site-footer a { color: #fff; }
.site-footer p { margin: 0 0 8px; }
.site-footer .tm { opacity: .75; font-size: .78rem; margin-top: 12px; }

/* 10. Pop-up intermedio y aviso */
.interstitial {
  border: 0; border-radius: 18px; padding: 22px 20px 20px; width: min(360px, calc(100vw - 32px));
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3); position: fixed;
}
.interstitial::backdrop { background: rgba(9, 30, 25, .55); }
.interstitial__x { position: absolute; top: 8px; right: 10px; width: 34px; height: 34px; border: 0; background: #f0f3f2; border-radius: 50%; font-size: 1.3rem; line-height: 1; }
.interstitial__title { margin: 0 34px 0 0; font-weight: 700; color: var(--deep); }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--deep); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: .9rem; font-weight: 600;
  transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100vw - 32px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* 11. Responsive */
@media (max-width: 1000px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "form" "result" "side"; }
  .side { position: static; }
}
@media (max-width: 760px) {
  .site-nav { display: none; }
  .steps, .cases { grid-template-columns: 1fr; }
  .qr-zone { grid-template-columns: minmax(0, 1fr); }
  .qr-stage { max-width: 260px; margin: 0 auto; width: 100%; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 14px; }
  .hero { padding-top: 20px; }
  .card { padding: 18px 16px; }
  .ad-slot--leader { min-height: 100px; max-width: 320px; margin: 14px auto; }
  .ad-slot--bottom { margin: 30px auto 34px; }
  .link-box { flex-direction: column; }
  .link-box .btn { width: 100%; }
  .ctrl-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dl-row { grid-template-columns: minmax(0, 1fr); }
  .dl-row .btn { width: 100%; }
  .size-field .select { min-width: 0; flex: 1; max-width: 220px; }
  .seg button { font-size: .78rem; padding: 8px 3px; }
  .seg .g { display: none; }
  .msg-foot { flex-direction: column; }
  .msg-head { flex-wrap: wrap; gap: 0 10px; }
  .fmt button { width: 32px; }
  .counter { align-self: flex-end; padding-top: 0; }
}
