/* Spark SEO Chatbot Widget */

:root {
  --spark-blue: #457B9D;
  --spark-blue-dark: #3a6a88;
  --spark-teal: #2A9D8F;
  --spark-teal-dark: #238377;
  --spark-yellow: #F1C40F;
  --spark-red: #FF3333;
  --spark-navy: #001028;
  --spark-bg: #FEFEFF;
  --spark-surface: #f3f4f6;
  --spark-text: #374151;
  --spark-text-light: #6b7280;
  --spark-border: #e5e7eb;
  --spark-bubble-user: #457B9D;
  --spark-bubble-bot: #f3f4f6;
  --spark-shadow: 0 4px 24px rgba(0, 16, 40, 0.18);
}

#spark-chatbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px !important;
  height: 60px !important;
  border-radius: 50% !important;
  background: var(--spark-teal) !important;
  border: none !important;
  cursor: pointer;
  padding: 0 !important;
  box-shadow: var(--spark-shadow);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  overflow: visible;
  font-size: inherit !important;
  line-height: 1 !important;
}


/* Orbiting light ring — subtle "we're live" signal */
#spark-chatbot-toggle::before {
  content: '';
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.5);
  animation: spark-orbit 3s linear infinite, spark-ring-fade 3s ease-in-out infinite;
  pointer-events: none;
}

#spark-chatbot-toggle::after {
  content: '';
  position: absolute;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1px solid transparent;
  border-bottom-color: rgba(255, 255, 255, 0.25);
  animation: spark-orbit 4.5s linear infinite reverse, spark-ring-fade 3s ease-in-out infinite 1.5s;
  pointer-events: none;
}

/* Stop animation when chat is open */
#spark-chatbot-toggle.spark-chat-active::before,
#spark-chatbot-toggle.spark-chat-active::after {
  animation: none;
  border-color: transparent;
}

@keyframes spark-orbit {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spark-ring-fade {
  0%, 100% { border-top-color: rgba(255, 255, 255, 0.5); border-bottom-color: rgba(255, 255, 255, 0.25); }
  50% { border-top-color: rgba(255, 255, 255, 0.15); border-bottom-color: rgba(255, 255, 255, 0.08); }
}

#spark-chatbot-toggle:hover {
  transform: scale(1.08);
  background: var(--spark-teal-dark);
}

#spark-chatbot-toggle svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

#spark-chatbot-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  top: 16px;
  max-height: none;
  background: var(--spark-bg);
  border-radius: 16px;
  box-shadow: var(--spark-shadow);
  z-index: 99999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--spark-text);
}

#spark-chatbot-panel.spark-open {
  display: flex;
}

/* Header */
.spark-chat-header {
  background: linear-gradient(90deg, #2A9D8F 0%, #2A9D8F 70%, #F1C40F 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

/* Breathing yellow glow in header */
.spark-chat-header::after {
  content: '';
  position: absolute;
  top: -20%;
  right: -15%;
  bottom: -20%;
  width: 65%;
  background: radial-gradient(ellipse at 65% 50%, rgba(241, 196, 15, 0.55) 0%, transparent 75%);
  animation: spark-header-breathe 3.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes spark-header-breathe {
  0%, 100% { opacity: 0.2; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.08); }
}

.spark-chat-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spark-chat-header-title .spark-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}

.spark-chat-header-title .spark-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

.spark-avatar .spark-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #2A9D8F;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.6);
}

.spark-chat-header-info h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.spark-chat-header-info p {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.spark-chat-close {
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  color: #fff;
  cursor: pointer;
  padding: 4px !important;
  font-size: 20px !important;
  line-height: 1 !important;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.spark-chat-close:hover {
  opacity: 1;
}

/* Messages */
.spark-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.spark-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.45;
  word-wrap: break-word;
}

.spark-msg-bot {
  background: var(--spark-bubble-bot);
  color: var(--spark-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.spark-msg-user {
  background: var(--spark-bubble-user);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.spark-msg p {
  margin: 0 0 6px;
}

.spark-msg p:last-child {
  margin-bottom: 0;
}

.spark-msg strong {
  font-weight: 600;
}

.spark-msg ul,
.spark-msg ol {
  margin: 4px 0;
  padding-left: 18px;
}

.spark-msg li {
  margin-bottom: 2px;
}

/* Typing indicator */
.spark-typing {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  align-self: flex-start;
  background: var(--spark-bubble-bot);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.spark-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--spark-text-light);
  animation: spark-bounce 1.4s ease-in-out infinite;
}

.spark-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.spark-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes spark-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Input */
.spark-chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--spark-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

#spark-chat-input {
  flex: 1;
  border: 1px solid var(--spark-border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
  transition: border-color 0.15s;
}

#spark-chat-input:focus {
  border-color: var(--spark-teal);
}

#spark-chat-send {
  width: 38px !important;
  height: 38px !important;
  border-radius: 50% !important;
  background: var(--spark-teal) !important;
  border: none !important;
  cursor: pointer;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  font-size: inherit !important;
  line-height: 1 !important;
}

#spark-chat-send:hover {
  background: var(--spark-teal-dark);
}

#spark-chat-send:disabled {
  background: var(--spark-border);
  cursor: not-allowed;
}

#spark-chat-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Powered by */
.spark-chat-footer {
  text-align: center;
  padding: 6px;
  font-size: 11px;
  color: var(--spark-text-light);
  border-top: 1px solid var(--spark-border);
  flex-shrink: 0;
}

.spark-chat-footer a {
  color: var(--spark-teal);
  text-decoration: none;
}

/* Header logo */
.spark-chat-header-logo {
  height: 28px;
  width: auto;
}

/* Mobile responsive */
@media (max-width: 480px) {
  #spark-chatbot-panel {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 90px;
    top: 8px;
    max-height: none;
    border-radius: 12px;
  }
}
