/* DIMEXA — Demo Agente WhatsApp de Ventas
   Authentic WhatsApp Business interactive message types (dark mode).
   Components reproduced: reply buttons, list message, multi-product message,
   in-chat catalog + cart, native order bubble, CTA URL button. */

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

:root {
  --dimexa-cyan: #1c8fd6;
  --dimexa-cyan-dark: #136aa0;
  --dimexa-green: #6cb33f;
  --wa-teal: #00a884;       /* WhatsApp action/link teal */
  --wa-teal-d: #008069;
  --wa-in: #202c33;         /* incoming bubble */
  --wa-out: #005c4b;        /* outgoing bubble */
  --wa-bg: #0b141a;
  --wa-divider: #2a3942;
  --wa-link: #53bdeb;
}

html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #0a0f14;
  color: #e9edef;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

/* DEMO banner */
.demo-banner {
  width: 100%;
  background: linear-gradient(90deg, var(--dimexa-cyan), var(--dimexa-green));
  color: #06121b;
  font-weight: 700;
  text-align: center;
  padding: 9px 12px;
  font-size: 13.5px;
  letter-spacing: 0.3px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.demo-banner .sub { font-weight: 500; opacity: 0.82; }

/* ---------- Stage ---------- */
.stage {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 40px;
  padding: 32px 20px 60px;
  max-width: 1080px;
  margin: 0 auto;
}
.panel-label {
  text-align: center;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #5e7d8f;
  margin-bottom: 14px;
  font-weight: 600;
}
.panel-label .step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--dimexa-cyan); color: #fff; font-size: 11px; margin-right: 6px;
}

/* ---------- Campaign panel (the click-to-WhatsApp ad) ---------- */
.campaign-col { width: 320px; flex-shrink: 0; }
.campaign-card {
  background: #0f1922;
  border: 1px solid #1d2c38;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
}
.camp-media {
  background: linear-gradient(150deg, var(--dimexa-cyan) 0%, var(--dimexa-cyan-dark) 55%, #0c2233 100%);
  padding: 22px 20px 26px;
  color: #fff;
}
.camp-badge {
  display: inline-block;
  background: var(--dimexa-green); color: #06121b;
  font-weight: 800; font-size: 12px;
  padding: 4px 10px; border-radius: 20px; letter-spacing: 0.4px; margin-bottom: 14px;
}
.camp-title { font-size: 23px; font-weight: 800; line-height: 1.15; margin-bottom: 6px; }
.camp-sub { font-size: 13.5px; opacity: 0.92; line-height: 1.4; }
.camp-pill-row { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.camp-pill { background: rgba(255,255,255,0.16); border-radius: 8px; padding: 8px 10px; font-size: 12px; font-weight: 600; }
.camp-pill b { display: block; font-size: 16px; }
.camp-meta { padding: 16px 18px 4px; font-size: 12px; color: #7e98a8; }
.camp-seg {
  display: inline-block; background: rgba(28,143,214,0.14); color: #5cb6ec;
  border-radius: 6px; padding: 3px 8px; font-weight: 600; font-size: 11.5px;
}
.camp-cta {
  margin: 12px 18px 20px; width: calc(100% - 36px);
  background: var(--wa-teal); color: #fff; border: none; border-radius: 12px;
  padding: 14px; font-size: 15.5px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  font-family: inherit; transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
  box-shadow: 0 6px 18px rgba(0,168,132,0.32);
}
.camp-cta:hover { background: var(--wa-teal-d); transform: translateY(-1px); }
.camp-cta.pulse { animation: ctaPulse 1.6s ease-in-out infinite; }
@keyframes ctaPulse { 0%,100% { box-shadow: 0 6px 18px rgba(0,168,132,0.32);} 50% { box-shadow: 0 6px 26px rgba(0,168,132,0.65);} }
.camp-foot { text-align: center; font-size: 11px; color: #5e7d8f; padding: 0 18px 18px; }

/* ---------- Phone ---------- */
.phone-col { width: 380px; flex-shrink: 0; }
.phone-frame {
  width: 100%; background: #000; position: relative; height: 760px;
  border: 10px solid #1a1a1a; border-radius: 44px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 2px #2a2a2a; margin: 0 auto;
}
.phone-notch {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 120px; height: 26px; background: #000; border-radius: 0 0 18px 18px; z-index: 30;
}
.wa-app {
  display: flex; flex-direction: column; height: 100%;
  background: var(--wa-bg);
  background-image: radial-gradient(rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 24px 24px;
  position: relative; overflow: hidden;
}

/* Header */
.wa-header {
  display: flex; align-items: center; gap: 10px;
  background: #202c33; padding: 30px 12px 10px;
  border-bottom: 1px solid #2a3942; flex-shrink: 0;
}
.wa-back { background: none; border: none; color: #e9edef; font-size: 18px; cursor: pointer; }
.wa-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--dimexa-cyan), var(--dimexa-green));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0;
}
.wa-contact { flex: 1; min-width: 0; }
.wa-name { font-size: 16px; font-weight: 500; color: #e9edef; }
.wa-name .verify { color: var(--dimexa-cyan); font-size: 13px; }
.wa-status { font-size: 12px; color: #8696a0; }
.wa-header-icons { display: flex; gap: 14px; color: #aebac1; font-size: 18px; }

/* Chat */
.wa-chat {
  flex: 1; overflow-y: auto; padding: 12px 7px;
  display: flex; flex-direction: column; gap: 3px; scroll-behavior: smooth;
}
.wa-chat::-webkit-scrollbar { width: 4px; }
.wa-chat::-webkit-scrollbar-thumb { background: #2a3942; border-radius: 2px; }
.day-sep {
  align-self: center; background: #182229; color: #8696a0;
  font-size: 11px; padding: 4px 12px; border-radius: 8px; margin: 6px 0;
}
.sys-enc {
  align-self: center; background: #182832; color: #ffd279;
  font-size: 10.5px; padding: 5px 10px; border-radius: 6px; margin: 2px 20px 8px;
  text-align: center; line-height: 1.4;
}

/* Bubbles */
.bubble {
  max-width: 80%; padding: 6px 9px 8px; border-radius: 7.5px;
  font-size: 14.2px; line-height: 1.34; word-wrap: break-word; position: relative;
  animation: bubbleIn 0.16s ease-out; box-shadow: 0 1px 0.5px rgba(0,0,0,0.18);
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: translateY(0);} }
.bubble.in { align-self: flex-start; background: var(--wa-in); border-top-left-radius: 0; margin-left: 4px; }
.bubble.out { align-self: flex-end; background: var(--wa-out); border-top-right-radius: 0; margin-right: 4px; }
.bubble .time { font-size: 10.5px; color: #8696a0; float: right; margin: 4px 0 0 8px; }
.bubble.out .time { color: #a8c4be; }
.bubble .time .check { color: var(--wa-link); }
.bubble b, .bubble strong { font-weight: 700; }

/* Typing */
.typing {
  align-self: flex-start; background: var(--wa-in);
  padding: 10px 14px; border-radius: 7.5px; border-top-left-radius: 0;
  margin-left: 4px; display: flex; gap: 4px;
}
.typing span { width: 6px; height: 6px; border-radius: 50%; background: #8696a0; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,60%,100% { opacity: 0.3;} 30% { opacity: 1;} }

/* ===== Interactive: Reply buttons (max 3) ===== */
/* Rendered as full-width buttons stacked directly under the message bubble. */
.wa-reply-btns {
  align-self: flex-start;
  width: calc(80% );
  max-width: 80%;
  margin: 0 0 6px 4px;
  display: flex; flex-direction: column; gap: 3px;
}
.wa-reply-btn {
  background: var(--wa-in);
  color: var(--wa-teal);
  border: none;
  border-radius: 7.5px;
  padding: 11px 10px;
  font-size: 14.5px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.18);
  transition: background 0.12s;
}
.wa-reply-btn .ic { font-size: 15px; opacity: 0.9; }
.wa-reply-btn:hover { background: #2a3942; }
.wa-reply-btn:disabled { opacity: 0.5; cursor: default; }

/* ===== Interactive: single action button on a bubble (list / CTA) ===== */
.wa-action-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 7px; padding-top: 8px;
  border-top: 1px solid rgba(134,150,160,0.25);
  color: var(--wa-teal); font-weight: 600; font-size: 14.5px;
  cursor: pointer;
}
.wa-action-btn .ic { font-size: 16px; }
.wa-action-btn.disabled { opacity: 0.5; cursor: default; }

/* ===== Multi-Product Message header (thumbnail + catalog) ===== */
.mpm-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.mpm-thumbs {
  position: relative; width: 56px; height: 56px; flex-shrink: 0;
  border-radius: 8px; overflow: hidden; background: #0e1c25;
}
.mpm-thumbs .grid { display: grid; grid-template-columns: 1fr 1fr; height: 100%; }
.mpm-thumbs .cell { display: flex; align-items: center; justify-content: center; font-size: 18px; background: linear-gradient(135deg,#16323f,#0e2430); border: 0.5px solid #0b141a; }
.mpm-bag {
  position: absolute; right: 3px; bottom: 3px; width: 20px; height: 20px;
  background: var(--wa-teal); border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
.mpm-title { font-size: 13.5px; font-weight: 700; color: #e9edef; }
.mpm-sub { font-size: 12px; color: #8696a0; }

/* ===== Native sent-cart / order bubble ===== */
.cart-msg { display: flex; gap: 10px; align-items: center; }
.cart-thumb {
  width: 46px; height: 46px; border-radius: 8px; background: #0e1c25; flex-shrink: 0;
  display: grid; grid-template-columns: 1fr 1fr; overflow: hidden;
}
.cart-thumb .cell { display: flex; align-items: center; justify-content: center; font-size: 15px; background: linear-gradient(135deg,#0c4b3e,#073b30); border: 0.5px solid #005c4b; }
.cart-body .l1 { font-size: 13.5px; font-weight: 700; }
.cart-body .l2 { font-size: 12px; color: #cfeee6; }
.cart-link { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.15); font-size: 13px; color: #d7f3ec; font-weight: 600; }

/* ===== Bottom sheet (list message + catalog) ===== */
.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.55);
  z-index: 40; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 41;
  background: #111b21; border-radius: 14px 14px 0 0;
  max-height: 78%; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.26s cubic-bezier(.2,.7,.2,1);
  box-shadow: 0 -8px 30px rgba(0,0,0,0.5);
}
.sheet.open { transform: translateY(0); }
.sheet-grab { width: 36px; height: 4px; background: #3a4a54; border-radius: 2px; margin: 8px auto 4px; }
.sheet-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px 12px;
  border-bottom: 1px solid var(--wa-divider);
}
.sheet-head .x { background: none; border: none; color: #aebac1; font-size: 20px; cursor: pointer; }
.sheet-head .t { flex: 1; font-size: 16px; font-weight: 600; }
.sheet-head .cart-ic { position: relative; color: #aebac1; font-size: 19px; }
.sheet-head .cart-ic .badge {
  position: absolute; top: -6px; right: -8px; background: var(--wa-teal); color: #06121b;
  font-size: 10px; font-weight: 800; border-radius: 10px; padding: 0 5px; min-width: 16px; text-align: center;
}
.sheet-body { overflow-y: auto; padding: 6px 0 4px; }
.sheet-body::-webkit-scrollbar { width: 4px; }
.sheet-body::-webkit-scrollbar-thumb { background: #2a3942; border-radius: 2px; }
.sheet-section { font-size: 12px; color: #8696a0; font-weight: 600; padding: 10px 16px 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* list-message rows (radio) */
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid #16242d; cursor: pointer;
}
.list-row:hover { background: #16242d; }
.list-row .lr-body { flex: 1; }
.list-row .lr-title { font-size: 15px; color: #e9edef; }
.list-row .lr-desc { font-size: 12.5px; color: #8696a0; margin-top: 2px; }
.list-row .lr-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #4a5b66; flex-shrink: 0; }

/* catalog product rows */
.cat-row { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #16242d; }
.cat-img {
  width: 60px; height: 60px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg,#16323f,#0e2430); display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.cat-info { flex: 1; min-width: 0; }
.cat-name { font-size: 14.5px; font-weight: 600; color: #e9edef; }
.cat-lab { font-size: 12px; color: #8696a0; }
.cat-price { margin-top: 3px; font-size: 14.5px; font-weight: 700; color: #e9edef; }
.cat-price .strike { font-size: 12px; color: #8696a0; text-decoration: line-through; font-weight: 400; margin-left: 6px; }
.cat-stock { font-size: 11px; color: #6cc04a; margin-top: 2px; }
.cat-stock.low { color: #f5b942; }
.cat-actions { display: flex; align-items: center; }
.add-btn {
  border: 1px solid var(--wa-teal); background: transparent; color: var(--wa-teal);
  border-radius: 18px; padding: 6px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.add-btn:hover { background: rgba(0,168,132,0.12); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--wa-teal);
  background: transparent; color: var(--wa-teal); font-size: 17px; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.stepper .q { font-size: 15px; font-weight: 700; min-width: 16px; text-align: center; }

/* sheet footer (cart bar) */
.sheet-foot { border-top: 1px solid var(--wa-divider); padding: 10px 14px 16px; background: #0e171d; }
.cart-bar {
  width: 100%; background: var(--wa-teal); color: #04130f; border: none; border-radius: 24px;
  padding: 13px 18px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: space-between;
}
.cart-bar:disabled { opacity: 0.4; cursor: default; }
.cart-bar .total { font-weight: 800; }

/* Input bar */
.wa-input-bar { display: flex; align-items: center; gap: 6px; padding: 8px; background: var(--wa-bg); flex-shrink: 0; }
.wa-input-btn { background: none; border: none; color: #8696a0; font-size: 20px; padding: 8px; cursor: pointer; }
.wa-input {
  flex: 1; background: #2a3942; border: none; border-radius: 22px;
  padding: 10px 14px; font-size: 15px; color: #e9edef; outline: none; font-family: inherit;
}
.wa-input::placeholder { color: #8696a0; }
.wa-send {
  background: var(--wa-teal); border: none; border-radius: 50%; width: 42px; height: 42px;
  color: #fff; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.wa-send:active { background: var(--wa-teal-d); }

/* connector */
.connector { align-self: center; color: #2c4655; font-size: 40px; margin-top: 200px; }

@media (max-width: 880px) {
  .stage { gap: 26px; padding: 22px 14px 50px; }
  .connector { display: none; }
  .campaign-col, .phone-col { width: 100%; max-width: 380px; }
  .phone-frame { height: 700px; }
}
