/* ════════════════════════════════════════════════════════════════
   Soffia — "Meet Soffia" Landing Page Widget
   Floating chat button + panel
════════════════════════════════════════════════════════════════ */

:root {
  --sw-teal:      #0D9488;
  --sw-teal-dark: #0B7A70;
  --sw-navy:      #0D1B3E;
  --sw-offwhite:  #F5F3F0;
  --sw-white:     #FFFFFF;
  --sw-grey:      #6B7280;
  --sw-border:    #E5E7EB;
  --sw-radius:    16px;
  --sw-shadow:    0 4px 24px rgba(0, 0, 0, 0.16);
  --sw-z:         1000;
}

/* ─── Floating toggle button ─────────────────────────────────── */

#sw-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: var(--sw-z);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--sw-navy);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(13,148,136,0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

#sw-toggle:hover {
  background: #0a1530;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

#sw-toggle .sw-arc-icon {
  width: 28px;
  height: 18px;
  display: block;
  transition: opacity 0.15s ease;
}

#sw-toggle .sw-close-icon {
  width: 20px;
  height: 20px;
  display: none;
  transition: opacity 0.15s ease;
}

#sw-toggle.sw-active .sw-arc-icon  { display: none; }
#sw-toggle.sw-active .sw-close-icon { display: block; }

/* ─── Panel ──────────────────────────────────────────────────── */

#sw-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: var(--sw-z);
  width: 360px;
  height: 520px;
  background: var(--sw-navy);
  border-radius: var(--sw-radius);
  box-shadow: var(--sw-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);

  /* Hidden by default */
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#sw-panel.sw-open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

/* ─── Drag handle (mobile only) ──────────────────────────────── */

.sw-drag-handle {
  display: none;
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

/* ─── Header ─────────────────────────────────────────────────── */

.sw-header {
  background: var(--sw-navy);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sw-header-logo svg {
  width: 22px;
  height: 14px;
  display: block;
}

.sw-header-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sw-header-name {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 15px;
  color: var(--sw-white);
  letter-spacing: 0.5px;
  line-height: 1;
}

.sw-header-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.3px;
  line-height: 1;
}

/* ─── Message area ───────────────────────────────────────────── */

.sw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--sw-navy);
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sw-messages::-webkit-scrollbar { width: 4px; }
.sw-messages::-webkit-scrollbar-track { background: transparent; }
.sw-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ─── Bubbles ────────────────────────────────────────────────── */

.sw-bubble {
  max-width: 85%;
  padding: 10px 13px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--sw-navy);
  word-wrap: break-word;
}

.sw-bubble--soffia {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px 16px 16px 16px;
  align-self: flex-start;
  color: rgba(255,255,255,0.82);
}

.sw-bubble--visitor {
  background: var(--sw-teal);
  border-radius: 16px 4px 16px 16px;
  align-self: flex-end;
  color: var(--sw-white);
}

/* ─── Typing indicator ───────────────────────────────────────── */

.sw-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
}

.sw-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sw-grey);
  animation: sw-bounce 1.2s infinite ease-in-out;
}

.sw-typing span:nth-child(1) { animation-delay: 0s;    }
.sw-typing span:nth-child(2) { animation-delay: 0.18s; }
.sw-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes sw-bounce {
  0%, 80%, 100% { transform: translateY(0);     opacity: 0.4; }
  40%            { transform: translateY(-5px);  opacity: 1;   }
}

/* ─── Suggested question chips ───────────────────────────────── */

.sw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  align-self: flex-start;
  max-width: 100%;
}

.sw-chip {
  padding: 7px 13px;
  border: 1px solid rgba(13,148,136,0.5);
  border-radius: 20px;
  background: rgba(13,148,136,0.12);
  color: #14B8A6;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.sw-chip:hover {
  background: var(--sw-teal);
  border-color: var(--sw-teal);
  color: var(--sw-white);
}

/* ─── CTA button ─────────────────────────────────────────────── */

.sw-cta-btn {
  align-self: flex-start;
  margin-top: 6px;
  padding: 9px 16px;
  background: var(--sw-teal);
  color: var(--sw-white);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sw-cta-btn:hover {
  background: var(--sw-teal-dark);
}

/* ─── Disclaimer ─────────────────────────────────────────────── */

.sw-disclaimer {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  text-align: center;
  padding: 6px 16px;
  background: var(--sw-navy);
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  line-height: 1.4;
}

/* ─── Input row ──────────────────────────────────────────────── */

.sw-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--sw-navy);
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sw-input {
  flex: 1;
  border: 1px solid rgba(255,255,255,0.08);
  outline: none;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.06);
  padding: 8px 14px;
  border-radius: 20px;
  font-family: inherit;
}

.sw-input::placeholder {
  color: rgba(255,255,255,0.3);
}

.sw-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sw-teal);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, opacity 0.15s ease;
  color: var(--sw-white);
}

.sw-send-btn svg {
  width: 15px;
  height: 15px;
}

.sw-send-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.sw-send-btn:not(:disabled):hover {
  background: var(--sw-teal-dark);
}

/* ─── Keyboard mode (tablet landscape) ──────────────────────── */

#sw-panel.sw-keyboard-mode .sw-header {
  padding: 0 12px;
  height: 36px;
}

#sw-panel.sw-keyboard-mode .sw-header-name {
  font-size: 12px;
}

#sw-panel.sw-keyboard-mode .sw-header-sub {
  display: none;
}

/* Hide insight strip in keyboard mode if present */
#sw-panel.sw-keyboard-mode .sw-insight {
  display: none;
}

/* ─── Mobile overlay ─────────────────────────────────────────── */

#sw-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#sw-overlay.sw-open {
  display: block;
  opacity: 1;
}

/* ─── Mobile — bottom sheet ──────────────────────────────────── */

@media (max-width: 767px) {
  .sw-input {
    font-size: 16px; /* prevents iOS Safari auto-zoom on focus */
  }

  #sw-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 75vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  #sw-panel.sw-open {
    transform: translateY(0);
    opacity: 1;
  }

  .sw-drag-handle {
    display: block;
  }

  #sw-toggle {
    bottom: 20px;
    right: 20px;
  }
}
