/* 
  Voxcor Chat Widget 
  Premium Design - Glassmorphism & Modern Aesthetics
*/

:root {
  --chat-primary: #1d61f2;
  --chat-primary-dark: #1546b3;
  --chat-bg: var(--vox-glass-bg);
  --chat-glass: rgba(255, 255, 255, 0.05);
  --chat-glass-border: var(--vox-glass-border);
  --chat-text: #ffffff;
  --chat-text-muted: rgba(255, 255, 255, 0.5);
  --chat-user-msg: var(--chat-primary);
  --chat-ai-msg: rgba(255, 255, 255, 0.04);
  --font-header: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --chat-shadow: var(--vox-glass-shadow);
}

/* --- Floating Action Button --- */
.vox-chat-bubble {
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: 64px;
  height: 64px;
  border-radius: 50%; /* Back to circle for site DA consistency */
  background: var(--vox-glass-bg);
  backdrop-filter: var(--vox-glass-blur);
  -webkit-backdrop-filter: var(--vox-glass-blur);
  border: var(--vox-glass-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 
              0 0 0 1px rgba(255, 255, 255, 0.05),
              inset 0 1px 1px rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  animation: voxBubbleFloat 4s ease-in-out infinite;
}

@keyframes voxBubbleFloat {
  0%, 100% { transform: translateY(0); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4); }
  50% { transform: translateY(-10px); box-shadow: 0 30px 70px rgba(29, 97, 242, 0.2); }
}

.vox-chat-bubble:hover {
  transform: scale(1.05) translateY(-5px) rotate(5deg);
  border-color: var(--chat-primary);
  background: rgba(29, 97, 242, 0.1);
  box-shadow: 0 0 30px var(--accent-glow);
}

.vox-chat-bubble svg {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.vox-chat-bubble:hover svg {
  transform: scale(1.1) rotate(-5deg);
}

/* --- Chat Window --- */
.vox-chat-window {
  position: fixed;
  bottom: 120px;
  right: 40px;
  width: 400px;
  height: 600px;
  background: var(--chat-bg);
  backdrop-filter: var(--vox-glass-blur);
  -webkit-backdrop-filter: var(--vox-glass-blur);
  border: var(--chat-glass-border);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--chat-shadow);
  z-index: 10001;
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-body);
}

.vox-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.vox-chat-header {
  padding: 24px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.05), transparent);
  border-bottom: 1px solid var(--chat-glass-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.vox-chat-header .vox-status {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 12px #10b981;
  animation: voxStatusPulse 2s infinite;
}

@keyframes voxStatusPulse {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 8px #10b981; }
  50% { transform: scale(1.2); opacity: 0.8; box-shadow: 0 0 16px #10b981; }
  100% { transform: scale(1); opacity: 1; box-shadow: 0 0 8px #10b981; }
}

.vox-chat-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--chat-text);
  font-family: var(--font-header);
  letter-spacing: -0.01em;
}

.vox-chat-header p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--chat-text-muted);
  font-weight: 500;
}

/* Messages Area */
.vox-chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
.vox-chat-messages::-webkit-scrollbar {
  width: 5px;
}
.vox-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.vox-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.vox-msg {
  max-width: 85%;
  padding: 14px 20px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.6;
  animation: voxFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.vox-msg.user {
  align-self: flex-end;
  background: var(--chat-primary);
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 8px 25px rgba(29, 97, 242, 0.25);
}

.vox-msg.ai {
  align-self: flex-start;
  background: var(--chat-ai-msg);
  color: var(--chat-text);
  border-bottom-left-radius: 6px;
  border: 1px solid var(--chat-glass-border);
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.02);
}

/* Input Area */
.vox-chat-input-container {
  padding: 28px 24px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--chat-glass-border);
  display: flex;
  gap: 12px;
}

.vox-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
  color: white;
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
}

.vox-chat-input:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--chat-primary);
  box-shadow: 0 0 0 3px rgba(29, 97, 242, 0.15);
}

.vox-chat-send {
  background: var(--chat-primary);
  border: none;
  border-radius: 12px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.vox-chat-send:hover {
  background: var(--chat-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--accent-glow);
}

.vox-chat-send svg {
  width: 20px;
  height: 20px;
  fill: white;
  transition: transform 0.3s ease;
}

.vox-chat-send:hover svg {
  transform: scale(1.1) rotate(-10deg);
}

/* Typing Indicator */
.vox-typing {
  align-self: flex-start;
  background: var(--chat-ai-msg);
  border: 1px solid var(--chat-glass-border);
  padding: 12px 16px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  display: none;
  margin-left: 20px;
  margin-bottom: 20px;
}

.vox-typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 14px;
}

.vox-typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--chat-text-muted);
  border-radius: 50%;
  display: inline-block;
  animation: voxTyping 1.4s infinite ease-in-out both;
}

.vox-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.vox-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes voxTyping {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* --- Header Close Button --- */
.vox-chat-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.vox-chat-close:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
  transform: rotate(90deg);
}

.vox-chat-close svg {
  width: 20px;
  height: 20px;
}

/* --- Responsive Adaptations --- */
@media (max-width: 768px) {
  .vox-chat-bubble {
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
  }
  
  .vox-chat-window {
    width: 100%;
    height: 100%;
    max-height: none;
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    border-radius: 0;
  }

  .vox-chat-input {
    font-size: 16px; /* Prevents auto-zoom on iOS */
  }

  .vox-chat-bubble:hover {
    transform: scale(1.02) translateY(-2px);
  }

  .vox-chat-header {
    padding: 32px 32px; /* Increased horizontal padding */
    padding-top: calc(env(safe-area-inset-top, 0px) + 60px); /* Additive top space */
  }

  .vox-chat-messages {
    padding: 32px 28px; /* More space on sides for messages */
  }

  .vox-chat-input-container {
    padding: 32px 24px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 40px); /* Additive bottom space */
  }
}

/* Scroll Lock on Mobile */
@media (max-width: 768px) {
  body.vox-chat-active {
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: fixed;
  }
}

@media (max-height: 600px) {
  .vox-chat-window {
    height: calc(100% - 20px);
    bottom: 10px;
  }
}
