﻿/* ========================================================
   CHATBOT V13 - OPENCORE NEURAL PARTICLE VORTEX
======================================================== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --chat-bg: rgba(8, 8, 12, 0.92);
  --chat-border: rgba(255, 255, 255, 0.06);
  --chat-bot-bg: transparent;
  --chat-user-bg: rgba(0, 194, 255, 0.08);
  --chat-accent: #00C2FF;
  --chat-text: #f4f4f5;
  --chat-sub: #a1a1aa;
  --chat-font: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --chat-mono: 'Space Mono', monospace;
}

/* ─── NEURAL TRIGGER CONTAINER ─── */
.oc-chat-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  z-index: 9999;
  cursor: pointer;
  touch-action: manipulation;
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.oc-chat-trigger:hover {
  transform: scale(1.08);
}

/* The canvas fills the trigger area */
.oc-trigger-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
}

/* Holographic scan-line overlay */
.oc-trigger-scanline {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: repeating-linear-gradient(0deg,
      transparent,
      transparent 2px,
      rgba(0, 194, 255, 0.03) 2px,
      rgba(0, 194, 255, 0.03) 4px);
  pointer-events: none;
  z-index: 3;
  mix-blend-mode: screen;
}

/* Animated border ring */
.oc-trigger-ring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  background: conic-gradient(from var(--ring-angle, 0deg), rgba(0, 194, 255, 0), rgba(0, 194, 255, 0.8), rgba(99, 102, 241, 0.6), rgba(0, 194, 255, 0)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: 4;
  animation: ring-spin 4s linear infinite;
  pointer-events: none;
}

@keyframes ring-spin {
  to {
    --ring-angle: 360deg;
  }
}

/* Fallback for browsers without @property */
@supports not (background: conic-gradient(from 0deg, red, blue)) {
  .oc-trigger-ring {
    border: 1.5px solid rgba(0, 194, 255, 0.4);
    background: none;
    -webkit-mask: none;
    mask: none;
  }
}

/* Central icon — sits on top of canvas */
.oc-chat-trigger .chat-icon,
.oc-chat-trigger .close-icon {
  position: relative;
  z-index: 5;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.6s;
}

.oc-chat-trigger .chat-icon {
  width: 28px;
  height: 28px;
  color: #fff;
}

.oc-chat-trigger.active .chat-icon {
  transform: scale(0) rotate(180deg);
  opacity: 0;
}

.oc-chat-trigger .close-icon {
  position: absolute;
  width: 24px;
  height: 24px;
  color: #fff;
  transform: scale(0) rotate(-180deg);
  opacity: 0;
}

.oc-chat-trigger.active .close-icon {
  transform: scale(1) rotate(0deg);
  opacity: 1;
}

/* ─── CHAT LABEL ─── */
.oc-chat-label {
  position: absolute;
  right: 96px;
  background: rgba(8, 8, 14, 0.88);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(0, 194, 255, 0.15);
  border-left: 2px solid rgba(0, 194, 255, 0.6);
  color: #fff;
  padding: 11px 22px 11px 18px;
  border-radius: 8px;
  font-family: var(--chat-font);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  box-shadow:
    0 0 20px rgba(0, 194, 255, 0.08),
    0 10px 40px rgba(0, 0, 0, 0.6),
    inset 0 0 30px rgba(0, 194, 255, 0.03);
  text-shadow: 0 0 12px rgba(0, 194, 255, 0.4);
  pointer-events: none;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  animation: label-glow 3s ease-in-out infinite;
}

@keyframes label-glow {

  0%,
  100% {
    border-left-color: rgba(0, 194, 255, 0.6);
    box-shadow: 0 0 20px rgba(0, 194, 255, 0.08), 0 10px 40px rgba(0, 0, 0, 0.6), inset 0 0 30px rgba(0, 194, 255, 0.03);
  }

  50% {
    border-left-color: rgba(99, 102, 241, 0.7);
    box-shadow: 0 0 25px rgba(0, 194, 255, 0.12), 0 10px 40px rgba(0, 0, 0, 0.6), inset 0 0 30px rgba(99, 102, 241, 0.04);
  }
}

/* Character-level shimmer wave */
.oc-chat-label .oc-char {
  display: inline-block;
  animation: char-shimmer 3s ease-in-out infinite;
  animation-fill-mode: both;
}

@keyframes char-shimmer {

  0%,
  100% {
    color: rgba(255, 255, 255, 0.7);
    text-shadow: none;
  }

  15% {
    color: #fff;
    text-shadow: 0 0 6px rgba(0, 194, 255, 0.6);
  }

  30% {
    color: rgba(255, 255, 255, 0.7);
    text-shadow: none;
  }
}

.oc-chat-label::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -6px;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: rgba(0, 194, 255, 0.6);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 194, 255, 0.5);
  animation: label-dot-pulse 2s ease-in-out infinite;
}

@keyframes label-dot-pulse {

  0%,
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }

  50% {
    opacity: 0.5;
    transform: translateY(-50%) scale(0.6);
  }
}

.oc-chat-trigger:hover .oc-chat-label {
  border-left-color: rgba(0, 194, 255, 0.9);
  text-shadow: 0 0 18px rgba(0, 194, 255, 0.6);
}

.oc-chat-trigger.active .oc-chat-label {
  opacity: 0;
  transform: translateX(10px);
}

@media (max-width: 768px) {
  .oc-chat-label {
    display: none;
  }
}

/* --- CHAT WINDOW --- */
.oc-chat-window {
  position: fixed;
  bottom: 115px;
  right: 30px;
  width: 420px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 180px);

  /* Igloo core aesthetic */
  background: var(--chat-bg);
  backdrop-filter: blur(16px) saturate(180%) brightness(0.8);
  -webkit-backdrop-filter: blur(16px) saturate(180%) brightness(0.8);
  border: 1px solid var(--chat-border);
  box-shadow: inset 0 0 80px rgba(0, 194, 255, 0.05), 0 30px 60px rgba(0, 0, 0, 0.9);
  border-radius: 12px;

  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--chat-font);
  opacity: 0;
  transform: translateY(30px) scale(0.98);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s;
  transform-origin: bottom right;
  will-change: transform, opacity;
}

.oc-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

/* --- HEADER --- */
.oc-chat-header {
  padding: 24px 24px 16px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.oc-chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.oc-chat-avatar svg {
  width: 100%;
  height: 100%;
}

.oc-chat-title h4 {
  margin: 0;
  font-family: var(--chat-font);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.oc-chat-title span {
  font-family: var(--chat-mono);
  font-size: 0.72rem;
  color: var(--chat-sub);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.oc-chat-title span::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #10b981;
  /* Emerald green online status */
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

/* --- BODY (MESSAGES) --- */
.oc-chat-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.oc-chat-body::-webkit-scrollbar {
  width: 4px;
}

.oc-chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.oc-chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.oc-msg {
  max-width: 88%;
  padding: 14px 18px;
  font-family: var(--chat-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  letter-spacing: -0.02em;
  border-radius: 8px;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(15px);
}

.oc-msg.bot {
  align-self: flex-start;
  background: transparent;
  color: var(--chat-text);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 2px solid var(--chat-accent);
  position: relative;
  padding-right: 36px;
  /* Make room for the play button */
}

.oc-msg-play-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--chat-sub);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.oc-msg-play-btn:hover {
  background: rgba(0, 194, 255, 0.1);
  color: var(--chat-accent);
}

.oc-msg.user {
  align-self: flex-end;
  background: var(--chat-user-bg);
  color: #fff;
  border: 1px solid rgba(0, 194, 255, 0.2);
  box-shadow: 0 4px 20px rgba(0, 194, 255, 0.05);
}

/* --- QUICK REPLY BUTTONS --- */
.oc-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}

.oc-qr {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--chat-sub);
  padding: 8px 16px;
  border-radius: 6px;
  font-family: var(--chat-mono);
  font-size: 0.74rem;
  font-weight: 400;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.oc-qr:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
}

@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- TYPING INDICATOR --- */
.oc-typing {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  align-items: center;
  height: 24px;
}

.oc-dot {
  width: 5px;
  height: 5px;
  background: var(--chat-accent);
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}

.oc-dot:nth-child(1) {
  animation-delay: 0s;
}

.oc-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.oc-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {

  0%,
  80%,
  100% {
    opacity: 0.2;
    transform: scale(0.8);
  }

  40% {
    opacity: 1;
    transform: scale(1.2);
    box-shadow: 0 0 8px var(--chat-accent);
  }
}

.oc-chat-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  background: transparent;
  display: flex;
  gap: 8px;
  align-items: center;
}

.oc-chat-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0;
  padding: 10px 0;
  color: #fff;
  font-family: var(--chat-font);
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.4s;
}

.oc-chat-input:focus {
  border-color: var(--chat-accent);
  box-shadow: 0 1px 0 var(--chat-accent);
}

.oc-chat-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.oc-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.oc-chat-send:hover {
  background: #fff;
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

.oc-chat-send svg {
  width: 16px;
  height: 16px;
}

/* --- MOBILE SPECIFIC --- */
@media (max-width: 768px) {
  .oc-chat-trigger {
    bottom: 230px;
    right: 18px;
    width: 52px;
    height: 46px;
  }

  .oc-chat-trigger svg {
    width: 22px;
    height: 22px;
  }

  .oc-chat-window {
    top: auto;
    bottom: 0px;
    right: 0px;
    width: 100vw;
    height: 85vh;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    border-left: none;
    border-right: none;
  }
}

/* ═══════════════════════════════════════════════════════════
   V4 VOICE UI STYLES
   Microphone button, mode selector, animations
═══════════════════════════════════════════════════════════ */

/* --- VOICE BUTTON --- */
/* --- VOICE BUTTON (footer) --- */
.oc-voice-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(0, 194, 255, 0.25);
  color: var(--chat-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s, border-color 0.3s, color 0.3s;
  flex-shrink: 0;
}

.oc-voice-btn svg {
  width: 20px;
  height: 20px;
}

.oc-voice-btn:hover {
  background: rgba(0, 194, 255, 0.12);
  border-color: var(--chat-accent);
  transform: scale(1.08);
  box-shadow: 0 0 18px rgba(0, 194, 255, 0.25);
}

/* Active (voice mode on) */
.oc-voice-btn.active {
  background: rgba(0, 194, 255, 0.15);
  border-color: var(--chat-accent);
  box-shadow: 0 0 12px rgba(0, 194, 255, 0.3);
}

/* Listening state (pulsing red) */
.oc-voice-btn.listening {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
  animation: voicePulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

/* Speaking state (pulsing blue) */
.oc-voice-btn.speaking {
  background: rgba(0, 194, 255, 0.2);
  border-color: var(--chat-accent);
  color: var(--chat-accent);
  animation: speakPulse 0.8s ease-in-out infinite alternate;
  box-shadow: 0 0 25px rgba(0, 194, 255, 0.5);
}

@keyframes voicePulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
  }

  50% {
    transform: scale(1.12);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.6);
  }
}

@keyframes speakPulse {
  from {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(0, 194, 255, 0.3);
  }

  to {
    transform: scale(1.08);
    box-shadow: 0 0 30px rgba(0, 194, 255, 0.5);
  }
}

/* --- MOBILE VOICE --- */
@media (max-width: 768px) {
  .oc-voice-btn {
    width: 34px;
    height: 34px;
  }

  .oc-voice-btn svg {
    width: 16px;
    height: 16px;
  }
}