/* ===========================================
   Sahan AI Assistant — chat surface for the /assistant/ page
   =========================================== */

*, *::before, *::after { box-sizing: border-box; }
body.sahan-ai-assistant-page h1,
body.sahan-ai-assistant-page h2,
body.sahan-ai-assistant-page p { margin: 0; }

:root {
  --bg-primary: #020B14;
  --bg-secondary: #051525;
  --bg-card: rgba(0, 40, 58, 0.6);
  --accent: #00B67A;
  --accent-light: #00D68F;
  --accent-glow: rgba(0, 182, 122, 0.15);
  --text-primary: #f0f0f0;
  --text-secondary: #8DA4B8;
  --border: rgba(0, 182, 122, 0.12);
}

/* Standalone full-viewport surface — no theme header or footer. */
body.sahan-ai-assistant-page {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Animated background wash */
.sai-bg-gradient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0, 182, 122, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0, 120, 190, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 85%, rgba(0, 182, 122, 0.04) 0%, transparent 50%);
  animation: sai-bg-shift 15s ease-in-out infinite alternate;
}

@keyframes sai-bg-shift {
  0%   { opacity: 0.6; }
  50%  { opacity: 1; }
  100% { opacity: 0.7; }
}

.sai-shell {
  position: relative;          /* anchors the voice orb overlay */
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;              /* avoids the mobile URL-bar jump */
  max-width: 900px;
  margin: 0 auto;
  overflow: hidden;
}

.sai-shell h2,
.sai-shell p,
.sai-shell button,
.sai-shell textarea { margin: 0; font-family: inherit; }


/* Header */
.sai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.sai-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sai-header-left .sai-logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  overflow: hidden;
  box-shadow: 0 4px 15px var(--accent-glow);
}

/* Assistant avatar image (header, welcome screen and bot messages) */
.sai-logo img,
.sai-welcome-icon img,
.sai-message.bot .sai-avatar img,
.sai-typing-indicator .sai-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  box-sizing: border-box;
  display: block;
}

.sai-welcome-icon img { padding: 10px; }

.sai-header-left h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #fff, #b0d4c8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sai-header-titles { display: flex; flex-direction: column; gap: 2px; }

.sai-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent-light);
}

.sai-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-light);
  box-shadow: 0 0 8px var(--accent-light);
}

.sai-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sai-hbtn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: color .2s ease, background .2s ease;
}

.sai-hbtn:hover {
  color: var(--accent-light);
  background: rgba(0, 182, 122, 0.12);
}

.sai-hbtn svg { width: 17px; height: 17px; fill: currentColor; display: block; }

#sai-tts-btn .off-icon { display: none; }
#sai-tts-btn.muted { color: #5d7185; }
#sai-tts-btn.muted .on-icon { display: none; }
#sai-tts-btn.muted .off-icon { display: block; }

.sai-header-right a {
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sai-header-right a:hover {
  color: var(--accent-light);
  border-color: var(--accent);
  background: var(--accent-glow);
}

/* Chat Messages Area */
.sai-chat-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

.sai-chat-area::-webkit-scrollbar { width: 5px; }
.sai-chat-area::-webkit-scrollbar-track { background: transparent; }
.sai-chat-area::-webkit-scrollbar-thumb {
  background: rgba(0, 182, 122, 0.2);
  border-radius: 5px;
}

/* Welcome Screen */
.sai-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 24px;
  animation: sai-fade-up 0.6s ease both;
  text-align: center;
  padding: 40px 20px;
}

.sai-welcome-icon {
  width: 80px;
  height: 80px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  box-shadow: 0 8px 40px var(--accent-glow);
  animation: sai-float 4s ease-in-out infinite;
}

.sai-welcome h2 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff, #90c8b4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sai-welcome p {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 400px;
  line-height: 1.6;
}

/* Quick Action Buttons */
.sai-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 500px;
}

.sai-quick-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sai-quick-btn:hover {
  border-color: var(--accent);
  background: rgba(0, 182, 122, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.sai-quick-btn .icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* Message Bubbles */
.sai-message {
  display: flex;
  gap: 12px;
  animation: sai-fade-up 0.35s ease both;
  max-width: 80%;
}

.sai-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.sai-message .sai-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  overflow: hidden;
}

.sai-message.bot .sai-avatar {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  box-shadow: 0 2px 10px var(--accent-glow);
}

.sai-message.user .sai-avatar {
  background: rgba(100, 120, 140, 0.3);
}

.sai-message .sai-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.65;
  word-wrap: break-word;
}

.sai-message.bot .sai-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-top-left-radius: 6px;
}

.sai-message.user .sai-bubble {
  background: linear-gradient(135deg, #00B67A, #00A06C);
  color: white;
  border-top-right-radius: 6px;
}

.sai-message.bot .sai-bubble p { margin: 0 0 10px 0; }
.sai-message.bot .sai-bubble p:last-child { margin-bottom: 0; }
.sai-message.bot .sai-bubble a { color: var(--accent-light); }
.sai-message.bot .sai-bubble code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 13px;
}
.sai-message.bot .sai-bubble strong { color: #fff; }

/* Typing Indicator */
.sai-typing-indicator {
  display: flex;
  gap: 12px;
  animation: sai-fade-up 0.3s ease both;
}

.sai-typing-indicator .sai-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sai-typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  border-top-left-radius: 6px;
}

.sai-typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: sai-dot-bounce 1.4s ease-in-out infinite;
}
.sai-typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.sai-typing-dots span:nth-child(3) { animation-delay: 0.32s; }

/* Input Area */
.sai-input-area {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.sai-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px 12px;
  transition: border-color 0.3s;
}

.sai-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.sai-input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 24px;
  max-height: 120px;
  padding: 8px 4px;
  line-height: 1.5;
}

.sai-input-wrapper textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.sai-input-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.sai-send-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
}
.sai-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 15px var(--accent-glow);
}
.sai-send-btn svg { width: 20px; height: 20px; fill: white; }

.sai-voice-btn {
  background: var(--bg-card);
  color: var(--accent-light);
  border: 1px solid var(--border) !important;
}
.sai-voice-btn:hover { background: rgba(0, 60, 80, 0.5); }
.sai-voice-btn.recording {
  background: rgba(255, 50, 50, 0.15);
  border-color: rgba(255, 50, 50, 0.4) !important;
  animation: sai-pulse 1.5s ease-in-out infinite;
}
.sai-voice-btn svg { width: 18px; height: 18px; fill: currentColor; }

.sai-clear-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border) !important;
}
.sai-clear-btn:hover { color: #ff6b6b; border-color: rgba(255, 107, 107, 0.3) !important; }
.sai-clear-btn svg { width: 16px; height: 16px; fill: currentColor; }

.sai-input-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 8px;
  opacity: 0.6;
}

/* Social bar */
.sai-socials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 0 0;
}

.sai-socials a {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: color 0.2s, transform 0.2s;
  text-decoration: none;
}
.sai-socials a:hover {
  color: var(--accent-light);
  transform: scale(1.2);
}

/* Inline brand marks — sized here since there is no icon font. */
.sai-socials svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  display: block;
}

/* Animations */
@keyframes sai-fade-up {
  0% { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes sai-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes sai-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

@keyframes sai-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 50, 50, 0.3); }
  50% { box-shadow: 0 0 0 10px rgba(255, 50, 50, 0); }
}

/* Responsive */
@media (max-width: 640px) {
  .sai-shell { max-width: 100%; }
  .sai-header { padding: 12px 16px; }
  .sai-chat-area { padding: 16px; }
  .sai-input-area { padding: 12px 16px 16px; }
  .sai-quick-actions { grid-template-columns: 1fr; }
  .sai-welcome h2 { font-size: 22px; }
  .sai-message { max-width: 90%; }
}
