/* =============================================
   RSS AI — Chatbot Styles
   RSS World Network LTD
   Theme: Dark (default) + Light via data-theme
============================================= */

/* ---------- CSS Custom Properties ---------- */
.rss-chatbot-widget {
  --cb-bg: #0D1117;
  --cb-surface: #1C2128;
  --cb-header-bg: #0B1D3A;
  --cb-msg-bot-bg: #1C2128;
  --cb-msg-user-bg: #FF7A00;
  --cb-input-bg: #161B22;
  --cb-input-border: rgba(255,255,255,0.1);
  --cb-border: rgba(255,255,255,0.08);
  --cb-text: #CDD9E5;
  --cb-text-heading: #E6EDF3;
  --cb-text-muted: #768390;
  --cb-accent: #FF7A00;
  --cb-accent-hover: #E06800;
  --cb-accent-dim: rgba(255,122,0,0.12);
  --cb-shadow: 0 24px 64px rgba(0,0,0,0.55), 0 4px 16px rgba(0,0,0,0.3);
  --cb-font: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --cb-font-head: 'Syne', 'Segoe UI', system-ui, sans-serif;
  --cb-radius: 16px;
  --cb-msg-radius-bot: 4px 16px 16px 16px;
  --cb-msg-radius-user: 16px 4px 16px 16px;
}

/* ---------- Widget Container ---------- */
.rss-chatbot-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 960;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--cb-font);
}

/* ---------- Launcher Button ---------- */
.rss-cb-launcher {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #0B1D3A;
  border: 2.5px solid var(--cb-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(255,122,0,0.38), 0 2px 8px rgba(0,0,0,0.4);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  position: relative;
  color: #fff;
  font-size: 20px;
  z-index: 961;
  flex-shrink: 0;
  overflow: hidden;
}

.rss-cb-launcher:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 32px rgba(255,122,0,0.6), 0 2px 10px rgba(0,0,0,0.4);
  border-color: #FF9530;
}

.rss-cb-launcher:active { transform: scale(0.95); }

  background: #fff;
  box-shadow: 0 4px 24px rgba(255,122,0,0.3), 0 2px 8px rgba(0,0,0,0.12);
}

/* Logo image inside launcher */
img.rss-cb-launcher-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 50%;
  position: absolute;
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

.rss-cb-launcher-close {
  position: absolute;
  opacity: 0;
  transform: scale(0.6) rotate(-45deg);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  line-height: 1;
  color: #fff;
}


.rss-chatbot-widget.open img.rss-cb-launcher-icon {
  opacity: 0;
  transform: scale(0.5) rotate(45deg);
}

.rss-chatbot-widget.open .rss-cb-launcher-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* Notification dot */
.rss-cb-notif {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #E74C3C;
  border: 2px solid #fff;
  animation: rss-notif-pulse 2s infinite;
  transition: opacity 0.2s;
}

.rss-chatbot-widget.open .rss-cb-notif,
.rss-chatbot-widget.notif-seen .rss-cb-notif {
  opacity: 0;
  pointer-events: none;
}

@keyframes rss-notif-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

/* ---------- Chat Panel ---------- */
.rss-cb-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 380px;
  max-height: 580px;
  background: var(--cb-bg);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  border: 1px solid var(--cb-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  transform-origin: bottom right;
}

.rss-chatbot-widget.open .rss-cb-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ---------- Header ---------- */
.rss-cb-header {
  background: var(--cb-header-bg);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.rss-cb-agent {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rss-cb-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(255,122,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
}

.rss-cb-avatar-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.rss-cb-agent-info { display: flex; flex-direction: column; gap: 3px; }

.rss-cb-agent-name {
  color: #fff;
  font-family: var(--cb-font-head);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1;
}

.rss-cb-agent-status {
  color: rgba(255,255,255,0.55);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
}

.rss-cb-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2ECC71;
  display: inline-block;
  animation: rss-status-blink 2.5s infinite;
}

@keyframes rss-status-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.rss-cb-header-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.rss-cb-header-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

/* ---------- Messages Area ---------- */
.rss-cb-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,122,0,0.2) transparent;
}

.rss-cb-messages::-webkit-scrollbar { width: 3px; }
.rss-cb-messages::-webkit-scrollbar-track { background: transparent; }
.rss-cb-messages::-webkit-scrollbar-thumb {
  background: rgba(255,122,0,0.2);
  border-radius: 2px;
}

/* ---------- Message Rows ---------- */
.rss-cb-msg {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  max-width: 90%;
  animation: rss-msg-in 0.22s ease;
}

@keyframes rss-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rss-cb-msg.bot { align-self: flex-start; }
.rss-cb-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.rss-cb-msg-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF7A00, #C85A00);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  flex-shrink: 0;
}

.rss-cb-msg.user .rss-cb-msg-icon {
  background: var(--cb-accent-dim);
  color: var(--cb-accent);
}

/* ---------- Bubbles ---------- */
.rss-cb-bubble {
  padding: 10px 14px;
  border-radius: var(--cb-msg-radius-bot);
  background: var(--cb-msg-bot-bg);
  color: var(--cb-text);
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 100%;
  word-break: break-word;
  border: 1px solid var(--cb-border);
}

.rss-cb-msg.user .rss-cb-bubble {
  background: var(--cb-msg-user-bg);
  color: #fff;
  border-radius: var(--cb-msg-radius-user);
  border-color: transparent;
}

.rss-cb-bubble strong { color: var(--cb-text-heading); font-weight: 600; }
.rss-cb-msg.user .rss-cb-bubble strong { color: #fff; }

/* ---------- CTA Button Group ---------- */
.rss-cb-cta-group {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: min(300px, 88%);
  animation: rss-msg-in 0.25s ease 0.08s both;
}

.rss-cb-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--cb-font);
  text-decoration: none;
  transition: filter 0.15s, transform 0.15s;
  line-height: 1;
  width: 100%;
  background: var(--cb-accent);
  color: #fff;
}

.rss-cb-cta-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.rss-cb-cta-btn:active { filter: brightness(0.95); transform: translateY(0); }

.rss-cb-cta-btn.outline {
  background: transparent;
  color: var(--cb-accent);
  border: 1.5px solid var(--cb-accent);
}

.rss-cb-cta-btn.outline:hover {
  background: var(--cb-accent);
  color: #fff;
}

/* ---------- Typing Indicator ---------- */
.rss-cb-typing {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  align-self: flex-start;
  animation: rss-msg-in 0.2s ease;
}

.rss-cb-typing-bubble {
  padding: 12px 14px;
  border-radius: var(--cb-msg-radius-bot);
  background: var(--cb-msg-bot-bg);
  border: 1px solid var(--cb-border);
  display: flex;
  gap: 5px;
  align-items: center;
}

.rss-cb-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cb-text-muted);
  animation: rss-typing-bounce 1.3s infinite;
}

.rss-cb-typing-dot:nth-child(2) { animation-delay: 0.18s; }
.rss-cb-typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes rss-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ---------- Quick Replies ---------- */
.rss-cb-quick-replies {
  padding: 10px 12px 12px;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  border-top: 1px solid var(--cb-border);
  flex-shrink: 0;
  background: var(--cb-bg);
}

.rss-cb-quick-replies:empty {
  display: none;
  padding: 0;
  border-top: none;
}

.rss-cb-chip {
  padding: 6px 13px;
  border-radius: 20px;
  border: 1.5px solid var(--cb-accent);
  background: var(--cb-accent-dim);
  color: var(--cb-accent);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--cb-font);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}

.rss-cb-chip:hover {
  background: var(--cb-accent);
  color: #fff;
}

/* ---------- Input Area ---------- */
.rss-cb-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-top: 1px solid var(--cb-border);
  background: var(--cb-bg);
  flex-shrink: 0;
}

.rss-cb-input {
  flex: 1;
  background: var(--cb-input-bg);
  border: 1.5px solid var(--cb-input-border);
  border-radius: 10px;
  padding: 9px 13px;
  color: var(--cb-text);
  font-size: 13.5px;
  font-family: var(--cb-font);
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

.rss-cb-input::placeholder { color: var(--cb-text-muted); }
.rss-cb-input:focus { border-color: rgba(255,122,0,0.45); }

.rss-cb-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--cb-accent);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: filter 0.15s, transform 0.15s;
}

.rss-cb-send:hover { filter: brightness(1.1); transform: scale(1.05); }
.rss-cb-send:active { transform: scale(0.94); }
.rss-cb-send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ---------- Branding Footer ---------- */
.rss-cb-footer {
  text-align: center;
  padding: 5px 0 8px;
  font-size: 10.5px;
  color: var(--cb-text-muted);
  letter-spacing: 0.02em;
  flex-shrink: 0;
  background: var(--cb-bg);
}

.rss-cb-footer span { opacity: 0.6; }

/* ---------- Mobile Responsive ---------- */
@media (max-width: 480px) {
  .rss-chatbot-widget {
    bottom: 16px;
    right: 14px;
  }

  .rss-cb-panel {
    width: calc(100vw - 28px);
    max-height: calc(100dvh - 96px);
    right: 0;
    bottom: 66px;
  }

  .rss-cb-launcher {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .rss-cb-cta-group {
    width: 92%;
  }
}

@media (max-width: 360px) {
  .rss-cb-panel { width: calc(100vw - 20px); }
}

/* ---------- Online Attention Label ---------- */
.rss-cb-online-label {
  position: absolute;
  bottom: 12px;
  right: 70px;
  background: #0B1D3A;
  color: #fff;
  padding: 9px 15px 9px 12px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--cb-font);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateX(10px);
  pointer-events: none;
  transition: opacity 0.38s cubic-bezier(0.16,1,0.3,1), transform 0.38s cubic-bezier(0.16,1,0.3,1);
  border: 1px solid rgba(255,122,0,0.25);
  box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 1px 4px rgba(0,0,0,0.2);
  user-select: none;
}

/* Small arrow pointing right toward the launcher */
.rss-cb-online-label::after {
  content: '';
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent #0B1D3A;
}

.rss-cb-online-label.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.rss-cb-online-label.dismissed {
  opacity: 0 !important;
  transform: translateX(10px) !important;
  pointer-events: none !important;
  transition: opacity 0.3s ease, transform 0.3s ease !important;
}

/* Hide label when panel is open */
.rss-chatbot-widget.open .rss-cb-online-label {
  opacity: 0;
  pointer-events: none;
}

/* Pulsing green status dot inside label */
.rss-cb-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ECC71;
  flex-shrink: 0;
  position: relative;
}

.rss-cb-online-dot::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(46,204,113,0.35);
  animation: rss-online-ripple 1.8s ease-out infinite;
}

@keyframes rss-online-ripple {
  0%   { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Light theme label */
  background: #0B1D3A;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18), 0 1px 4px rgba(0,0,0,0.1);
}

/* Mobile: label above instead of beside */
@media (max-width: 480px) {
  .rss-cb-online-label {
    bottom: 66px;
    right: 0;
    transform: translateY(8px);
    border-radius: 12px;
  }

  .rss-cb-online-label::after {
    display: none;
  }

  .rss-cb-online-label.visible {
    transform: translateY(0);
  }

  .rss-cb-online-label.dismissed {
    transform: translateY(8px) !important;
  }

  img.rss-cb-launcher-icon {
    width: 34px;
    height: 34px;
  }
}

/* ── Lead capture form ── */
.rss-cb-lead-form {
  margin: 0 12px 4px;
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  border-radius: 12px;
  padding: 14px;
}

.rss-cb-lead-form-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rss-cb-lead-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rss-cb-lead-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--cb-input-bg);
  border: 1px solid var(--cb-input-border);
  border-radius: 8px;
  color: var(--cb-text);
  font-family: var(--cb-font);
  font-size: 0.78rem;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.2s;
}

.rss-cb-lead-input:focus {
  border-color: var(--cb-accent);
}

.rss-cb-lead-input::placeholder {
  color: var(--cb-text-muted);
  font-size: 0.75rem;
}

.rss-cb-lead-err {
  font-size: 0.75rem;
  color: #e74c3c;
  background: rgba(231,76,60,0.08);
  border: 1px solid rgba(231,76,60,0.2);
  border-radius: 6px;
  padding: 6px 9px;
}

.rss-cb-lead-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--cb-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--cb-font);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.rss-cb-lead-submit:hover { background: var(--cb-accent-hover); }
.rss-cb-lead-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.rss-cb-lead-success {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--cb-text);
}

.rss-cb-lead-success i {
  font-size: 1.4rem;
  color: #2ecc71;
  flex-shrink: 0;
}

/* Light theme overrides for lead form */
  background: #f8f9fa;
  border-color: rgba(0,0,0,0.09);
}

/* Stack rows on very narrow widths */
@media (max-width: 380px) {
  .rss-cb-lead-row {
    grid-template-columns: 1fr;
  }
}
