/* ==========================================================
   ASC PEST CONTROL - "CHAT NOW" WIDGET
   Reuses the brand design system tokens defined in assets/asc.css
   / index.html (--burgundy, --black, --charcoal, --green, --mist ...)
   Namespaced under .asc-chat- to avoid clashing with page styles.
   ========================================================== */

/* ---------- Floating trigger button (sits above Book Now) ---------- */
.chat-float{
  position:fixed; right:1.4rem; z-index:99;
  bottom:calc(1.4rem + 58px + 14px + 50px + 14px);
  display:inline-flex; align-items:center; gap:.55rem;
  background:var(--green); color:var(--black);
  font-family:var(--font-sans, "Hanken Grotesk", sans-serif); font-weight:800; font-size:.92rem; letter-spacing:.01em;
  padding:.85rem 1.25rem; border-radius:999px; text-decoration:none; border:none; cursor:pointer;
  box-shadow:0 12px 34px rgba(121,171,20,.4);
  transition:transform .35s var(--ease, ease), box-shadow .35s var(--ease, ease), background .35s var(--ease, ease);
}
.chat-float:hover{ transform:translateY(-4px) scale(1.04); background:var(--green-bright); box-shadow:0 18px 44px rgba(121,171,20,.55); }
.chat-float svg{ width:18px; height:18px; flex:none; }
.chat-float .cf-dot{
  width:8px; height:8px; border-radius:50%; background:var(--burgundy);
  box-shadow:0 0 0 2px rgba(0,0,0,.15);
  animation:ascChatPulse 2.2s infinite;
}
@keyframes ascChatPulse{ 0%,100%{ opacity:1; } 50%{ opacity:.35; } }
@media (max-width:640px){
  .chat-float{ font-size:.85rem; padding:.75rem 1.05rem; right:1.2rem;
    bottom:calc(1.2rem + 58px + 12px + 44px + 12px); }
}
body.asc-chat-open-panel .chat-float{ display:none; }

/* ---------- Shared overlay backdrop ---------- */
.asc-chat-backdrop{
  position:fixed; inset:0; z-index:300;
  background:rgba(28,26,27,.72);
  -webkit-backdrop-filter:blur(3px); backdrop-filter:blur(3px);
  display:none; align-items:center; justify-content:center; padding:1.4rem;
  opacity:0; transition:opacity .3s var(--ease, ease);
}
.asc-chat-backdrop.is-visible{ display:flex; }
.asc-chat-backdrop.is-in{ opacity:1; }

/* ---------- Welcome popup (auto-shown on homepage) ---------- */
.asc-chat-welcome{
  position:relative; width:min(420px, 100%);
  background:var(--white, #fff); color:var(--black, #1c1a1b);
  border-radius:20px; padding:2.2rem 2rem 2rem;
  box-shadow:0 40px 90px rgba(0,0,0,.5);
  text-align:center;
  transform:translateY(14px) scale(.97); opacity:0;
  transition:transform .38s var(--ease, ease), opacity .38s var(--ease, ease);
}
.asc-chat-backdrop.is-in .asc-chat-welcome{ transform:translateY(0) scale(1); opacity:1; }
.asc-chat-welcome-close{
  position:absolute; top:.9rem; right:.9rem; width:32px; height:32px; border-radius:50%;
  display:grid; place-items:center; background:var(--cream, #FAF7F5); border:1px solid var(--line-light, rgba(28,26,27,.1));
  color:var(--black, #1c1a1b); cursor:pointer; transition:background .25s var(--ease, ease);
}
.asc-chat-welcome-close:hover{ background:var(--burgundy-soft, rgba(201,38,65,.12)); }
.asc-chat-welcome-close svg{ width:15px; height:15px; }
.asc-chat-welcome-mark{
  width:56px; height:56px; border-radius:14px; margin:0 auto 1.1rem; object-fit:cover;
  box-shadow:0 0 22px var(--glow-red, rgba(201,38,65,.22));
}
.asc-chat-welcome .doc-code{ justify-content:center; margin-bottom:.9rem; color:var(--burgundy); }
.asc-chat-welcome .doc-code::before{ background:var(--burgundy); }
.asc-chat-welcome h2{ font-size:1.55rem; margin-bottom:.6rem; line-height:1.15; }
.asc-chat-welcome p{ color:var(--slate-text, #56504f); font-size:1rem; max-width:32ch; margin:0 auto 1.5rem; }
.asc-chat-welcome-cta{
  display:inline-flex; align-items:center; justify-content:center; gap:.6rem; width:100%;
  padding:1rem 1.6rem; border-radius:999px; border:none; cursor:pointer;
  background:linear-gradient(92deg, var(--burgundy), var(--burgundy-deep));
  color:#fff; font-family:var(--font-sans, sans-serif); font-weight:800; font-size:1rem;
  box-shadow:0 10px 34px var(--glow-red, rgba(201,38,65,.22));
  transition:transform .35s var(--ease, ease), box-shadow .35s var(--ease, ease);
}
.asc-chat-welcome-cta:hover{ transform:translateY(-3px); box-shadow:0 18px 46px rgba(201,38,65,.4); }
.asc-chat-welcome-cta svg{ width:16px; height:16px; }
.asc-chat-welcome-wa{
  display:flex; align-items:center; justify-content:center; gap:.6rem; width:100%;
  padding:1rem 1.6rem; border-radius:999px; border:none; cursor:pointer; margin-top:.7rem;
  background:#25D366; color:#fff; font-family:var(--font-sans, sans-serif); font-weight:800; font-size:1rem;
  text-decoration:none; box-shadow:0 10px 34px rgba(37,211,102,.3);
  transition:transform .35s var(--ease, ease), box-shadow .35s var(--ease, ease);
}
.asc-chat-welcome-wa:hover{ transform:translateY(-3px); box-shadow:0 18px 46px rgba(37,211,102,.45); color:#fff; }
.asc-chat-welcome-wa svg{ width:18px; height:18px; flex:none; }
.asc-chat-welcome-later{
  display:block; margin-top:1rem; font-size:.84rem; color:var(--slate-text, #56504f);
  text-decoration:underline; cursor:pointer; background:none; border:none; font-family:inherit;
}

/* ---------- Chat panel ---------- */
.asc-chat-panel{
  position:fixed; z-index:301; right:1.4rem; bottom:1.4rem;
  width:min(392px, calc(100vw - 2.4rem)); max-height:min(680px, calc(100vh - 2.8rem));
  display:none; flex-direction:column;
  background:linear-gradient(180deg,#201d1e,#191617);
  border:1px solid var(--line-dark, rgba(255,255,255,.09));
  border-radius:20px; overflow:hidden;
  box-shadow:0 40px 90px rgba(0,0,0,.55);
  opacity:0; transform:translateY(18px) scale(.98);
  transition:opacity .3s var(--ease, ease), transform .3s var(--ease, ease);
}
.asc-chat-panel.is-visible{ display:flex; }
.asc-chat-panel.is-in{ opacity:1; transform:translateY(0) scale(1); }

.asc-chat-bar{
  display:flex; align-items:center; gap:.7rem; padding:.9rem 1.1rem;
  background:#171415; border-bottom:1px solid var(--line-dark, rgba(255,255,255,.09)); flex:none;
}
.asc-chat-bar img{ width:34px; height:34px; border-radius:9px; flex:none; }
.asc-chat-bar-id{ min-width:0; }
.asc-chat-bar-id strong{ display:block; font-size:.9rem; color:#fff; font-weight:800; }
.asc-chat-bar-id span{
  display:inline-flex; align-items:center; gap:.35rem;
  font-family:var(--font-mono, monospace); font-size:.64rem; letter-spacing:.08em; text-transform:uppercase;
  color:var(--green-bright, #8FCB1A);
}
.asc-chat-bar-id span::before{
  content:""; width:6px; height:6px; border-radius:50%; background:var(--green-bright, #8FCB1A);
  box-shadow:0 0 8px var(--green-bright, #8FCB1A); animation:ascChatPulse 2s infinite;
}
.asc-chat-bar-close{
  margin-left:auto; width:32px; height:32px; border-radius:50%; flex:none;
  display:grid; place-items:center; background:rgba(255,255,255,.06); border:none; cursor:pointer;
  color:#e8e3e1; transition:background .25s var(--ease, ease);
}
.asc-chat-bar-close:hover{ background:rgba(255,255,255,.14); }
.asc-chat-bar-close svg{ width:15px; height:15px; }

.asc-chat-body{
  flex:1; overflow-y:auto; padding:1.2rem 1.1rem; display:flex; flex-direction:column; gap:.85rem;
  scrollbar-width:thin;
}
.asc-chat-body::-webkit-scrollbar{ width:6px; }
.asc-chat-body::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.12); border-radius:6px; }

.asc-chat-row{ display:flex; }
.asc-chat-row.bot{ justify-content:flex-start; }
.asc-chat-row.user{ justify-content:flex-end; }
.asc-chat-msg{
  max-width:86%; padding:.8rem 1rem; border-radius:14px; font-size:.9rem; line-height:1.5;
}
.asc-chat-row.bot .asc-chat-msg{
  background:#232021; border:1px solid var(--line-dark, rgba(255,255,255,.09)); color:#e8e3e1;
  border-bottom-left-radius:4px;
}
.asc-chat-row.user .asc-chat-msg{
  background:linear-gradient(92deg, var(--burgundy), var(--burgundy-deep)); color:#fff;
  border-bottom-right-radius:4px; font-weight:600;
}
.asc-chat-typing{ display:flex; gap:4px; padding:.4rem 0; }
.asc-chat-typing i{
  width:6px; height:6px; border-radius:50%; background:var(--mist, #a9a4a4); display:block;
  animation:ascChatTyping 1.1s infinite ease-in-out;
}
.asc-chat-typing i:nth-child(2){ animation-delay:.15s; }
.asc-chat-typing i:nth-child(3){ animation-delay:.3s; }
@keyframes ascChatTyping{ 0%,60%,100%{ opacity:.3; transform:translateY(0); } 30%{ opacity:1; transform:translateY(-3px); } }

/* Service picker chips */
.asc-chat-options{ display:flex; flex-wrap:wrap; gap:.5rem; max-width:100%; }
.asc-chat-opt{
  font-family:var(--font-sans, sans-serif); font-size:.82rem; font-weight:600;
  padding:.55rem .9rem; border-radius:999px; cursor:pointer;
  background:rgba(255,255,255,.04); border:1px solid var(--line-dark, rgba(255,255,255,.09)); color:#e8e3e1;
  transition:border-color .25s var(--ease, ease), background .25s var(--ease, ease), color .25s var(--ease, ease), transform .25s var(--ease, ease);
}
.asc-chat-opt:hover{ border-color:var(--green-bright, #8FCB1A); color:var(--green-bright, #8FCB1A); background:rgba(121,171,20,.08); transform:translateY(-2px); }

/* Inline composer (address step) */
.asc-chat-composer{ display:flex; gap:.5rem; max-width:100%; }
.asc-chat-composer input{
  flex:1; min-width:0; padding:.7rem .9rem; border-radius:11px;
  border:1px solid var(--line-dark, rgba(255,255,255,.09)); background:rgba(255,255,255,.04);
  color:#fff; font-family:var(--font-sans, sans-serif); font-size:.88rem;
}
.asc-chat-composer input::placeholder{ color:var(--mist, #a9a4a4); }
.asc-chat-composer input:focus{ outline:none; border-color:var(--green-bright, #8FCB1A); background:rgba(255,255,255,.07); }
.asc-chat-composer button{
  flex:none; width:42px; height:42px; border-radius:11px; border:none; cursor:pointer;
  background:var(--green, #79AB14); color:var(--black, #1c1a1b); display:grid; place-items:center;
  transition:background .25s var(--ease, ease), transform .25s var(--ease, ease);
}
.asc-chat-composer button:hover{ background:var(--green-bright, #8FCB1A); transform:translateY(-2px); }
.asc-chat-composer button svg{ width:17px; height:17px; }

/* Quote form card (final step) */
.asc-chat-formcard{
  background:#232021; border:1px solid var(--line-dark, rgba(255,255,255,.09));
  border-radius:14px; padding:1.1rem 1.1rem 1.2rem; width:100%;
}
.asc-chat-summary{ display:flex; flex-wrap:wrap; gap:.5rem; margin-bottom:1rem; }
.asc-chat-summary span{
  display:inline-flex; align-items:center; gap:.4rem;
  font-family:var(--font-mono, monospace); font-size:.64rem; letter-spacing:.06em; text-transform:uppercase;
  padding:.35rem .65rem; border-radius:999px; border:1px solid rgba(121,171,20,.35);
  color:var(--green-bright, #8FCB1A); background:rgba(121,171,20,.06);
}
.asc-chat-summary button{
  background:none; border:none; color:inherit; font:inherit; text-transform:inherit; letter-spacing:inherit;
  cursor:pointer; text-decoration:underline; padding:0; opacity:.85;
}
.asc-chat-field{ margin-bottom:.75rem; }
.asc-chat-field label{ display:block; font-size:.72rem; font-weight:700; margin-bottom:.35rem; color:var(--mist, #a9a4a4); text-transform:uppercase; letter-spacing:.04em; }
.asc-chat-field label em{ font-style:normal; color:var(--burgundy); }
.asc-chat-field input,
.asc-chat-field select,
.asc-chat-field textarea{
  width:100%; padding:.7rem .85rem; border-radius:10px;
  border:1px solid var(--line-dark, rgba(255,255,255,.09)); background:rgba(255,255,255,.04);
  color:#fff; font-family:var(--font-sans, sans-serif); font-size:.86rem;
}
.asc-chat-field select{ color:#e8e3e1; }
.asc-chat-field select option{ color:#000; }
.asc-chat-field textarea{ resize:vertical; min-height:70px; }
.asc-chat-field input:focus,
.asc-chat-field select:focus,
.asc-chat-field textarea:focus{ outline:none; border-color:var(--green-bright, #8FCB1A); background:rgba(255,255,255,.07); }
.asc-chat-field input::placeholder,
.asc-chat-field textarea::placeholder{ color:var(--mist, #a9a4a4); }
.asc-chat-row2{ display:grid; grid-template-columns:1fr 1fr; gap:.6rem; }
.asc-chat-submit{
  width:100%; display:flex; justify-content:center; align-items:center; gap:.6rem; margin-top:.3rem;
  padding:.9rem 1.2rem; border-radius:999px; border:none; cursor:pointer;
  background:linear-gradient(92deg, var(--burgundy), var(--burgundy-deep));
  color:#fff; font-family:var(--font-sans, sans-serif); font-weight:800; font-size:.92rem;
  transition:transform .3s var(--ease, ease), box-shadow .3s var(--ease, ease);
}
.asc-chat-submit:hover{ transform:translateY(-2px); box-shadow:0 14px 34px var(--glow-red, rgba(201,38,65,.22)); }
.asc-chat-submit svg{ width:15px; height:15px; }
.asc-chat-submit:disabled{ opacity:.6; cursor:wait; transform:none; }
.asc-chat-note{ margin-top:.7rem; font-size:.72rem; color:var(--mist, #a9a4a4); text-align:center; }
.hp{ position:absolute; left:-9999px; opacity:0; height:0; overflow:hidden; }

.asc-chat-foot{
  flex:none; padding:.7rem 1.1rem; border-top:1px solid var(--line-dark, rgba(255,255,255,.09));
  background:#171415; display:flex; align-items:center; justify-content:space-between; gap:.6rem;
}
.asc-chat-foot a{
  font-family:var(--font-mono, monospace); font-size:.66rem; letter-spacing:.06em; text-transform:uppercase;
  color:var(--mist, #a9a4a4); transition:color .25s var(--ease, ease);
}
.asc-chat-foot a:hover{ color:var(--green-bright, #8FCB1A); }

@media (max-width:560px){
  .asc-chat-panel{
    right:.6rem; left:.6rem; bottom:.6rem; width:auto;
    max-height:min(88vh, 640px);
  }
}

@media (prefers-reduced-motion: reduce){
  .chat-float, .asc-chat-backdrop, .asc-chat-welcome, .asc-chat-panel, .asc-chat-opt,
  .asc-chat-composer button, .asc-chat-submit, .cf-dot, .asc-chat-typing i{
    animation-duration:.01ms !important; transition-duration:.01ms !important;
  }
}
