/* ============================================================
   Strike Sense — AI Trading Assistant Chat Widget Styles
   Electric Dark Theme | Glassmorphism | Mobile Optimized
   ============================================================ */

/* ── Chat Trigger Button ── */
.ss-ai-chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d4ff, #7c3aed);
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 30px rgba(0, 212, 255, 0.4), 0 0 20px rgba(124, 58, 237, 0.35);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  cursor: pointer;
  z-index: 9999;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
}

.ss-ai-chat-trigger:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 36px rgba(0, 212, 255, 0.6), 0 0 30px rgba(124, 58, 237, 0.5);
}

.ss-ai-chat-trigger .ai-pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(0, 212, 255, 0.5);
  animation: ai-pulse 2s infinite ease-out;
  pointer-events: none;
}

@keyframes ai-pulse {
  0% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.35); opacity: 0; }
}

.ss-ai-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #00ff88;
  color: #050510;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 9999px;
  box-shadow: 0 0 10px #00ff88;
  text-transform: uppercase;
}

/* ── Chat Container Window ── */
.ss-ai-chat-window {
  position: fixed;
  bottom: 94px;
  right: 24px;
  width: 380px;
  height: 540px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  background: linear-gradient(155deg, rgba(18, 18, 42, 0.95), rgba(8, 8, 22, 0.98));
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 212, 255, 0.15);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ss-ai-chat-window.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* ── Header ── */
.ai-chat-header {
  padding: 1rem 1.2rem;
  background: linear-gradient(90deg, rgba(18, 18, 48, 0.9), rgba(12, 12, 32, 0.9));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-avatar-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d4ff, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.1rem;
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.4);
}

.ai-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #00ff88;
  border: 2px solid #0a0a1a;
  border-radius: 50%;
  box-shadow: 0 0 6px #00ff88;
}

.ai-header-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.ai-header-sub {
  font-size: 0.72rem;
  color: rgba(240, 244, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-hdr-btn {
  background: rgba(255, 255, 255, 0.07);
  border: none;
  color: rgba(240, 244, 255, 0.7);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.ai-hdr-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

/* ── Chat Messages Body ── */
.ai-chat-body {
  flex: 1;
  padding: 1.2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.ai-chat-body::-webkit-scrollbar {
  width: 5px;
}

.ai-chat-body::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.2);
  border-radius: 10px;
}

/* Message Bubbles */
.ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  font-size: 0.86rem;
  line-height: 1.5;
  animation: msg-appear 0.25s ease-out;
}

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

.ai-msg.bot {
  align-self: flex-start;
}

.ai-msg.user {
  align-self: flex-end;
}

.ai-msg-bubble {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  position: relative;
  word-wrap: break-word;
}

.ai-msg.bot .ai-msg-bubble {
  background: rgba(25, 25, 55, 0.75);
  border: 1px solid rgba(0, 212, 255, 0.2);
  color: #f0f4ff;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.ai-msg.user .ai-msg-bubble {
  background: linear-gradient(135deg, #00d4ff, #7c3aed);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 18px rgba(0, 212, 255, 0.35);
  font-weight: 500;
}

.ai-msg-time {
  font-size: 0.65rem;
  color: rgba(240, 244, 255, 0.4);
  margin-top: 4px;
  align-self: flex-end;
}

.ai-msg.bot .ai-msg-time {
  align-self: flex-start;
}

/* Action button inside bot message */
.ai-msg-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(0, 212, 255, 0.15);
  border: 1px solid rgba(0, 212, 255, 0.4);
  color: #00d4ff;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.ai-msg-action-btn:hover {
  background: #00d4ff;
  color: #050510;
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

/* ── Quick Prompt Chips Container ── */
.ai-quick-chips-wrap {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-quick-chip-btn {
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.25);
  color: #d1f4ff;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}

.ai-quick-chip-btn:hover {
  background: rgba(0, 212, 255, 0.2);
  border-color: #00d4ff;
  color: #ffffff;
  transform: translateX(3px);
}

/* ── Typing Indicator ── */
.ai-typing-indicator {
  display: none;
  align-self: flex-start;
  background: rgba(25, 25, 55, 0.75);
  border: 1px solid rgba(0, 212, 255, 0.2);
  padding: 10px 14px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  gap: 4px;
  align-items: center;
}

.ai-typing-indicator.active {
  display: inline-flex;
}

.ai-typing-dot {
  width: 6px;
  height: 6px;
  background: #00d4ff;
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite ease-in-out;
}

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

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

/* ── Input Footer ── */
.ai-chat-footer {
  padding: 0.8rem 1rem;
  background: rgba(12, 12, 30, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-chat-input {
  flex: 1;
  background: rgba(25, 25, 55, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 9px 14px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: all 0.25s ease;
}

.ai-chat-input:focus {
  border-color: #00d4ff;
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
  background: rgba(30, 30, 65, 0.9);
}

.ai-chat-input::placeholder {
  color: rgba(240, 244, 255, 0.4);
}

.ai-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d4ff, #7c3aed);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.ai-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

/* ── Mobile Viewport Adaptations ── */
@media (max-width: 540px) {
  .ss-ai-chat-window {
    right: 12px;
    left: 12px;
    bottom: 84px;
    width: auto;
    max-width: none;
    height: 75vh;
    border-radius: 18px;
  }

  .ss-ai-chat-trigger {
    bottom: 18px;
    right: 18px;
    width: 52px;
    height: 52px;
    font-size: 1.25rem;
  }
}
