/* ══════════════════════════════════════════════
   Wegoo Chatbot – chat.css
   Primary brand color: #2DE3CD
   ══════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #2DE3CD;
  --brand-dark:  #1abfac;
  --brand-light: #e0faf8;
  --bg:          #f4f6f8;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --text:        #1a202c;
  --text-muted:  #718096;
  --user-bg:     #2DE3CD;
  --user-text:   #0d3330;
  --bot-bg:      #ffffff;
  --bot-text:    #1a202c;
  --radius:      18px;
  --header-h:    62px;
  --font-head:   'Syne', sans-serif;
  --font-body:   'Inter', sans-serif;
  --shadow:      0 2px 12px rgba(0,0,0,.08);
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── RTL support ── */
[dir="rtl"] .message.user  { justify-content: flex-end; } /* Left in RTL */
[dir="rtl"] .message.bot   { justify-content: flex-start; } /* Right in RTL */
[dir="rtl"] .input-bar     { direction: rtl; }
[dir="rtl"] .bubble        { text-align: right; }

/* ══════════════ HEADER ══════════════ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--brand);
  z-index: 100;
  box-shadow: 0 2px 16px rgba(45,227,205,.35);
}

.header-inner {
  max-width: 820px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.logo {
  font-family: var(--font-head);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #0d3330;
  user-select: none;
}

/* ── Language switcher ── */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,.12);
  border-radius: 24px;
  padding: 4px 10px;
}

.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-head);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: rgba(13,51,48,.65);
  padding: 3px 8px;
  border-radius: 16px;
  transition: background .18s, color .18s;
}
.lang-btn:hover  { color: #0d3330; }
.lang-btn.active {
  background: #0d3330;
  color: var(--brand);
}
.lang-sep { color: rgba(13,51,48,.35); font-size: .7rem; }

/* ══════════════ MAIN LAYOUT ══════════════ */
.chat-wrapper {
  max-width: 820px;
  margin: 0 auto;
  padding-top: calc(var(--header-h) + 20px);
  padding-bottom: 100px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.chat-container {
  flex: 1;
  padding: 0 16px;
}

/* ══════════════ MESSAGES ══════════════ */
.messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 8px;
}

.message {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  animation: fadeUp .25s ease both;
}
.message.user { justify-content: flex-start; }
.message.bot  { justify-content: flex-end; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bubble {
  max-width: 72%;
  padding: 13px 17px;
  border-radius: var(--radius);
  font-size: .95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow);
}

.message.user .bubble {
  background: var(--user-bg);
  color: var(--user-text);
  border-bottom-left-radius: 4px;
  font-weight: 500;
}
.message.bot .bubble {
  background: var(--bot-bg);
  color: var(--bot-text);
  border-bottom-right-radius: 4px;
}

/* Sources */
.sources {
  margin-top: 8px;
  font-size: .78rem;
  color: var(--text-muted);
  max-width: 72%;
  padding: 0 4px;
}
.sources a {
  color: var(--brand-dark);
  text-decoration: none;
}
.sources a:hover { text-decoration: underline; }

/* ══════════════ TYPING INDICATOR ══════════════ */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  background: var(--surface);
  border-radius: var(--radius);
  border-bottom-right-radius: 4px;
  width: fit-content;
  margin: 4px 16px 4px auto;
  box-shadow: var(--shadow);
}
.typing-indicator.hidden { display: none; }
.typing-indicator span {
  width: 8px; height: 8px;
  background: var(--brand);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: .2s; }
.typing-indicator span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .5; }
  40%            { transform: translateY(-8px); opacity: 1; }
}

/* ══════════════ INPUT BAR ══════════════ */
.input-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 820px;
  margin: 0 auto;
  /* stretch to full width */
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  border-radius: 24px;
}

.input-bar textarea {
  flex: 1;
  resize: none;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 11px 16px;
  font-family: var(--font-body);
  font-size: .95rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  line-height: 1.5;
  min-height: 46px;
  max-height: 160px;
  overflow-y: auto;
}
.input-bar textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(45,227,205,.2);
}

#send-btn {
  flex-shrink: 0;
  width: 46px; height: 46px;
  border: none;
  border-radius: 12px;
  background: var(--brand);
  color: #0d3330;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .1s;
}
#send-btn:hover  { background: var(--brand-dark); }
#send-btn:active { transform: scale(.93); }
#send-btn:disabled { opacity: .5; cursor: not-allowed; }
#send-btn svg { width: 18px; height: 18px; }

/* ══════════════ Responsive ══════════════ */
@media (max-width: 500px) {
  .bubble { max-width: 88%; }
  .logo   { font-size: 1.4rem; }
}