/* buildcontrol Chat Widget — v1.0.0 */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Nunito:wght@400;500;600;700&display=swap');

:root {
  --bc-brand:        #1565C0;
  --bc-brand-mid:    #1976D2;
  --bc-brand-light:  #1E88E5;
  --bc-brand-xlight: #EFF5FD;
  --bc-brand-muted:  rgba(21,101,192,0.10);
  --bc-brand-shadow: rgba(21,101,192,0.28);
  --bc-bg:           #F5F8FE;
  --bc-surface:      #FFFFFF;
  --bc-border:       #DDE6F5;
  --bc-text-1:       #0D1B2A;
  --bc-text-2:       #4A5C74;
  --bc-text-3:       #8898AA;
  --bc-r-sm:         8px;
  --bc-r-md:         12px;
  --bc-r-lg:         16px;
  --bc-r-xl:         20px;
  --bc-f-head:       'Plus Jakarta Sans', sans-serif;
  --bc-f-body:       'Nunito', sans-serif;
  --bc-ease:         cubic-bezier(.4,0,.2,1);
  --bc-spring:       cubic-bezier(.34,1.56,.64,1);
  --bc-pos-right:    28px;
  --bc-pos-bottom:   28px;
  --bc-widget-w:     390px;
}

/* ── Overlay ── */
.bc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13,27,42,0.35);
  z-index: 999980;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .3s var(--bc-ease);
}
.bc-overlay.show { opacity: 1; }

/* ── Launcher ── */
.bc-launcher {
  position: fixed;
  bottom: var(--bc-pos-bottom);
  right: var(--bc-pos-right);
  z-index: 999990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.bc-launcher.left-pos {
  right: auto;
  left: var(--bc-pos-right);
  align-items: flex-start;
}

/* ── Nudge tooltip ── */
.bc-nudge {
  background: var(--bc-surface);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-r-lg) var(--bc-r-lg) 4px var(--bc-r-lg);
  padding: 10px 14px;
  font-family: var(--bc-f-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--bc-text-1);
  box-shadow: 0 8px 28px rgba(13,27,42,0.12);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 230px;
  line-height: 1.45;
  animation: bcNudgeIn .4s var(--bc-spring) both;
}
.bc-launcher.left-pos .bc-nudge {
  border-radius: var(--bc-r-lg) var(--bc-r-lg) var(--bc-r-lg) 4px;
}
@keyframes bcNudgeIn {
  from { opacity:0; transform:translateX(16px) scale(.9); }
  to   { opacity:1; transform:translateX(0)    scale(1); }
}
.bc-nudge-close {
  margin-left: 4px;
  color: var(--bc-text-3);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .15s;
}
.bc-nudge-close:hover { color: var(--bc-text-1); }

/* ── FAB ── */
.bc-fab {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0D47A1 0%, #1565C0 45%, #1E88E5 100%);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 24px var(--bc-brand-shadow), 0 2px 8px rgba(13,27,42,0.15);
  transition: transform .25s var(--bc-spring), box-shadow .25s var(--bc-ease);
  position: relative;
  flex-shrink: 0;
  padding: 0;
}
.bc-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 32px var(--bc-brand-shadow);
}
.bc-fab:active { transform: scale(0.96); }
.bc-fab:focus  { outline: 3px solid rgba(21,101,192,0.4); outline-offset: 3px; }

.bc-fab::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(21,101,192,0.35);
  animation: bcPulseRing 2.5s ease-out infinite;
  pointer-events: none;
}
@keyframes bcPulseRing {
  0%  { transform:scale(1);   opacity:.7; }
  70% { transform:scale(1.3); opacity:0;  }
  100%{ transform:scale(1.3); opacity:0;  }
}

.bc-fab .ic-chat,
.bc-fab .ic-close {
  position: absolute;
  transition: opacity .2s var(--bc-ease), transform .3s var(--bc-spring);
}
.bc-fab .ic-chat  { opacity:1; transform:scale(1)  rotate(0deg); }
.bc-fab .ic-close { opacity:0; transform:scale(.5) rotate(-90deg); }
.bc-fab.open .ic-chat  { opacity:0; transform:scale(.5) rotate(90deg); }
.bc-fab.open .ic-close { opacity:1; transform:scale(1)  rotate(0deg); }

.bc-badge {
  position: absolute;
  top: -3px; right: -3px;
  width: 18px; height: 18px;
  background: #E53935;
  border-radius: 50%;
  border: 2.5px solid white;
  font-size: 9px;
  font-weight: 800;
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--bc-f-head);
  transition: transform .2s var(--bc-spring), opacity .2s;
}
.bc-badge.hidden { transform:scale(0); opacity:0; pointer-events:none; }

/* ── Popup container ── */
.bc-popup {
  position: fixed;
  bottom: calc(var(--bc-pos-bottom) + 76px);
  right: var(--bc-pos-right);
  z-index: 999991;
  width: var(--bc-widget-w);
  max-width: calc(100vw - 32px);
  max-height: 620px;
  background: var(--bc-surface);
  border-radius: var(--bc-r-xl);
  box-shadow:
    0 24px 64px rgba(13,27,42,0.18),
    0 8px 24px rgba(13,27,42,0.10),
    0 0 0 1px rgba(21,101,192,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px) scale(.95);
  pointer-events: none;
  transition: opacity .3s var(--bc-ease), transform .35s var(--bc-spring);
  transform-origin: bottom right;
}
.bc-popup.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
.bc-launcher.left-pos ~ .bc-popup {
  right: auto;
  left: var(--bc-pos-right);
  transform-origin: bottom left;
}

/* ── Header ── */
.wg-header {
  background: linear-gradient(135deg, #0D47A1 0%, #1565C0 45%, #1976D2 100%);
  padding: 16px 18px 14px;
  display: flex; align-items: center; gap: 11px;
  position: relative; overflow: hidden; flex-shrink: 0;
}
.wg-header::before {
  content:''; position:absolute; top:-28px; right:-28px;
  width:100px; height:100px; border-radius:50%;
  background:rgba(255,255,255,0.07); pointer-events:none;
}
.wg-header::after {
  content:''; position:absolute; bottom:-18px; left:50px;
  width:70px; height:70px; border-radius:50%;
  background:rgba(255,255,255,0.04); pointer-events:none;
}
.wg-logo {
  width:38px; height:38px;
  background:rgba(255,255,255,0.15);
  border:1.5px solid rgba(255,255,255,0.25);
  border-radius:var(--bc-r-md);
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0; z-index:1;
}
.wg-info { flex:1; z-index:1; }
.wg-name {
  font-family: var(--bc-f-head);
  font-size:15px; font-weight:800;
  color:#fff; letter-spacing:-.3px; line-height:1.1;
}
.wg-status {
  font-size:11px; color:rgba(255,255,255,0.75);
  margin-top:2px; display:flex; align-items:center; gap:5px;
  font-family:var(--bc-f-body);
}
.wg-dot {
  width:6px; height:6px; background:#69F0AE; border-radius:50%;
  animation:bcDot 2s ease-in-out infinite; flex-shrink:0;
}
@keyframes bcDot {
  0%,100%{opacity:1;transform:scale(1)}
  50%{opacity:.5;transform:scale(.8)}
}
.wg-close {
  z-index:1; width:30px; height:30px;
  background:rgba(255,255,255,0.12);
  border:1px solid rgba(255,255,255,0.2);
  border-radius:50%; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  color:rgba(255,255,255,0.85); font-size:18px; line-height:1;
  transition:background .18s; flex-shrink:0;
  font-family:var(--bc-f-body); padding:0;
}
.wg-close:hover { background:rgba(255,255,255,0.22); }
.wg-close:focus { outline:2px solid rgba(255,255,255,0.5); }

/* ── Progress ── */
.wg-prog {
  background:var(--bc-surface);
  padding:8px 18px;
  display:flex; align-items:center; gap:9px;
  border-bottom:1px solid var(--bc-border);
  flex-shrink:0;
}
.wg-prog-label {
  font-size:10px; font-weight:700; color:var(--bc-text-3);
  letter-spacing:.6px; text-transform:uppercase; white-space:nowrap;
}
.wg-prog-track {
  flex:1; height:4px;
  background:var(--bc-border); border-radius:99px; overflow:hidden;
}
.wg-prog-fill {
  height:100%;
  background:linear-gradient(90deg,#1565C0,#1E88E5,#00ACC1);
  border-radius:99px;
  transition:width .55s var(--bc-ease);
}
.wg-prog-frac {
  font-size:10px; font-weight:700; color:var(--bc-brand);
  white-space:nowrap; min-width:32px; text-align:right;
}

/* ── Messages ── */
.wg-msgs {
  background:var(--bc-bg);
  padding:16px 12px;
  flex:1; overflow-y:auto;
  display:flex; flex-direction:column; gap:9px;
  scroll-behavior:smooth; min-height:0;
}
.wg-msgs::-webkit-scrollbar{width:3px}
.wg-msgs::-webkit-scrollbar-track{background:transparent}
.wg-msgs::-webkit-scrollbar-thumb{background:var(--bc-border);border-radius:99px}

.bc-row {
  display:flex; align-items:flex-end; gap:7px;
  animation:bcPop .3s var(--bc-spring) both;
}
.bc-row.user { flex-direction:row-reverse; }

@keyframes bcPop {
  from{opacity:0;transform:translateY(12px) scale(.94)}
  to  {opacity:1;transform:translateY(0)    scale(1)}
}

.bc-av {
  width:28px; height:28px; border-radius:9px;
  background:linear-gradient(135deg,#1565C0,#1E88E5);
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0; margin-bottom:2px;
  box-shadow:0 2px 8px var(--bc-brand-shadow);
}
.bc-av svg { width:14px; height:14px; }

.bc-bubble {
  max-width:82%; padding:9px 13px;
  border-radius:14px;
  font-size:13px; line-height:1.55;
  font-family:var(--bc-f-body);
}
.bc-row.bot .bc-bubble {
  background:var(--bc-surface); color:var(--bc-text-1);
  border-bottom-left-radius:4px;
  box-shadow:0 1px 4px rgba(13,27,42,0.06),0 0 0 1px var(--bc-border);
}
.bc-row.user .bc-bubble {
  background:linear-gradient(135deg,#1565C0 0%,#1E88E5 100%);
  color:#fff; border-bottom-right-radius:4px;
  font-weight:600; font-size:12.5px;
}

.bc-typing-wrap { display:flex; align-items:center; gap:4px; padding:10px 14px; }
.bc-td {
  width:5px; height:5px; border-radius:50%;
  background:var(--bc-text-3);
  animation:bcTd 1.2s ease-in-out infinite;
}
.bc-td:nth-child(2){animation-delay:.2s}
.bc-td:nth-child(3){animation-delay:.4s}
@keyframes bcTd {
  0%,60%,100%{transform:translateY(0);opacity:.4}
  30%{transform:translateY(-5px);opacity:1}
}

/* ── Options panel ── */
.wg-opts {
  background:var(--bc-surface);
  padding:12px 12px 14px;
  border-top:1px solid var(--bc-border);
  display:flex; flex-direction:column; gap:8px;
  flex-shrink:0;
}
.bc-opts-grid { display:flex; flex-wrap:wrap; gap:6px; }

.bc-opt {
  flex:1 1 auto; min-width:calc(50% - 3px);
  padding:9px 11px;
  background:var(--bc-bg);
  border:1.5px solid var(--bc-border);
  border-radius:var(--bc-r-sm);
  font-family:var(--bc-f-body);
  font-size:12.5px; font-weight:600;
  color:var(--bc-text-2); cursor:pointer;
  text-align:center; line-height:1.3;
  transition:all .18s var(--bc-ease);
  touch-action:manipulation;
}
.bc-opt:hover {
  border-color:var(--bc-brand-light); color:var(--bc-brand);
  transform:translateY(-1px);
  box-shadow:0 3px 12px var(--bc-brand-muted);
}
.bc-opt.fw  { min-width:100%; }
.bc-opt.sel {
  background:var(--bc-brand-xlight);
  border-color:var(--bc-brand-mid);
  color:var(--bc-brand); font-weight:700;
}
.bc-opt.sel::before { content:'✓ '; color:var(--bc-brand); font-weight:800; }
.bc-opt:focus { outline:2px solid var(--bc-brand); outline-offset:2px; }

.bc-btn-p {
  width:100%; padding:12px;
  background:linear-gradient(135deg,#1565C0 0%,#1E88E5 100%);
  color:#fff; border:none; border-radius:var(--bc-r-md);
  font-family:var(--bc-f-head); font-size:13px; font-weight:700;
  cursor:pointer; letter-spacing:.1px;
  transition:all .2s var(--bc-ease);
  box-shadow:0 4px 16px var(--bc-brand-shadow);
  display:flex; align-items:center; justify-content:center; gap:7px;
}
.bc-btn-p:hover { transform:translateY(-1px); box-shadow:0 7px 22px var(--bc-brand-shadow); filter:brightness(1.06); }
.bc-btn-p:active { transform:translateY(0); }
.bc-btn-p:disabled { opacity:.4; cursor:not-allowed; transform:none; box-shadow:none; filter:none; }
.bc-btn-p:focus { outline:3px solid rgba(21,101,192,0.4); outline-offset:2px; }

.bc-btn-s {
  width:100%; padding:12px; background:transparent;
  color:var(--bc-text-2); border:1.5px solid var(--bc-border);
  border-radius:var(--bc-r-md);
  font-family:var(--bc-f-head); font-size:13px; font-weight:600;
  cursor:pointer; transition:all .2s var(--bc-ease);
  display:flex; align-items:center; justify-content:center; gap:7px;
}
.bc-btn-s:hover { border-color:var(--bc-brand-mid); color:var(--bc-brand); background:var(--bc-brand-xlight); }

.bc-btn-wa {
  width:100%; padding:12px;
  background:linear-gradient(135deg,#128C7E,#25D366);
  color:#fff; border:none; border-radius:var(--bc-r-md);
  font-family:var(--bc-f-head); font-size:13px; font-weight:700;
  cursor:pointer; transition:all .2s var(--bc-ease);
  box-shadow:0 4px 16px rgba(37,211,102,0.25);
  display:flex; align-items:center; justify-content:center; gap:7px;
}
.bc-btn-wa:hover { transform:translateY(-1px); box-shadow:0 7px 22px rgba(37,211,102,0.35); }

.bc-sec-lbl {
  font-size:10.5px; font-weight:700; color:var(--bc-text-3);
  text-transform:uppercase; letter-spacing:.6px; padding:0 2px 3px;
  font-family:var(--bc-f-head);
}
.bc-hint { font-size:11px; color:var(--bc-text-3); padding:0 2px 2px; font-family:var(--bc-f-body); }

/* ── Fields ── */
.bc-fields { display:flex; flex-direction:column; gap:8px; }
.bc-field  { display:flex; flex-direction:column; gap:3px; }
.bc-field label {
  font-size:10.5px; font-weight:700; color:var(--bc-text-2);
  text-transform:uppercase; letter-spacing:.5px; font-family:var(--bc-f-head);
}
.bc-field input {
  padding:10px 12px;
  background:var(--bc-bg);
  border:1.5px solid var(--bc-border);
  border-radius:var(--bc-r-sm);
  font-family:var(--bc-f-body);
  font-size:13px; color:var(--bc-text-1);
  outline:none;
  transition:border-color .18s,box-shadow .18s;
  width:100%;
}
.bc-field input::placeholder { color:var(--bc-text-3); }
.bc-field input:focus { border-color:var(--bc-brand-mid); box-shadow:0 0 0 3px rgba(21,101,192,0.1); }
.bc-field input.err  { border-color:#E53935; box-shadow:0 0 0 3px rgba(229,57,53,0.1); }
.bc-ferr { font-size:11px; color:#E53935; display:none; margin-top:2px; font-family:var(--bc-f-body); }
.bc-ferr.show { display:block; }

/* ── Welcome ── */
.wg-welcome {
  padding:28px 20px 22px;
  display:flex; flex-direction:column; align-items:center;
  text-align:center; gap:16px; flex-shrink:0;
}
.w-icon {
  width:68px; height:68px;
  background:linear-gradient(145deg,var(--bc-brand-xlight),rgba(21,101,192,0.05));
  border:2px solid rgba(21,101,192,0.13);
  border-radius:var(--bc-r-xl);
  display:flex; align-items:center; justify-content:center;
  animation:bcFloat 3.5s ease-in-out infinite;
}
@keyframes bcFloat {
  0%,100%{transform:translateY(0) rotate(-1deg)}
  50%{transform:translateY(-7px) rotate(1deg)}
}
.w-title {
  font-family:var(--bc-f-head); font-size:20px; font-weight:800;
  color:var(--bc-text-1); letter-spacing:-.4px; line-height:1.25;
}
.w-title span {
  background:linear-gradient(135deg,#1565C0,#0288D1);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
  background-clip:text;
}
.w-sub {
  font-size:13px; color:var(--bc-text-2); line-height:1.65;
  max-width:300px; margin-top:-6px; font-family:var(--bc-f-body);
}
.w-pills { display:flex; gap:6px; flex-wrap:wrap; justify-content:center; }
.pill {
  padding:4px 11px;
  background:var(--bc-bg); border:1px solid var(--bc-border);
  border-radius:99px; font-size:11px; color:var(--bc-text-2);
  font-weight:600; display:flex; align-items:center; gap:4px;
  font-family:var(--bc-f-body);
}
.pill .pd { width:5px; height:5px; border-radius:50%; background:#69F0AE; }

/* ── Chat area ── */
.wg-chat-area {
  display:flex; flex-direction:column;
  flex:1; min-height:0; overflow:hidden;
}

/* ── Closing ── */
.wg-closing {
  padding:28px 20px 22px;
  display:flex; flex-direction:column; align-items:center;
  text-align:center; gap:14px; flex-shrink:0; overflow-y:auto;
}
.c-icon {
  width:58px; height:58px;
  background:linear-gradient(135deg,#1565C0,#1E88E5);
  border-radius:var(--bc-r-xl);
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 6px 20px var(--bc-brand-shadow);
  animation:bcPopBounce .55s var(--bc-spring) both;
  flex-shrink:0;
}
@keyframes bcPopBounce {
  from{transform:scale(.4);opacity:0}
  to  {transform:scale(1);opacity:1}
}
.c-title {
  font-family:var(--bc-f-head); font-size:19px; font-weight:800;
  color:var(--bc-text-1); letter-spacing:-.3px; line-height:1.3;
}
.c-sub {
  font-size:12.5px; color:var(--bc-text-2); line-height:1.65;
  max-width:290px; margin-top:-4px; font-family:var(--bc-f-body);
}
.c-info {
  display:flex; gap:9px; font-size:11.5px; color:var(--bc-text-2);
  background:var(--bc-bg); border:1px solid var(--bc-border);
  border-radius:var(--bc-r-md); padding:11px 13px;
  text-align:left; align-items:flex-start; line-height:1.5;
  font-family:var(--bc-f-body); width:100%;
}
.c-info svg { flex-shrink:0; margin-top:1px; }
.c-actions  { width:100%; display:flex; flex-direction:column; gap:8px; }

/* ── Footer ── */
.wg-foot {
  padding:8px 0 4px; text-align:center;
  font-size:10px; color:var(--bc-text-3);
  letter-spacing:.2px; font-family:var(--bc-f-body);
  border-top:1px solid var(--bc-border);
  flex-shrink:0; background:var(--bc-surface);
}
.wg-foot a { color:var(--bc-brand); font-weight:700; text-decoration:none; }

/* ── Step enter ── */
.bc-step-enter { animation:bcStepIn .26s var(--bc-ease) both; }
@keyframes bcStepIn {
  from{opacity:0;transform:translateX(12px)}
  to  {opacity:1;transform:translateX(0)}
}

/* ── Hidden ── */
.hidden { display:none !important; }

/* ── Mobile ── */
@media (max-width: 480px) {
  :root {
    --bc-pos-right: 16px;
    --bc-pos-bottom: 16px;
  }
  .bc-overlay { display:block; pointer-events:none; }
  .bc-overlay.show { pointer-events:all; }
  .bc-popup {
    bottom:0; right:0; left:0;
    max-width:100%; width:100%;
    max-height:92vh;
    border-radius:20px 20px 0 0;
    transform-origin:bottom center;
  }
  .bc-fab { width:54px; height:54px; }
  .bc-opt { min-width:calc(50% - 3px); font-size:12px; }
}
