/* ==========================================================
   Demos: chatbot, agente de IA y CRM (+ prueba de 15 días)
   Usa las variables de styles.css
   ========================================================== */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.nav a.is-current { color: var(--orange); }

/* ---------- Hero ---------- */
.dhero { padding-bottom: 72px; }
.dhero__inner { max-width: 820px; text-align: center; }
.dhero .hero__lead { margin-inline: auto; max-width: 640px; }
.dhero .hero__actions { justify-content: center; }

/* ---------- Pestañas ---------- */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 40px; }
.tab {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 18px 20px; border: 2px solid var(--line); border-radius: var(--radius-lg);
  background: #fff; cursor: pointer; font: inherit; color: var(--navy);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.tab:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.tab svg { flex: none; width: 44px; height: 44px; padding: 10px; border-radius: 12px; background: var(--orange-soft); fill: none; stroke: var(--orange); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab strong { display: block; font-family: var(--font-display); text-transform: uppercase; font-size: 1.15rem; line-height: 1.2; }
.tab small { color: var(--muted); font-weight: 700; font-size: .85rem; }
.tab.is-on { border-color: var(--orange); box-shadow: var(--shadow); }
.tab.is-on svg { background: var(--orange); stroke: #fff; }
.tab:focus-visible, .chip:focus-visible { outline: 3px solid rgba(233,106,46,.45); outline-offset: 2px; }

/* ---------- Estructura de cada demo ---------- */
.demo { display: grid; grid-template-columns: .9fr 1.1fr; gap: 56px; align-items: start; }
.demo__side h2 { margin-bottom: 1rem; }
.demo__side > p { margin-bottom: 1rem; }
.demo__label { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; font-weight: 600; color: var(--navy); margin-top: 1.4rem; }
.demo__list { display: grid; gap: 10px; margin: 1.6rem 0 2rem; }
.demo__list li { display: flex; gap: 10px; font-weight: 600; color: var(--ink); font-size: .98rem; }
.demo__list li::before { content: "✓"; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--orange-soft); color: var(--orange); font-size: .8rem; display: grid; place-items: center; margin-top: 3px; }
.demo__side .btn { margin-top: 1.4rem; }
.demo__list + .btn { margin-top: 0; }
.demo__stage { position: relative; }
.demo--wide { display: block; }
.demo__top { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 28px; }
.demo__top > div { max-width: 720px; }
.demo__top h2 { margin-bottom: .8rem; }
.demo__top .btn { flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: .7rem; }
.chips--col { flex-direction: column; align-items: stretch; }
.chip {
  font: inherit; font-weight: 700; font-size: .92rem; color: var(--navy); cursor: pointer;
  background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: .5rem 1rem;
  transition: border-color .2s, background .2s, color .2s;
}
.chips--col .chip { border-radius: var(--radius); text-align: left; padding: .75rem 1rem; }
.chip:hover { border-color: var(--orange); }
.chip.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Chatbot ---------- */
.phone {
  width: min(420px, 100%); margin-inline: auto; height: 600px;
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 28px; border: 10px solid var(--navy-900); background: #efe7de;
  box-shadow: var(--shadow-lg);
}
.phone__bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--navy); color: #fff; }
.phone__bar .chat__avatar { background: var(--orange); flex: none; }
.phone__bar strong { display: block; color: #fff; line-height: 1.2; font-size: .98rem; }
.phone__bar small { color: #a8e6c3; font-size: .78rem; font-weight: 700; }
.phone__reset { margin-left: auto; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 34px; height: 34px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; }
.phone__reset:hover { background: rgba(255,255,255,.25); }
.phone__body {
  flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 8px;
  background-image: radial-gradient(rgba(28,58,90,.05) 1px, transparent 1px); background-size: 16px 16px;
}
.bub { max-width: 82%; padding: 8px 12px 18px; border-radius: 12px; font-size: .93rem; line-height: 1.45; position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.08); white-space: pre-line; animation: bub-in .25s ease; }
.bub time { position: absolute; right: 9px; bottom: 3px; font-size: .66rem; opacity: .6; }
.bub--bot { background: #fff; color: var(--ink); align-self: flex-start; border-top-left-radius: 3px; }
.bub--me { background: #d9fdd3; color: #1f2d1f; align-self: flex-end; border-top-right-radius: 3px; }
.bub--typing { padding: 12px 16px; }
.bub--typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: #9aa5b1; animation: dot 1s infinite; }
.bub--typing span:nth-child(2) { animation-delay: .15s; }
.bub--typing span:nth-child(3) { animation-delay: .3s; }
.bub--note { align-self: center; background: #fff7d6; color: #6b5a1e; font-size: .8rem; font-weight: 700; padding: 6px 12px; border-radius: 8px; max-width: 92%; text-align: center; }
.phone__quick { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px 4px; background: #efe7de; scrollbar-width: none; }
.phone__quick::-webkit-scrollbar { display: none; }
.phone__quick button { flex: none; font: inherit; font-size: .85rem; font-weight: 700; color: var(--navy); background: #fff; border: 1.5px solid var(--navy); border-radius: 999px; padding: .4rem .85rem; cursor: pointer; }
.phone__quick button:hover { background: var(--navy); color: #fff; }
.phone__input { display: flex; gap: 8px; padding: 8px 10px 10px; background: #efe7de; }
.phone__input input { flex: 1; min-width: 0; font: inherit; font-size: .95rem; border: 0; border-radius: 999px; padding: .65rem 1rem; background: #fff; color: var(--ink); }
.phone__input input:focus { outline: 2px solid var(--orange); }
.phone__input button { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--green); color: #fff; cursor: pointer; display: grid; place-items: center; }
.phone__input svg { width: 20px; height: 20px; fill: currentColor; }

.toast {
  width: min(420px, 100%); margin: 16px auto 0; display: flex; gap: 12px; align-items: flex-start;
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 14px 18px;
  border-left: 4px solid var(--green); animation: bub-in .35s ease;
}
.toast strong { display: block; font-size: .95rem; }
.toast span span { display: block; font-size: .85rem; color: var(--text); line-height: 1.4; margin-top: 2px; }
.toast__dot { flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(47,179,107,.2); }

/* ---------- Agente ---------- */
.agent { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 24px; display: grid; gap: 18px; }
.agent__tag { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.agent__tag--ok { color: var(--green); }
.agent__in > div { background: var(--tint); border-radius: var(--radius); padding: 14px 16px; font-size: .95rem; line-height: 1.5; }
.agent__in .from { display: block; font-weight: 800; color: var(--ink); margin-bottom: 4px; font-size: .9rem; }
.agent__in .item { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.agent__in .item:last-child { border-bottom: 0; }
.agent__steps { display: grid; gap: 10px; counter-reset: s; }
.agent__steps:empty { display: none; }
.astep { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; animation: bub-in .3s ease; }
.astep__ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--orange-soft); color: var(--orange); font-size: 1rem; }
.astep.is-done .astep__ico { background: var(--navy); color: #fff; }
.astep strong { display: block; font-size: .95rem; line-height: 1.3; }
.astep span { display: block; font-size: .88rem; color: var(--text); line-height: 1.45; }
.astep .tool { display: inline-block; margin-top: 4px; font-size: .74rem; font-weight: 800; letter-spacing: .03em; color: var(--navy); background: var(--tint); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.astep.is-working .astep__ico { animation: pulse 1s infinite; }
.agent__out { border: 2px solid var(--green); border-radius: var(--radius); padding: 14px 16px; background: #f1fbf5; animation: bub-in .35s ease; }
.agent__out ul { display: grid; gap: 6px; }
.agent__out li { font-size: .93rem; display: flex; gap: 8px; color: var(--ink); font-weight: 600; }
.agent__out li::before { content: "✓"; color: var(--green); font-weight: 800; }
.agent__out .draft { margin-top: 10px; background: #fff; border-radius: 8px; padding: 10px 12px; font-size: .88rem; border: 1px solid #cfe9da; white-space: pre-line; }
.agent__time { margin-top: 10px; font-size: .82rem; font-weight: 700; color: var(--muted); }
#agentRun[disabled] { opacity: .6; cursor: wait; transform: none; }

/* ---------- CRM ---------- */
.kanban { background: var(--tint); border-radius: var(--radius-lg); padding: 20px; border: 1px solid var(--line); }
.crm__bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.crm__stats { display: flex; flex-wrap: wrap; gap: 10px; }
.crm__stat { background: #fff; border-radius: var(--radius); padding: 8px 14px; border-left: 3px solid var(--orange); }
.crm__stat strong { font-family: var(--font-display); font-size: 1.4rem; line-height: 1; display: block; }
.crm__stat span { font-size: .78rem; font-weight: 700; color: var(--muted); }
.crm__board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.col { background: #e9edf3; border-radius: var(--radius); padding: 10px; min-height: 320px; transition: background .2s, outline-color .2s; outline: 2px dashed transparent; }
.col.is-over { background: var(--orange-soft); outline-color: var(--orange); }
.col__head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; }
.col__head h3 { font-size: .95rem; }
.col__head span { font-size: .78rem; font-weight: 800; background: #fff; border-radius: 999px; padding: 1px 9px; color: var(--navy); }
.col__list { display: grid; gap: 8px; }
.ccard {
  background: #fff; border-radius: 8px; padding: 10px 12px; cursor: grab; text-align: left; width: 100%;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); font: inherit; color: inherit;
  transition: transform .15s, box-shadow .15s;
}
.ccard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.ccard.is-drag { opacity: .45; }
.ccard.is-new { animation: flash 1.4s ease; }
.ccard strong { display: block; font-size: .95rem; line-height: 1.3; }
.ccard small { display: block; font-size: .8rem; color: var(--muted); font-weight: 700; }
.ccard .next { display: flex; gap: 6px; align-items: center; margin-top: 8px; font-size: .8rem; font-weight: 700; color: var(--navy); }
.ccard .next::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex: none; }
.ccard .next.is-ok::before { background: var(--green); }
.ccard .src { display: inline-block; margin-top: 6px; font-size: .72rem; font-weight: 800; padding: 1px 7px; border-radius: 6px; background: var(--tint); color: var(--navy); }
.ccard .src--ia { background: var(--orange-soft); color: var(--orange-600); }

/* Ficha (diálogo) */
.sheet { border: 0; padding: 0; border-radius: var(--radius-lg); width: min(480px, calc(100% - 32px)); box-shadow: var(--shadow-lg); color: var(--text); }
.sheet::backdrop { background: rgba(18,40,63,.55); }
.sheet__in { padding: 24px; display: grid; gap: 14px; }
.sheet__head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.sheet__head h3 { font-size: 1.3rem; }
.sheet__close { background: var(--tint); border: 0; width: 36px; height: 36px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; color: var(--navy); flex: none; }
.sheet dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .93rem; margin: 0; }
.sheet dt { font-weight: 800; color: var(--ink); }
.sheet dd { margin: 0; }
.sheet label { display: grid; gap: 6px; font-weight: 800; color: var(--ink); font-size: .9rem; }
.sheet select, .sheet input, .trial__form input[type="text"], .trial__form input[type="tel"], .trial__form input[type="email"] {
  font: inherit; font-weight: 600; font-size: .95rem; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: .65rem .8rem; background: #fff; width: 100%;
}
.sheet select:focus, .sheet input:focus, .trial__form input:focus { outline: 2px solid var(--orange); border-color: transparent; }
.sheet__hist { display: grid; gap: 6px; font-size: .86rem; max-height: 150px; overflow-y: auto; }
.sheet__hist li { padding: 6px 10px; background: var(--tint); border-radius: 6px; }
.sheet__hist time { font-weight: 800; color: var(--navy); margin-right: 6px; }
.sheet__row { display: flex; gap: 8px; }
.sheet__row input { flex: 1; }
.sheet__actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Prueba de 15 días ---------- */
.trial { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start; }
.trial__steps { display: grid; gap: 14px; margin-top: 2rem; counter-reset: t; }
.trial__steps li { display: grid; grid-template-columns: 44px 1fr; gap: 4px 16px; background: #fff; border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); counter-increment: t; }
.trial__steps li::before { content: counter(t); grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; background: var(--orange); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; display: grid; place-items: center; }
.trial__steps strong { font-family: var(--font-display); text-transform: uppercase; font-size: 1.05rem; }
.trial__steps span { font-size: .95rem; }
.trial__form { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 32px; display: grid; gap: 14px; border-top: 5px solid var(--orange); }
.trial__h { font-family: var(--font-display); text-transform: uppercase; font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.trial__form label { display: grid; gap: 6px; font-weight: 800; color: var(--ink); font-size: .92rem; }
.trial__form label small { font-weight: 600; color: var(--muted); }
.trial__form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.trial__form legend { font-weight: 800; color: var(--ink); font-size: .92rem; margin-bottom: 8px; width: 100%; }
.check { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px !important; cursor: pointer; }
fieldset .check { border: 2px solid var(--line); border-radius: 999px; padding: .45rem 1rem; transition: border-color .2s, background .2s; }
fieldset .check:has(input:checked) { border-color: var(--orange); background: var(--orange-soft); }
.check input { width: 18px; height: 18px; accent-color: var(--orange); margin: 0; flex: none; }
.check--legal { align-items: flex-start !important; font-weight: 600 !important; font-size: .85rem !important; color: var(--text) !important; }
.check--legal input { margin-top: 3px; }
.trial__error { background: #fdecec; color: #a12a2a; border-radius: var(--radius); padding: 10px 12px; font-weight: 700; font-size: .9rem; }
.trial__note { font-size: .82rem; color: var(--muted); text-align: center; }

/* ---------- Animaciones ---------- */
@keyframes bub-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(233,106,46,.45); } 50% { box-shadow: 0 0 0 7px rgba(233,106,46,0); } }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--orange); } 100% { box-shadow: var(--shadow-sm); } }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .demo, .trial { grid-template-columns: 1fr; gap: 36px; }
  .demo__top { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 700px) {
  .tabs { grid-template-columns: 1fr; gap: 8px; }
  .tab { padding: 12px 14px; }
  .tab svg { width: 38px; height: 38px; padding: 8px; }
  .phone { height: 540px; border-width: 6px; border-radius: 22px; }
  .kanban { padding: 12px; }
  .crm__board { grid-template-columns: repeat(4, 78%); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .trial__form { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .bub, .astep, .toast, .agent__out, .ccard.is-new { animation: none; }
}

[hidden] { display: none !important; }
