﻿/* Apna Samastipur – AI Search & Conversation Styles */

:root {
  --ai-primary: #6366f1;
  --ai-primary-hover: #4f46e5;
  --ai-primary-light: #eef2ff;
  --ai-primary-border: #c7d2fe;
  --ai-accent: #f59e0b;
  --ai-accent-light: #fffbeb;
  --ai-dark: #0f172a;
  --ai-dark-card: #1e293b;
  --ai-text-main: #1e293b;
  --ai-text-muted: #64748b;
  --ai-bg-soft: #f8fafc;
  --ai-bubble-user: #4f46e5;
  --ai-bubble-assistant: #ffffff;
  --ai-border: #e2e8f0;
  --ai-shadow: 0 12px 36px -4px rgba(15, 23, 42, 0.16), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
}

/* ==========================================================================
   Floating Launcher Trigger Button
   ========================================================================== */
.ai-talk-launcher {
  position: fixed;
  bottom: 84px;
  right: 22px;
  z-index: 998;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 50%, #7c3aed 100%);
  color: #ffffff;
  padding: 10px 18px 10px 12px;
  border-radius: 9999px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 10px 25px -3px rgba(79, 70, 229, 0.4), 0 4px 10px -2px rgba(79, 70, 229, 0.3);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-talk-launcher:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 32px -4px rgba(79, 70, 229, 0.5);
  color: #ffffff;
}

.ai-launcher-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.ai-launcher-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
  animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.ai-launcher-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.ai-launcher-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
}

.ai-launcher-sub {
  font-size: 10.5px;
  opacity: 0.85;
  font-weight: 500;
}

/* ==========================================================================
   Popup Modal Dialog
   ========================================================================== */
.ai-popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.ai-popup-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.ai-popup-window {
  width: 440px;
  max-width: calc(100vw - 32px);
  height: 640px;
  max-height: calc(100vh - 40px);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: var(--ai-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.8);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-popup-backdrop.open .ai-popup-window {
  transform: translateY(0) scale(1);
}

/* Header */
.ai-popup-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #312e81 100%);
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-popup-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-popup-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5, #9333ea);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.ai-popup-brand-text h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-popup-brand-text p {
  margin: 2px 0 0;
  font-size: 11px;
  color: #cbd5e1;
}

.ai-popup-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-icon-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.ai-icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Model Selector Bar */
.ai-model-pills {
  background: #f1f5f9;
  padding: 8px 12px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--ai-border);
}

.ai-model-pill {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
  white-space: nowrap;
}

.ai-model-pill:hover {
  border-color: #94a3b8;
  color: #1e293b;
}

.ai-model-pill.active {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.ai-model-badge-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.25);
  text-transform: uppercase;
}

.ai-model-pill:not(.active) .ai-model-badge-tag {
  background: #e2e8f0;
  color: #475569;
}

/* Audio Dialogue Visualizer */
.ai-voice-bar {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  padding: 10px 14px;
  border-bottom: 1px solid var(--ai-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-voice-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.ai-voice-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}

.ai-wave-bar {
  width: 3px;
  height: 4px;
  background: #6366f1;
  border-radius: 2px;
  transition: height 0.15s ease;
}

.ai-voice-active .ai-wave-bar:nth-child(1) { animation: wave 0.8s infinite ease-in-out; }
.ai-voice-active .ai-wave-bar:nth-child(2) { animation: wave 0.8s infinite ease-in-out 0.15s; }
.ai-voice-active .ai-wave-bar:nth-child(3) { animation: wave 0.8s infinite ease-in-out 0.3s; }
.ai-voice-active .ai-wave-bar:nth-child(4) { animation: wave 0.8s infinite ease-in-out 0.45s; }
.ai-voice-active .ai-wave-bar:nth-child(5) { animation: wave 0.8s infinite ease-in-out 0.2s; }

@keyframes wave {
  0%, 100% { height: 4px; }
  50% { height: 18px; background: #ec4899; }
}

.ai-voice-toggle-btn {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #4f46e5;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.ai-voice-toggle-btn:hover {
  background: #4f46e5;
  color: #ffffff;
}

.ai-voice-toggle-btn.recording {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Chat Messages Scroll Container */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
  scrollbar-width: thin;
}

.ai-msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
  animation: ai-msg-fade 0.2s ease-out;
}

@keyframes ai-msg-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-msg.assistant {
  align-self: flex-start;
}

.ai-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.ai-msg.user .ai-msg-avatar {
  background: #4f46e5;
  color: #ffffff;
}

.ai-msg.assistant .ai-msg-avatar {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #ffffff;
}

.ai-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.ai-msg.user .ai-msg-bubble {
  background: var(--ai-bubble-user);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.ai-msg.assistant .ai-msg-bubble {
  background: var(--ai-bubble-assistant);
  color: var(--ai-text-main);
  border: 1px solid var(--ai-border);
  border-bottom-left-radius: 2px;
}

.ai-msg-bubble p {
  margin: 0 0 8px;
}

.ai-msg-bubble p:last-child {
  margin-bottom: 0;
}

.ai-msg-bubble strong {
  color: inherit;
  font-weight: 700;
}

.ai-msg-bubble a {
  color: #4f46e5;
  text-decoration: underline;
  font-weight: 600;
}

.ai-msg.user .ai-msg-bubble a {
  color: #ffffff;
}

.ai-msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--ai-text-muted);
}

.ai-voice-play-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 10.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.ai-voice-play-btn:hover {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
}

/* Grounding Cards in Chat */
.ai-grounding-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.ai-grounded-item-card {
  display: block;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  text-decoration: none;
  transition: all 0.2s;
}

.ai-grounded-item-card:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  transform: translateX(2px);
}

.ai-grounded-item-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-grounded-item-tag {
  font-size: 9.5px;
  font-weight: 600;
  background: #e0e7ff;
  color: #4338ca;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.ai-grounded-item-sub {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

/* Quick Suggestion Chips */
.ai-suggestions-tray {
  padding: 8px 14px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ai-chip {
  flex: 0 0 auto;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.ai-chip:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4f46e5;
}

/* Input Bar */
.ai-popup-footer {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid var(--ai-border);
}

.ai-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 24px;
  padding: 4px 6px 4px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-input-wrapper:focus-within {
  border-color: #6366f1;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.ai-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: #1e293b;
  font-family: inherit;
  padding: 6px 0;
}

.ai-chat-input::placeholder {
  color: #94a3b8;
}

.ai-mic-btn {
  background: transparent;
  border: none;
  color: #64748b;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ai-mic-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.ai-mic-btn.active {
  background: #fee2e2;
  color: #dc2626;
  animation: pulse-red 1.5s infinite;
}

.ai-send-btn {
  background: #4f46e5;
  border: none;
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ai-send-btn:hover:not(:disabled) {
  background: #4338ca;
  transform: scale(1.04);
}

.ai-send-btn:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}

/* ==========================================================================
   Full Public Page (/ask-ai) Styles
   ========================================================================== */
.ai-page-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.ai-page-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #312e81 100%);
  border-radius: 24px;
  padding: 36px 32px;
  color: #ffffff;
  margin-bottom: 24px;
  box-shadow: var(--ai-shadow);
  position: relative;
  overflow: hidden;
}

.ai-hero-shapes {
  position: absolute;
  top: -50px;
  right: -50px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, rgba(99, 102, 241, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.ai-page-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.ai-page-hero h1 {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 8px;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.ai-page-hero p {
  font-size: 15px;
  color: #cbd5e1;
  margin: 0;
  max-width: 650px;
  line-height: 1.5;
}

.ai-page-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.ai-model-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.ai-model-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.ai-model-card.active {
  background: rgba(99, 102, 241, 0.28);
  border-color: #818cf8;
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.5);
}

.ai-model-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ai-model-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-model-card-badge {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 6px;
}

.ai-model-card p {
  font-size: 11.5px;
  color: #cbd5e1;
  margin: 0;
  line-height: 1.4;
}

/* Page Layout (Main + Sidebar) */
.ai-page-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.ai-page-chat-card {
  background: #ffffff;
  border: 1px solid var(--ai-border);
  border-radius: 20px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  height: 700px;
  overflow: hidden;
}

.ai-page-chat-card .ai-chat-messages {
  padding: 24px;
}

/* Sidebar */
.ai-page-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ai-sidebar-widget {
  background: #ffffff;
  border: 1px solid var(--ai-border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

.ai-sidebar-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-new-chat-btn {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #4f46e5;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-new-chat-btn:hover {
  background: #4f46e5;
  color: #ffffff;
}

.ai-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.ai-history-item {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-history-item:hover {
  background: #eef2ff;
  color: #4f46e5;
  border-color: #c7d2fe;
}

.ai-places-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-place-tag {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-place-tag:hover {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
}

/* Live Translate Container */
.ai-translate-panel {
  display: none;
  background: #ffffff;
  border: 1px solid var(--ai-border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.ai-translate-panel.open {
  display: block;
}

.ai-translate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ai-lang-select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
  color: #1e293b;
  outline: none;
}

/* Loading Dots */
.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
}

.ai-typing-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing 1.2s infinite ease-in-out;
}

.ai-typing-dot:nth-child(1) { animation-delay: 0s; }
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; background: #6366f1; }
}

/* Responsive */
@media (max-width: 900px) {
  .ai-page-layout {
    grid-template-columns: 1fr;
  }
  .ai-page-sidebar {
    order: 2;
  }
  .ai-popup-window {
    width: 100%;
    height: 82vh;
    max-height: 82vh;
  }
  .ai-popup-backdrop {
    padding: 0;
  }
  .ai-popup-window {
    border-radius: 20px 20px 0 0;
  }
  .ai-talk-launcher {
    bottom: 74px;
    right: 14px;
    padding: 8px 14px 8px 10px;
  }
}

