/* Premium Chatbot UI with Glassmorphism */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&display=swap');

:root {
  --chat-primary: #0891b2;
  --chat-primary-hover: #0e7490;
  --chat-bg: rgba(255, 255, 255, 0.95);
  --chat-glass-border: rgba(8, 145, 178, 0.2);
  --chat-text: #1a2332;
  --chat-muted: #64748b;
  --chat-user-msg: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
  --chat-bot-msg: rgba(8, 145, 178, 0.08);
  --shadow-premium: 0 20px 40px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0,0,0,0.05);
}

#chat-widget-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  font-family: 'Outfit', sans-serif;
}

#chat-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--chat-user-msg);
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.4);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#chat-launcher:hover {
  transform: scale(1.1) rotate(5deg);
}

#chat-launcher svg {
  width: 30px;
  height: 30px;
  fill: none;
}

#chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 720px;
  max-height: 85vh;
  background: var(--chat-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--chat-glass-border);
  border-radius: 24px;
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

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

#chat-header {
  padding: 20px;
  background: #0a192f;
  border-bottom: 1px solid rgba(8, 145, 178, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header-info h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #ffffff;
  font-weight: 600;
}

.chat-header-info p {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 6px;
}

.voice-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(8, 145, 178, 0.15);
  color: #0891b2;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wave {
  display: inline-flex;
  gap: 2px;
  height: 12px;
  align-items: center;
}

.wave i {
  display: block;
  width: 2px;
  background: #0891b2;
  border-radius: 999px;
  animation: pulse 1s infinite ease-in-out;
}

.wave i:nth-child(1) { height: 5px; animation-delay: 0s; }
.wave i:nth-child(2) { height: 10px; animation-delay: 0.1s; }
.wave i:nth-child(3) { height: 7px; animation-delay: 0.2s; }
.wave i:nth-child(4) { height: 12px; animation-delay: 0.3s; }

@keyframes pulse {
  0%, 100% { transform: scaleY(0.65); opacity: 0.7; }
  50% { transform: scaleY(1.1); opacity: 1; }
}

.avatar-container {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.avatar-online-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #0a192f;
}

#chat-close {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.5rem;
  line-height: 1;
  transition: color 0.2s;
}

#chat-close:hover {
  color: #ffffff;
}

#chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Custom Scrollbar */
#chat-messages::-webkit-scrollbar {
  width: 6px;
}
#chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1);
  border-radius: 10px;
}

.message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.4;
  animation: messageSlideIn 0.3s ease forwards;
  opacity: 0;
  transform: translateY(10px);
}

@keyframes messageSlideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.bot {
  background: #ffffff;
  border: 1px solid rgba(8, 145, 178, 0.15);
  box-shadow: 0 8px 18px rgba(15,23,42,0.04);
  color: var(--chat-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message.user {
  background: var(--chat-user-msg);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

#chat-input-area {
  padding: 16px;
  background: rgba(255, 255, 255, 0.6);
  border-top: 1px solid rgba(0,0,0,0.05);
}

#chat-form {
  display: flex;
  gap: 10px;
  background: white;
  padding: 6px;
  border-radius: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
  border: 1px solid rgba(0,0,0,0.05);
}

#chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  color: var(--chat-text);
}

#chat-input::placeholder {
  color: var(--chat-muted);
}

#chat-submit {
  background: var(--chat-user-msg);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

#chat-submit:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

#chat-submit:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  background: var(--chat-bot-msg);
  border-radius: 16px;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--chat-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

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

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

@media (max-width: 480px) {
  #chat-window {
    width: calc(100vw - 40px);
    right: -10px;
    bottom: 70px;
  }
}

.chat-mic-btn {
  background: transparent;
  border: none;
  color: var(--chat-muted);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px;
  transition: color 0.2s, transform 0.2s;
}

.chat-mic-btn:hover {
  color: var(--chat-primary);
  transform: scale(1.05);
}

.chat-mic-btn.recording {
  color: #ef4444;
  animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Rich UI Link Cards */
.chat-link-card {
  display: flex;
  align-items: center;
  background: rgba(8, 145, 178, 0.05);
  border: 1px solid rgba(8, 145, 178, 0.4);
  border-radius: 12px;
  padding: 10px 14px;
  margin-top: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.chat-link-card:hover {
  background: rgba(8, 145, 178, 0.12);
  border-color: #0891b2;
  box-shadow: 0 6px 16px rgba(8, 145, 178, 0.2);
  transform: translateY(-2px);
}

.chat-link-card .card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(8, 145, 178, 0.1);
  color: #0891b2;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
  margin-right: 14px;
  flex-shrink: 0;
}

.chat-link-card .card-content {
  flex: 1;
}

.chat-link-card .card-content strong {
  display: block;
  font-size: 1.05rem;
  color: #1a2332;
  margin-bottom: 4px;
}

.chat-link-card .card-content span {
  display: block;
  font-size: 0.9rem;
  color: #64748b;
}

.chat-link-card .card-arrow {
  color: #0891b2;
  font-size: 1.5rem;
  margin-left: 10px;
  transition: transform 0.2s;
}

.chat-link-card:hover .card-arrow {
  transform: translateX(4px);
}

