/* ================================================================
   SWD Smart Chat v3 — Complete Stylesheet
   Brand: #fc1d55  |  Dark glass panel  |  Smooth animations
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&display=swap');

/* ── Reset for widget scope ─────────────────────────────────── */
#swdc-root, #swdc-root * {
  box-sizing: border-box;
  margin: 1px;     padding: 2px 2px;
}
#swdc-root {
  --pink:      #fc1d55;
  --pink-dark: #d4153f;
  --pink-glow: rgba(252, 29, 85, 0.35);
  --pink-soft: rgba(252, 29, 85, 0.08);
  --glass:     rgba(15, 15, 20, 0.97);
  --glass2:    rgba(22, 22, 30, 0.95);
  --surface:   rgba(30, 30, 42, 0.9);
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.12);
  --text:      #f0f0f5;
  --text-muted:#9090a8;
  --white:     #ffffff;
  --bot-bg:    rgba(38, 38, 55, 0.9);
  --user-bg:   #fc1d55;
  --radius:    20px;
  --spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease:      cubic-bezier(0.25, 0.46, 0.45, 0.94);
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
  position: fixed;
  bottom: 24px;
  left: 20px;
  z-index: 2147483640;
  -webkit-font-smoothing: antialiased;
}

/* ================================================================
   FAB BUTTON
   ================================================================ */
#swdc-fab {
  position: relative;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fc1d55 0%, #ff5c8a 100%);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    0 0 0 0 var(--pink-glow),
    0 8px 32px rgba(252,29,85,0.5),
    0 2px 8px rgba(0,0,0,0.3);
  transition: transform .28s var(--spring), box-shadow .3s ease;
  animation: swdcIdle 3s ease-in-out infinite;
}
@keyframes swdcIdle {
  0%,100% { box-shadow: 0 0 0 0 rgba(252,29,85,0.5), 0 8px 32px rgba(252,29,85,0.5), 0 2px 8px rgba(0,0,0,0.3); }
  50%      { box-shadow: 0 0 0 16px rgba(252,29,85,0), 0 8px 32px rgba(252,29,85,0.5), 0 2px 8px rgba(0,0,0,0.3); }
}
#swdc-fab:hover  { transform: scale(1.1); }
#swdc-fab:active { transform: scale(0.92); }
#swdc-fab.is-open { animation: none; box-shadow: 0 4px 20px rgba(0,0,0,0.4); background: linear-gradient(135deg, #1a1a2e, #2d1b3d); }

/* Pulse rings */
.swdc-fab-ring {
  position: absolute;
  inset: -6px; border-radius: 50%;
  border: 1.5px solid rgba(252,29,85,0.4);
  animation: swdcRing 2.4s ease-out infinite;
  pointer-events: none;
}
.swdc-fab-ring2 { animation-delay: .8s; }
@keyframes swdcRing {
  0%   { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.7); opacity: 0; }
}
#swdc-fab.is-open .swdc-fab-ring { display: none; }

/* Icons inside FAB */
#swdc-fab svg { position: absolute; transition: transform .32s var(--spring), opacity .22s; }
.swdc-ico-chat  { width: 26px; height: 26px; opacity: 1;  transform: scale(1) rotate(0); }
.swdc-ico-close { width: 22px; height: 22px; opacity: 0;  transform: scale(0.4) rotate(-80deg); }
#swdc-fab.is-open .swdc-ico-chat  { opacity: 0;  transform: scale(0.4) rotate(80deg); }
#swdc-fab.is-open .swdc-ico-close { opacity: 1;  transform: scale(1) rotate(0); }

/* Badge */
.swdc-badge {
  position: absolute;
  top: -3px; right: -3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff; color: var(--pink);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--pink);
  transition: transform .3s var(--spring), opacity .2s;
  animation: swdcBadge 1.5s ease-in-out infinite;
}
@keyframes swdcBadge { 0%,100%{transform:scale(1)} 50%{transform:scale(1.2)} }
#swdc-fab.is-open .swdc-badge { transform: scale(0); opacity: 0; }

/* ================================================================
   PANEL
   ================================================================ */
#swdc-panel {
  position: absolute;
  bottom: 76px;
  left: 0;
  width: 380px;
  height: 580px;
  max-height: calc(100vh - 110px);
  background: #000000d9; var(--glass);
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Shadow */
  box-shadow:
    0 0 0 1px rgba(252,29,85,0.15),
    0 40px 100px rgba(0,0,0,0.7),
    0 8px 32px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.06);

  /* Closed state */
  opacity: 0;
  transform: scale(0.88) translateY(24px);
  transform-origin: bottom left;
  pointer-events: none;
  transition:
    opacity .38s var(--ease),
    transform .45s var(--spring);
}
#swdc-panel.is-open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

/* Subtle grid texture on panel */
#swdc-panel::before {
  content: '';
  position: absolute;
  inset: 0; border-radius: var(--radius);
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none; z-index: 0;
}
#swdc-panel > * { position: relative; z-index: 1; }

/* ================================================================
   HEADER
   ================================================================ */
.swdc-header {
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(252,29,85,0.95) 0%, rgba(180,10,50,0.95) 100%);
  padding: 16px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);

  /* Top accent line */
  position: relative;
}
.swdc-header::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
}

.swdc-hdr-left { display: flex; align-items: center; gap: 12px; }

.swdc-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.35);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}
.swdc-avatar svg { width: 100%; height: 100%; }
.swdc-status-ring {
  position: absolute;
  bottom: 0; right: 0;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid rgba(180,10,50,0.9);
  animation: swdcStatusPulse 2s ease-in-out infinite;
}
@keyframes swdcStatusPulse { 0%,100%{box-shadow:0 0 0 0 rgba(34,197,94,0.5)} 50%{box-shadow:0 0 0 4px rgba(34,197,94,0)} }

.swdc-hdr-name { color:#fff; font-size:15px; font-weight:700; letter-spacing:-.3px; line-height:1.2; }
.swdc-hdr-sub  {
  color: rgba(255,255,255,0.78);
  font-size: 10.5px; font-weight:500;
  display: flex; align-items: center; gap:5px; margin-top:3px;
}
.swdc-online-dot {
  width:6px; height:6px; border-radius:50%;
  background:#22c55e; display:inline-block;
  animation: swdcBlink 2s ease-in-out infinite;
}
@keyframes swdcBlink { 0%,100%{opacity:1} 50%{opacity:.3} }

.swdc-hdr-btn {
  width:32px; height:32px; border-radius:50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  transition: background .2s;
}
.swdc-hdr-btn:hover { background: rgba(255,255,255,0.22); }
.swdc-hdr-btn svg { width:16px; height:16px; }

/* ================================================================
   INTRO BAR (service chips)
   ================================================================ */
.swdc-intro-bar {
  flex-shrink: 0;
  display: flex; gap: 6px;
  padding: 10px 14px;
  background: rgba(252,29,85,0.06);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -ms-overflow-style: none; scrollbar-width: none;
}
.swdc-intro-bar::-webkit-scrollbar { display:none; }
.swdc-intro-chip {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--pink-soft);
  border: 1px solid rgba(252,29,85,0.2);
  color: var(--pink);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .2px;
  white-space: nowrap;
}

/* ================================================================
   MESSAGES
   ================================================================ */
#swdc-msgs {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px 8px;
  display: flex; flex-direction: column; gap: 6px;
  scroll-behavior: smooth;
  -ms-overflow-style: none; scrollbar-width: none;
}
#swdc-msgs::-webkit-scrollbar { display:none; }

/* Timestamp */
.swdc-ts {
  text-align: center;
  font-size: 10px; color: var(--text-muted); font-weight: 500;
  margin: 4px 0 8px; letter-spacing: .2px;
  display: flex; align-items: center; gap: 8px;
}
.swdc-ts::before, .swdc-ts::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border);
}

/* Rows */
.swdc-row { display:flex; align-items:flex-end; gap:6px; animation: swdcIn .32s var(--spring) both; }
.swdc-row.rx { justify-content:flex-start; }
.swdc-row.tx { justify-content:flex-end; }

@keyframes swdcIn {
  from { transform: translateY(18px) scale(.88); opacity:0; }
  to   { transform: none; opacity:1; }
}

/* Mini avatar (bot) */
.swdc-mini-av {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink:0;
  background: linear-gradient(135deg, #fc1d55, #ff5c8a);
  display: flex; align-items:center; justify-content:center;
  margin-bottom: 2px;
  box-shadow: 0 2px 8px rgba(252,29,85,0.35);
}
.swdc-mini-av svg { fill:white; width:13px; height:13px; }

/* Bubbles */
.swdc-bub {
  max-width: 76%;
  padding: 10px 14px;
  font-size: 13.5px; line-height: 1.55;
  word-break: break-word; letter-spacing: -.1px;
  position: relative;
}
.swdc-bub.rx {
  background: var(--bot-bg);
  color: var(--text);
  border-radius: 18px 18px 18px 4px;
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.swdc-bub.tx {
  background: linear-gradient(135deg, #fc1d55, #e8104a);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 16px rgba(252,29,85,0.35);
}

/* Bubble links */
.swdc-bub a { color: inherit; text-decoration: underline; }

/* Typing dots */
.swdc-typing-row { display:flex; align-items:flex-end; gap:6px; animation: swdcIn .28s var(--spring) both; }
.swdc-dots {
  display:flex; gap:4px; padding:12px 16px;
  background: var(--bot-bg); border-radius:18px 18px 18px 4px;
  border: 1px solid var(--border);
}
.swdc-dots span {
  width:7px; height:7px; border-radius:50%;
  background: var(--pink); display:block;
  animation: swdcDot 1.2s ease-in-out infinite both;
}
.swdc-dots span:nth-child(1){animation-delay:0s}
.swdc-dots span:nth-child(2){animation-delay:.15s}
.swdc-dots span:nth-child(3){animation-delay:.3s}
@keyframes swdcDot {
  0%,60%,100%{transform:translateY(0);opacity:.35}
  30%{transform:translateY(-8px);opacity:1}
}

/* ================================================================
   CHIPS (quick-reply / suggestion)
   ================================================================ */
#swdc-chips-area {
  flex-shrink: 0;
  padding: 0 14px 8px;
  display: flex; flex-wrap: wrap; gap: 6px;
  animation: swdcFade .3s ease both;
  min-height: 0;
}
#swdc-chips-area:empty { padding: 0; }
@keyframes swdcFade { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

.swdc-chip {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12.5px; font-weight: 600;
  font-family: inherit;
  cursor: pointer; border: none; outline: none;
  letter-spacing: -.1px;
  transition: transform .2s var(--spring), box-shadow .2s, filter .15s;
  -webkit-tap-highlight-color: transparent;
}
.swdc-chip.default {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border2);
}
.swdc-chip.default:hover { border-color: var(--pink); color: var(--pink); transform: translateY(-1px); }
.swdc-chip.primary {
  background: linear-gradient(135deg,#fc1d55,#e8104a);
  color: #fff;
  box-shadow: 0 3px 12px rgba(252,29,85,.3);
}
.swdc-chip.primary:hover { filter:brightness(1.08); transform:translateY(-1px); }
.swdc-chip.green  { background:#16a34a; color:#fff; box-shadow:0 3px 12px rgba(22,163,74,.3); }
.swdc-chip.green:hover { filter:brightness(1.08); }
.swdc-chip:active { transform:scale(.95) !important; }

/* ================================================================
   INPUT BAR
   ================================================================ */
.swdc-inputbar {
  flex-shrink: 0;
  padding: 10px 14px 14px;
  background: var(--glass2);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(20px);
}

.swdc-input-wrap {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border2);
  border-radius: 16px;
  padding: 6px 6px 6px 14px;
  transition: border-color .2s;
}
.swdc-input-wrap:focus-within {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(252,29,85,0.12);
}

#swdc-input {
  flex: 1;
  background: transparent; border:none; outline:none;
  color: var(--text);
  font-size: 14px; font-family: inherit;
  line-height: 1.5; resize: none;
  max-height: 100px;
  padding: 8px 6px;
}
#swdc-input::placeholder { color: var(--text-muted); }
#swdc-input:disabled { opacity: .4; cursor: not-allowed; }

#swdc-send {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, #fc1d55, #e8104a);
  border: none; cursor: pointer; flex-shrink: 0;
  display: flex; align-items:center; justify-content:center;
  box-shadow: 0 3px 12px rgba(252,29,85,.4);
  transition: transform .2s var(--spring), filter .15s;
}
#swdc-send:hover  { filter: brightness(1.1); }
#swdc-send:active { transform: scale(.88); }
#swdc-send:disabled { opacity:.4; cursor:not-allowed; filter:none; }
#swdc-send svg { width:16px; height:16px; }

.swdc-hint {
  font-size: 10.5px; color: var(--text-muted);
  margin-top: 6px; padding: 0 4px; min-height: 16px;
  transition: color .2s;
}
.swdc-hint.err { color: #ff6b6b; }
.swdc-hint.ok  { color: #22c55e; }

/* ================================================================
   SYSTEM / INFO MESSAGES
   ================================================================ */
.swdc-sys {
  text-align:center; font-size:11px; color:var(--text-muted);
  background: rgba(252,29,85,0.06);
  border: 1px solid rgba(252,29,85,0.12);
  border-radius:10px; padding:6px 12px;
  align-self:center; margin:4px 0;
  animation: swdcIn .3s var(--spring) both;
}

/* Final action buttons */
.swdc-action-row {
  display:flex; gap:8px; flex-wrap:wrap;
  padding: 4px 0 2px;
  animation: swdcFade .35s ease .1s both;
}
.swdc-action-btn {
  flex:1; min-width:120px;
  display:flex; align-items:center; justify-content:center; gap:7px;
  padding:11px 16px; border-radius:14px; border:none;
  font-size:13px; font-weight:700; font-family:inherit;
  cursor:pointer; letter-spacing:-.1px;
  transition:transform .2s var(--spring), filter .15s;
  -webkit-tap-highlight-color:transparent;
}
.swdc-action-btn:hover  { filter:brightness(1.08); transform:translateY(-2px); }
.swdc-action-btn:active { transform:scale(.95); }
.swdc-action-btn.wa  { background:#25D366; color:#fff; box-shadow:0 4px 16px rgba(37,211,102,.35); }
.swdc-action-btn.em  { background:linear-gradient(135deg,#fc1d55,#e8104a); color:#fff; box-shadow:0 4px 16px rgba(252,29,85,.35); }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 440px) {
  #swdc-panel { width: calc(100vw - 16px); height: calc(100vh - 100px); left:-4px; border-radius:16px; }
  #swdc-root  { left:10px; bottom:16px; }
}
@media (max-height: 650px) {
  #swdc-panel { height: calc(100vh - 100px); }
}
