body {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  transition: background 0.3s ease;
}

.theme-dark {
  background: #fff;
  color: #020f26;

  --answer-bg: #f1f5f9;
  --answer-color: #1e293b;
}

.theme-light {
  background: #0f172a;
  color: #f1f5f9;

  --answer-bg: #1e293b;
  --answer-color: #f1f5f9;
}

a {
  text-decoration: none;
}

.theme-dark a {
  color: #2563eb;
}

.theme-light a {
  color: #60a5fa;
}

#vexoo-launcher {
  position: fixed;
  bottom: 24px;
  right: 115px;
  width: 100px;
  height: 80px;
  background: #031028;
  border-radius: 16px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: pulse 1.5s ease-in-out 1;
  transition: all 0.3s ease;
}

#vexoo-launcher:hover {
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.8);
}

#vexoo-launcher img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(59, 130, 246, 0.4);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(59, 130, 246, 0.4);
  }
}

#chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: 400px;
  width: 80%;
  height: 80vh;

  /* max-height: calc(100vh - 100px); */
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
  display: none;
  flex-direction: column;
  background: var(--widget-bg);
  z-index: 1000;
  overflow: hidden;
}

#chat-widget.maximized {
  width: 100vw;
  height: 100vh;
  bottom: 0;
  right: 0;
  border-radius: 0;
}

.theme-dark #chat-widget {
  --widget-bg: #fff;
}

.theme-light #chat-widget {
  --widget-bg: #0f172a;
}

#splash-inside {
  position: absolute;
  inset: 0;
  background-color: inherit;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

#splash-inside img {
  max-width: 90%;
  max-height: 90%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 20px;
}

#widget-ui {
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 11;
}

#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 8px;
  background: inherit;
}

#logo {
  height: 56px;
}

#header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#header-actions button {
  background: none;
  border: none;
  font-size: 16px;
  color: inherit;
  cursor: pointer;
}

#chat-box {
  flex: 1;
  padding: 10px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
  max-height: calc(100vh - 250px);
}

#chat-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: hidden;
  width: 100%;
}

#loader {
  text-align: center;
  margin: 10px 0;
}

#input-area {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: inherit;
}

#input-area input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 999px;
  border: 2px solid #3b82f6;
  background: white;
  color: black;
}

#input-area button {
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid #3b82f6;
  background-color: #3b82f6;
  color: white;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    0 4px 12px rgba(59, 130, 246, 0.3),
    0 0 0 1px rgba(59, 130, 246, 0.1);
  backdrop-filter: blur(8px);
  transition: all 0.25s ease;
}

.user-msg {
  align-self: flex-end;
  background: #1d4ed8;
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
}

.ai-msg {
  line-height: 1.1 !important;
  align-self: flex-start;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--answer-bg);
  color: var(--answer-color);
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  overflow: hidden;
}

.theme-light .ai-msg {
  background: #e2e8f0;
  color: #1e293b;
}

.ai-msg .answer-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.ai-msg .answer-logo img {
  height: 18px;
  width: auto;
}

#footer {
  text-align: center;
  font-size: 11px;
  padding: 6px 12px;
  background: inherit;
  color: inherit;
}

/* Answer theme fix */

/* Hide all scrollbars inside AI messages */

/* .ai-msg *::-webkit-scrollbar {
display: none !important;
} */

.ai-msg * {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.1 !important;
}

/* Forced dark theme for widget content */

/* Hard override of all widget children inside dark theme context */
.theme-dark #chat-widget,
.theme-dark #chat-widget *,
.theme-dark #chat-widget input,
.theme-dark #chat-widget button,
.theme-dark #chat-widget #widget-ui,
.theme-dark #chat-widget #input-area input,
.theme-dark #chat-widget #footer {
  background-color: #020f26 !important;
  color: #fff !important;
  border-color: transparent;
  font-size: 14px;
  font-family: monospace;
}

.theme-dark #chat-widget #input-area input {
  background-color: #1e293b !important;
  color: #fff !important;
  width: 100%;
}

.theme-dark #chat-widget .ai-msg {
  color: #fff !important;
  margin-bottom: 40px;
  display: inline-block;
}

.theme-dark #chat-widget .user-msg {
  background-color: #737578 !important;
  color: #fff !important;
}

/* Light theme full propagation fix */

/* Ensure light mode colors propagate to all relevant widget UI elements */
.theme-light #chat-widget,
.theme-light #chat-widget *,
.theme-light #chat-widget #widget-ui,
.theme-light #chat-widget input,
.theme-light #chat-widget button,
.theme-light #chat-widget #input-area input,
.theme-light #chat-widget #footer {
  background-color: #fff !important;
  color: #0f172a !important;
  border-color: #cbd5e1;
}

.theme-light #chat-widget #input-area input {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

.theme-light #chat-widget .ai-msg {
  color: #1e293b !important;
}

.theme-light #chat-widget .user-msg {
  background-color: #737578 !important;
  color: #fff !important;
}

/* Send button hover + styling fix */

#input-area button:hover {
  background-color: #2563eb;
  border-color: #2563eb;
  box-shadow:
    0 6px 16px rgba(37, 99, 235, 0.4),
    0 0 0 1px rgba(37, 99, 235, 0.2);
  transform: translateY(-1px);
}

.answer-logo .answer-text {
  font-weight: bold;
  font-size: 13px;
  margin-left: 6px;
}

.theme-dark .answer-logo .answer-text {
  color: #fff;
}

.theme-light .answer-logo .answer-text {
  color: #000;
}

.stream-typing {
  line-height: 1.2;
  white-space: pre-wrap !important;
  font-family: monospace;
  font-size: 14px;
  max-width: 100% !important;
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
  overflow-x: hidden !important;
  box-sizing: border-box;
}

/* Prevent horizontal scroll entirely */
body,
html {
  overflow-x: hidden;
}

/* Chat content scrollbar fixes */
#chat-box::-webkit-scrollbar {
  width: 6px;
}

.theme-dark #chat-box::-webkit-scrollbar-thumb {
  background-color: rgba(246, 246, 246, 0.947);
  border-radius: 6px;
}

.theme-light #chat-box::-webkit-scrollbar-thumb {
  background-color: rgba(246, 246, 246, 0.947);
  border-radius: 6px;
}

#chat-box::-webkit-scrollbar-track {
  background: transparent;
}

/* === ENHANCED FEATURES STYLES === */

/* Role Selection Screen */
#role-selection {
  position: absolute;
  inset: 0;
  background-color: inherit;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 12;
  padding: 20px;
}

#role-selection h2 {
  margin-bottom: 25px;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  color: inherit;
}

.role-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  width: 100%;
  max-width: 320px;
}

.role-btn {
  padding: 18px 22px;
  border: 2px solid #3b82f6;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
}

.role-btn:hover {
  background: #3b82f6;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
  border-color: #2563eb;
}

.role-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
}

/* Questions Section */
#questions-container {
  padding: 12px;
  background: inherit;
  border-top: 2px solid #3b82f6;
  position: relative;
  border-radius: 8px 8px 0 0;
  margin: 0 2px;
}

.theme-light #questions-container {
  border-top: 2px solid #3b82f6;
}

.theme-dark #questions-container {
  border-top: 2px solid #3b82f6;
}

#questions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

#questions-title {
  font-size: 13px;
  font-weight: bold;
  opacity: 0.9;
  color: #3b82f6;
}

#questions-actions {
  display: flex;
  gap: 8px;
}

.questions-action-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  padding: 4px;
  border-radius: 4px;
}

.questions-action-btn:hover {
  opacity: 1;
  background: rgba(59, 130, 246, 0.1);
}

#questions-scroll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 8px;
}

/* Exact match to your sleek chat scrollbar */
#questions-scroll::-webkit-scrollbar {
  width: 6px;
}

#questions-scroll::-webkit-scrollbar-thumb {
  background-color: #475569;
  border-radius: 6px;
  border: none;
}

#questions-scroll::-webkit-scrollbar-track {
  background: transparent;
  border: none;
}

#questions-scroll::-webkit-scrollbar-corner {
  background: transparent;
}

.question-item {
  flex: 0 0 auto;
  max-width: 100%;
  padding: 12px 16px;
  background: #3b82f6;
  color: white;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 20px;
  border: 1px solid transparent;
}

.question-item:hover {
  background: #2563eb;
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  border-color: #1d4ed8;
}

.question-item .copy-icon {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.question-item:hover .copy-icon {
  opacity: 1;
}

/* Minimized Questions Button */
#questions-minimized {
  position: absolute;
  bottom: 85px;
  left: 20px;
  width: 45px;
  height: 35px;
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border: 2px solid #3b82f6;
  border-radius: 10px;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 12px rgba(59, 130, 246, 0.3),
    0 0 0 1px rgba(59, 130, 246, 0.1);
  z-index: 15;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
  margin-bottom: 10px;
}

#questions-minimized:hover {
  background: #3b82f6;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
  border-color: #2563eb;
}

#questions-minimized:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
}

#questions-container.minimized {
  display: none !important;
}

/* === CHAT ANSWER HORIZONTAL SCROLL FIXES === */

.ai-msg pre {
  white-space: pre-wrap !important;
  overflow-x: auto;
  max-width: 100%;
  background: rgba(0, 0, 0, 0.1);
  padding: 8px;
  border-radius: 4px;
  margin: 8px 0;
}

.ai-msg code {
  word-break: break-all;
  white-space: pre-wrap;
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 4px;
  border-radius: 3px;
}

/* Final ultra-compact markdown formatting */

.ai-msg h1,
.ai-msg h2,
.ai-msg h3,
.ai-msg h4,
.ai-msg h5,
.ai-msg h6 {
  font-weight: bold !important;
  display: inline !important;
  margin: 0 !important;
}

.ai-msg h1::after,
.ai-msg h2::after,
.ai-msg h3::after,
.ai-msg h4::after,
.ai-msg h5::after,
.ai-msg h6::after {
  content: '\A';
  white-space: pre;
}

.ai-msg p {
  display: inline !important;
  margin: 0 !important;
}

.ai-msg p::after,
.ai-msg li::after {
  content: '';
}

.ai-msg ul,
.ai-msg ol {
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.ai-msg li {
  display: inline !important;
  margin: 0 !important;
}

.ai-msg li::before {
  content: '• ';
}

.ai-msg strong {
  font-weight: bold !important;
}

.ai-msg em {
  font-style: italic !important;
}

.ai-msg br {
  display: none !important;
}

/* Additional ultra-compact fixes */
.ai-msg p + p {
  margin-top: 0 !important;
}

.ai-msg h1 + p,
.ai-msg h2 + p,
.ai-msg h3 + p,
.ai-msg h4 + p,
.ai-msg h5 + p,
.ai-msg h6 + p {
  margin-top: 0 !important;
}

.ai-msg ul + p,
.ai-msg ol + p,
.ai-msg p + ul,
.ai-msg p + ol {
  margin-top: 0 !important;
}

.ai-msg div {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.1 !important;
}

.ai-msg > *:first-child {
  margin-top: 0 !important;
}

.ai-msg > *:last-child {
  margin-bottom: 0 !important;
}

/* Target specific markdown spacing issue */
.ai-msg p:not(:first-child) {
  display: inline !important;
}
