/* Sygnite Chat Widget */
/* All styles prefixed .sc- to prevent WP theme conflicts */

.sc-widget * { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

:root {
  --sc-primary: #8B1A1A;
  --sc-primary-dark: #6d1414;
  --sc-teal: #1D9E75;
  --sc-green: #25D366;
  --sc-dark: #1A1F1C;
  --sc-mid: #5C6B64;
  --sc-light: #F5F2EC;
  --sc-white: #ffffff;
  --sc-border: rgba(0,0,0,.1);
  --sc-shadow: 0 8px 40px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.1);
  --sc-radius: 20px;
  --sc-radius-sm: 12px;
}

/* ── FAB Button cluster ──────────────────────────────────────────────────── */
.sc-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  /* Container is non-interactive when closed — only FAB receives events */
  pointer-events: none;
}
/* FAB, WA-FAB and proactive bubble are always clickable */
.sc-widget .sc-fab,
.sc-widget .sc-wa-fab,
.sc-widget .sc-bubble { pointer-events: all; }
/* Everything is interactive when open */
.sc-widget.open { pointer-events: all; }
.sc-widget.pos-left { right: auto; left: 24px; align-items: flex-start; }

/* Main toggle button */
.sc-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--sc-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(139,26,26,.5);
  transition: transform .2s, box-shadow .2s;
  position: relative;
  flex-shrink: 0;
}
.sc-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(139,26,26,.6); }
.sc-fab:active { transform: scale(.96); }

.sc-fab-icon, .sc-fab-close {
  position: absolute;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
}
.sc-fab-icon  { opacity: 1; transform: scale(1) rotate(0); }
.sc-fab-close { opacity: 0; transform: scale(.5) rotate(45deg); }
.sc-widget.open .sc-fab-icon  { opacity: 0; transform: scale(.5) rotate(-45deg); }
.sc-widget.open .sc-fab-close { opacity: 1; transform: scale(1) rotate(0); }

/* Unread badge */
.sc-unread-dot {
  position: absolute;
  top: 0; right: 0;
  width: 18px; height: 18px;
  background: #ff3b30;
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transform: scale(0);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.sc-unread-dot.visible { transform: scale(1); }

/* WhatsApp mini FAB */
.sc-wa-fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--sc-green);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37,211,102,.5);
  transition: transform .2s, opacity .2s;
  opacity: 0;
  transform: scale(0) translateY(10px);
  pointer-events: none;
}
.sc-widget.open .sc-wa-fab {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
  transition-delay: .05s;
}
.sc-wa-fab:hover { transform: scale(1.1) !important; }

/* Proactive bubble */
.sc-bubble {
  background: #fff;
  border: 1px solid var(--sc-border);
  border-radius: 18px 18px 4px 18px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--sc-dark);
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  max-width: 240px;
  cursor: pointer;
  line-height: 1.4;
  animation: sc-pop .4s cubic-bezier(.34,1.56,.64,1) both;
  position: relative;
}
.sc-bubble::before {
  content: '';
  position: absolute;
  bottom: -8px; right: 16px;
  border: 8px solid transparent;
  border-top-color: #fff;
  border-bottom: none;
}
.sc-bubble-close {
  position: absolute;
  top: -8px; right: -8px;
  width: 20px; height: 20px;
  background: #fff;
  border: 1px solid var(--sc-border);
  border-radius: 50%;
  font-size: 11px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #888;
}
.pos-left .sc-bubble { border-radius: 18px 18px 18px 4px; }
.pos-left .sc-bubble::before { right: auto; left: 16px; }

@keyframes sc-pop {
  from { opacity: 0; transform: scale(.8) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Chat Window ─────────────────────────────────────────────────────────── */
.sc-window {
  width: var(--sc-widget-width, 375px);
  height: 560px;
  background: var(--sc-white);
  border-radius: var(--sc-radius, 20px);
  box-shadow: var(--sc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(.85) translateY(20px);
  opacity: 0;
  visibility: hidden;
  transform-origin: bottom right;
  transition: transform .3s cubic-bezier(.34,1.2,.64,1), opacity .25s, visibility 0s .25s;
  pointer-events: none;
}
.pos-left .sc-window { transform-origin: bottom left; }
.sc-widget.open .sc-window {
  transform: scale(1) translateY(0);
  opacity: 1;
  visibility: visible;
  transition: transform .3s cubic-bezier(.34,1.2,.64,1), opacity .25s, visibility 0s 0s;
  pointer-events: all;
}
@media (max-width: 480px) {
  .sc-window {
    width: 100vw;
    height: calc(100dvh - 90px);
    border-radius: 20px 20px 0 0;
  }
  /* Closed: widget sits in corner, sized to FAB only */
  .sc-widget {
    right: 16px;
    bottom: 16px;
    left: auto;
    width: auto;
    align-items: flex-end;
  }
  .sc-widget.pos-left { left: 16px; right: auto; align-items: flex-start; }
  /* Open: expand to full width */
  .sc-widget.open {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    align-items: stretch;
  }
  .sc-widget.open.pos-left { left: 0; right: 0; }
  .sc-fab    { align-self: flex-end; margin: 0 0 0; }
  .sc-wa-fab { align-self: flex-end; }
}

/* Header */
.sc-header {
  background: var(--sc-primary);
  padding: 16px 18px 0;
  flex-shrink: 0;
}
.sc-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}
.sc-agent-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sc-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  border: 2px solid rgba(255,255,255,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}
.sc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sc-agent-name  { color: #fff; font-size: 15px; font-weight: 600; }
.sc-agent-status {
  color: rgba(255,255,255,.8);
  font-size: 12px;
  display: flex; align-items: center; gap: 5px;
}
.sc-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4eff9e;
  box-shadow: 0 0 6px #4eff9e;
  animation: sc-pulse 2s ease-in-out infinite;
}
@keyframes sc-pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

.sc-header-close {
  background: rgba(255,255,255,.2);
  border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: background .15s;
  flex-shrink: 0;
}
.sc-header-close:hover { background: rgba(255,255,255,.3); }

/* Mode tabs */
.sc-mode-tabs {
  display: flex;
  gap: 2px;
  padding: 0;
  margin-top: 6px;
}
.sc-mode-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: none;
  color: rgba(255,255,255,.65);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 10px 10px 0 0;
  transition: all .15s;
  white-space: nowrap;
}
.sc-mode-tab:hover { color: #fff; background: rgba(255,255,255,.1); }
.sc-mode-tab.active {
  background: var(--sc-white);
  color: var(--sc-primary);
  font-weight: 600;
}

/* ── Tab panes ───────────────────────────────────────────────────────────── */
.sc-panes { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.sc-pane  { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.sc-pane.active { display: flex; }

/* Chat messages */
.sc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  scroll-behavior: smooth;
}
.sc-messages::-webkit-scrollbar { width: 4px; }
.sc-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* Messages */
.sc-msg { display: flex; flex-direction: column; margin-bottom: 14px; max-width: 82%; }
.sc-msg.bot  { align-self: flex-start; align-items: flex-start; }
.sc-msg.user { align-self: flex-end;   align-items: flex-end; }
.sc-msg.agent { align-self: flex-start; align-items: flex-start; }

.sc-bubble-msg {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.bot   .sc-bubble-msg { background: var(--sc-b-bubble, #f0f0f0); border-bottom-left-radius: 4px; color: var(--sc-b-text, var(--sc-dark)); }
.agent .sc-bubble-msg { background: #edf9f4; border-bottom-left-radius: 4px; color: var(--sc-dark); border: 1px solid #c8eedd; }
.user  .sc-bubble-msg { background: var(--sc-v-bubble, var(--sc-primary)); color: var(--sc-v-text, #fff); border-bottom-right-radius: 4px; }

.sc-msg-time { font-size: 10px; color: #bbb; margin-top: 4px; padding: 0 4px; }
.sc-agent-label { font-size: 10px; color: var(--sc-teal); margin-bottom: 3px; font-weight: 600; }

/* Typing indicator */
.sc-typing {
  display: flex; align-items: center; gap: 4px;
  padding: 12px 16px;
  background: #f0f0f0;
  border-radius: 18px 18px 18px 4px;
  width: fit-content;
  margin-bottom: 12px;
}
.sc-dot { width: 7px; height: 7px; border-radius: 50%; background: #bbb; animation: sc-bounce .9s ease-in-out infinite; }
.sc-dot:nth-child(2) { animation-delay: .15s; }
.sc-dot:nth-child(3) { animation-delay: .30s; }
@keyframes sc-bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-8px)} }

/* CTA buttons in messages */
.sc-cta-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sc-cta-btn {
  display: inline-block;
  padding: 8px 14px;
  background: #fff;
  border: 1.5px solid var(--sc-secondary, var(--sc-primary));
  color: var(--sc-secondary, var(--sc-primary));
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.sc-cta-btn:hover { background: var(--sc-secondary, var(--sc-primary)); color: #fff; }

/* Input area */
.sc-input-wrap {
  padding: 10px 12px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.sc-input {
  flex: 1;
  border: 1.5px solid #e8e8e8;
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 14px;
  resize: none;
  max-height: 100px;
  min-height: 42px;
  line-height: 1.4;
  outline: none;
  transition: border .15s;
  font-family: inherit;
  color: var(--sc-dark);
  background: #fafafa;
}
.sc-input:focus { border-color: var(--sc-primary); background: #fff; }
.sc-input::placeholder { color: #bbb; }
.sc-send {
  width: 40px; height: 40px;
  background: var(--sc-primary);
  border: none;
  border-radius: 50%;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .15s, background .15s;
}
.sc-send:hover { background: var(--sc-primary-dark); transform: scale(1.08); }
.sc-send:disabled { background: #ddd; cursor: default; transform: none; }

/* Lead capture form */
.sc-lead-form {
  padding: 18px 16px;
  background: #f9f8f6;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
  animation: sc-pop .3s ease both;
}
.sc-lead-form h4 { font-size: 13px; color: var(--sc-dark); margin-bottom: 12px; }
.sc-lead-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.sc-lead-form input, .sc-lead-form select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #e8e8e8;
  border-radius: 10px;
  font-size: 13px;
  outline: none;
  background: #fff;
  color: var(--sc-dark);
  transition: border .15s;
  font-family: inherit;
}
.sc-lead-form input:focus, .sc-lead-form select:focus { border-color: var(--sc-primary); }
.sc-lead-submit {
  width: 100%;
  padding: 10px;
  background: var(--sc-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: background .15s;
}
.sc-lead-submit:hover { background: var(--sc-primary-dark); }

/* ── WhatsApp tab ─────────────────────────────────────────────────────────── */
.sc-wa-pane {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  flex: 1;
}
.sc-wa-logo {
  width: 72px; height: 72px;
  background: var(--sc-green);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  box-shadow: 0 4px 20px rgba(37,211,102,.4);
}
.sc-wa-title { font-size: 18px; font-weight: 700; color: var(--sc-dark); }
.sc-wa-sub   { font-size: 13px; color: var(--sc-mid); line-height: 1.5; }
.sc-wa-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--sc-green);
  color: #fff;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(37,211,102,.45);
  transition: transform .15s, box-shadow .15s;
  width: 100%;
  justify-content: center;
}
.sc-wa-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(37,211,102,.5);
  color: #fff;
  text-decoration: none;
}
.sc-wa-number { font-size: 13px; color: var(--sc-mid); }
.sc-wa-hours  {
  background: #f0faf5;
  border: 1px solid #c8eedd;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--sc-teal);
  width: 100%;
}

/* ── Live Chat tab ───────────────────────────────────────────────────────── */
.sc-live-offline {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  flex: 1;
}
.sc-offline-icon { font-size: 48px; }
.sc-offline-title { font-size: 16px; font-weight: 700; color: var(--sc-dark); }
.sc-offline-sub   { font-size: 13px; color: var(--sc-mid); line-height: 1.5; }
.sc-offline-form  { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.sc-offline-form input, .sc-offline-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e8e8e8;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border .15s;
}
.sc-offline-form input:focus, .sc-offline-form textarea:focus { border-color: var(--sc-primary); }
.sc-offline-form textarea { min-height: 80px; resize: vertical; }

/* Powered by */
.sc-powered {
  text-align: center;
  font-size: 10px;
  color: #ccc;
  padding: 6px 0 4px;
  flex-shrink: 0;
}
.sc-powered a { color: #bbb; text-decoration: none; }
.sc-powered a:hover { color: var(--sc-mid); }

/* Misc */
.sc-divider { border: none; border-top: 1px solid #f0f0f0; margin: 8px 0; }

/* ── Branding enhancements ──────────────────────────────────────── */
.sc-widget * { font-family: var(--sc-font, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif); }
.sc-window { width: var(--sc-widget-width, 375px); }
@keyframes sc-fab-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(0,0,0,.3), 0 0 0 0 rgba(139,26,26,.5); }
  50%       { box-shadow: 0 4px 20px rgba(0,0,0,.3), 0 0 0 10px rgba(139,26,26,0); }
}
.sc-fab.sc-animate { animation: sc-fab-pulse 2.5s ease-in-out infinite; }
.sc-agent-subline { font-size: 10px; color: rgba(255,255,255,.65); margin-top: 1px; }
