@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

:root {
  --bg-deep: #0a0812;
  --bg-mid: #100e1a;
  --card-bg: #13111f;
  --card-border: rgba(120, 80, 255, 0.18);
  --accent-1: #7c3aed;
  --accent-2: #a855f7;
  --accent-3: #06b6d4;
  --accent-glow: rgba(124, 58, 237, 0.35);
  --text-primary: #f0ecff;
  --text-secondary: #9d8fc9;
  --text-muted: #4e4670;
  --user-bubble: #1e1830;
  --bot-bubble: #160f2a;
  --input-bg: #0f0d1a;
  --select-bg: #110e1c;
  --scrollbar-thumb: #2d2550;
  --radius-card: 28px;
  --radius-bubble: 18px;
  --radius-input: 14px;
  --shadow-card: 0 30px 80px rgba(0,0,0,0.7), 0 0 0 1px var(--card-border);
  --shadow-glow: 0 0 40px var(--accent-glow);
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-deep);
  font-family: var(--font-body);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

/* Ambient background orbs */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}
body::before {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(124,58,237,0.22) 0%, transparent 70%);
  top: -100px;
  left: -100px;
}
body::after {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(6,182,212,0.12) 0%, transparent 70%);
  bottom: -80px;
  right: -80px;
}

/* Noise texture overlay */
body .noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}

.container {
  width: 100%;
  max-width: 480px;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* ── Card ─────────────────────────────────────── */
.chatbot-card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 32px 28px 28px;
  border: 1px solid var(--card-border);
  position: relative;
  overflow: hidden;
  animation: slideUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Top shimmer line */
.chatbot-card::before {
  content: '';
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(168,85,247,0.7), rgba(6,182,212,0.5), transparent);
  border-radius: 1px;
}

/* ── Header ───────────────────────────────────── */
h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

h1 .globe-icon {
  display: inline-flex;
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  box-shadow: 0 4px 16px rgba(124,58,237,0.4);
  flex-shrink: 0;
}

/* ── Language Selectors ───────────────────────── */
.language-selectors {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 10px;
}

.language-selectors select {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-input);
  border: 1px solid rgba(120, 80, 255, 0.2);
  background: var(--select-bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239d8fc9' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.language-selectors select:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
}

.language-selectors select option {
  background: #1a1530;
  color: var(--text-primary);
}

/* Arrow divider */
.lang-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(6,182,212,0.08));
  border: 1px solid rgba(120,80,255,0.2);
  border-radius: 8px;
  font-size: 13px;
  transition: transform 0.3s ease;
}

.lang-arrow:hover {
  transform: scaleX(1.3);
}

/* ── Chat Box ─────────────────────────────────── */
.chat-box {
  background: var(--bg-deep);
  height: 290px;
  overflow-y: auto;
  border-radius: 18px;
  padding: 18px 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(120, 80, 255, 0.12);
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

/* Scrollbar */
.chat-box::-webkit-scrollbar { width: 5px; }
.chat-box::-webkit-scrollbar-track { background: transparent; }
.chat-box::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}

/* Empty state hint */
.chat-box:empty::before {
  content: 'Select languages and type a message to begin…';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  pointer-events: none;
  padding: 20px;
  text-align: center;
}

/* ── Messages ─────────────────────────────────── */
.message {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: bubbleIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.user-message {
  align-self: flex-end;
  align-items: flex-end;
}

.bot-message {
  align-self: flex-start;
  align-items: flex-start;
}

.message-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 5px;
  opacity: 0.55;
}

.user-message .message-label { color: var(--accent-2); }
.bot-message .message-label { color: var(--accent-3); }

.message-bubble {
  padding: 11px 16px;
  border-radius: var(--radius-bubble);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 400;
  word-break: break-word;
}

.user-message .message-bubble {
  background: linear-gradient(135deg, #2a1f50, #1e1830);
  color: var(--text-primary);
  border-bottom-right-radius: 5px;
  border: 1px solid rgba(124,58,237,0.25);
}

.bot-message .message-bubble {
  background: linear-gradient(135deg, #0f1e2e, #0d1520);
  color: #cde8ff;
  border-bottom-left-radius: 5px;
  border: 1px solid rgba(6,182,212,0.2);
  box-shadow: 0 2px 12px rgba(6,182,212,0.06);
}

/* Typing dots */
.typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 18px;
}
.typing-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-3);
  animation: dotPulse 1.3s ease-in-out infinite;
  opacity: 0.5;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ── Input Area ───────────────────────────────── */
.input-area {
  display: flex;
  gap: 10px;
  align-items: center;
}

.input-area input {
  flex: 1;
  padding: 13px 16px;
  border-radius: var(--radius-input);
  border: 1px solid rgba(120, 80, 255, 0.2);
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  caret-color: var(--accent-2);
}

.input-area input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.input-area input:focus {
  border-color: rgba(124,58,237,0.55);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12), 0 0 20px rgba(124,58,237,0.08);
}

.input-area button {
  background: linear-gradient(135deg, var(--accent-1), #6d28d9);
  color: #fff;
  border: none;
  border-radius: var(--radius-input);
  padding: 13px 20px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
  white-space: nowrap;
}

.input-area button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.input-area button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(124,58,237,0.55);
}

.input-area button:hover::before { opacity: 1; }

.input-area button:active {
  transform: translateY(0px) scale(0.98);
  box-shadow: 0 2px 10px rgba(124,58,237,0.35);
}

/* ── Animations ───────────────────────────────── */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(32px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dotPulse {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 520px) {
  .chatbot-card { padding: 22px 18px 18px; }
  h1 { font-size: 1.15rem; }
  .input-area button { padding: 13px 14px; font-size: 13px; }
}
