:root {
  --primary-color: #5a67d8;
  --secondary-color: #4c51bf;
  --text-color: #333;
  --light-text: #718096;
  --very-light-gray: #f7fafc;
  --light-gray: #edf2f7;
  --medium-gray: #e2e8f0;
  --border-color: #e2e8f0;
  --sidebar-width: 280px;
  --header-height: 64px;
  --footer-height: 84px;
  --border-radius: 8px;
  --transition-speed: 0.3s;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-color);
  background-color: white;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

.chat-container {
  display: flex;
  height: 100vh;
  position: relative;
}

/* Chatbot container styles */
.chatbot-container {
  display: flex;
  height: 100vh;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Sidebar styles */
.sidebar {
  width: var(--sidebar-width);
  background-color: #111827;
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  color: #e0e0e0;
  flex-shrink: 0;
  z-index: 200;
}

.logo {
  padding: 16px;
  font-size: 24px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.logo i {
  color: #8282f5;
}

.new-chat-btn {
  margin: 0 16px 20px;
  padding: 10px;
  background-color: #4a4ab0;
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
}

.new-chat-btn:hover {
  background-color: #5a5ac5;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0 16px;
}

.sidebar-nav ul li {
  margin-bottom: 8px;
}

.sidebar-nav ul li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  color: #d0d0f0;
  text-decoration: none;
  transition: background-color 0.2s;
}

.sidebar-nav ul li a:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.recent-chats {
  margin-top: 24px;
  padding: 0 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.recent-chats h3 {
  font-size: 14px;
  text-transform: uppercase;
  color: #a0a0c0;
  margin-bottom: 16px;
  padding-left: 10px;
}

.recent-chats ul {
  list-style: none;
  padding: 0;
  flex-grow: 1;
}

.more-btn {
  margin-top: 16px;
  color: #a0a0c0;
  background: none;
  border: none;
  text-align: left;
  padding: 10px;
  cursor: pointer;
}

/* Chat area styles */
.chat-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background-color: #111827;
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #1e293b;
  background-color: #111827;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: #e0e0e0;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
}

.upgrade-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.upgrade-section span {
  color: #a0a0c0;
  font-size: 14px;
}

.upgrade-btn {
  padding: 6px 12px;
  background: none;
  border: 1px solid #4a4ab0;
  color: #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-btn {
  background-color: #4a4ab0;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.search-btn:hover {
  background-color: #5a5ac5;
  color: white;
}

/* Share button is now in input-action-buttons, styled there */

.user-profile img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.conversation-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0; /* Important for flex scrolling */
}

/* When conversation has messages, align content to top */
.chat-area.has-conversation .conversation-container {
    justify-content: flex-start;
}

/* Make the input area more compact when conversation is active */
.chat-area.has-conversation .chat-input-area {
    padding-top: 12px;
    padding-bottom: 8px;
}

.chat-area.has-conversation .input-wrapper {
    margin-bottom: 8px;
}

.chat-area.has-conversation .input-action-buttons {
    margin-top: 8px;
}

.chat-area.has-conversation .permanent-disclaimer {
    margin: 8px auto;
    padding: 6px 12px;
    font-size: 11px;
}

/* Hide footer and input options when conversation is active to maximize chat space */
.chat-area.has-conversation .chat-footer,
.chat-area.has-conversation .input-options {
    display: none;
}

/* Markdown Table Styles */
.message-bubble table {
  display: block;
  overflow-x: auto;
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  border-radius: 8px;
  border: 1px solid #374151;
  scrollbar-width: thin;
  scrollbar-color: #4a4ab0 rgba(31, 41, 55, 0.5);
}

.message-bubble thead {
  background-color: #111827;
}

.message-bubble th, 
.message-bubble td {
  padding: 12px 16px;
  border: 1px solid #374151;
  text-align: left;
}

.message-bubble th {
  font-weight: 600;
  color: #e0e0e0;
  background-color: rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}

.message-bubble tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.03);
}

.message-bubble tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Custom Scrollbar for tables */
.message-bubble table::-webkit-scrollbar {
  height: 8px;
}

.message-bubble table::-webkit-scrollbar-track {
  background: rgba(31, 41, 55, 0.5);
  border-radius: 4px;
}

.message-bubble table::-webkit-scrollbar-thumb {
  background: #4a4ab0;
  border-radius: 4px;
}

.message-bubble table::-webkit-scrollbar-thumb:hover {
  background: #5a5ac5;
}

.welcome-message {
  text-align: center;
  margin: auto;
  max-width: 600px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease-out;
  opacity: 1;
  transform: translateY(0);
}

.welcome-message.hidden {
  opacity: 0;
  transform: translateY(-20px);
  height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.welcome-message .bot-icon {
  font-size: 32px;
  color: #8282f5;
  margin-bottom: 16px;
}

.welcome-message h1 {
  font-size: 28px;
  color: white;
  margin-bottom: 16px;
}

.welcome-message p {
  color: #a0a0c0;
  font-size: 16px;
}

.messages-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Adjust messages container to leave space for fixed input when conversation is active
   Overrides chatbot.css absolute positioning bottom value */
.chat-area.has-conversation .messages-container {
  bottom: 160px; /* Space for fixed input area at bottom */
  padding-bottom: 20px;
}

.message {
  display: flex;
  max-width: 90%;
}

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

.ai-message {
  align-self: flex-start;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #1f2937;
  margin: 0 8px;
  flex-shrink: 0;
}

.message-content {
  background-color: #1f2937;
  padding: 12px 16px;
  border-radius: 12px;
  color: #e0e0e0;
}

.user-message .message-content {
  background-color: #4a4ab0;
}

.chat-input-area {
  padding: 16px;
  border-top: 1px solid #1e293b;
  background-color: #111827;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  /* overflow: hidden removed to allow dropdown menu to extend above */
}

/* Fix input at bottom of viewport when conversation is active */
.chat-area.has-conversation .chat-input-area {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  width: auto; /* Override width: 100% to let left/right define the width */
  z-index: 100;
}


.input-wrapper {
  display: flex;
  align-items: center;
  background-color: #1f2937;
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.input-wrapper input[type="text"] {
  flex-grow: 1;
  background: none;
  border: none;
  outline: none;
  color: #e0e0e0;
  font-size: 14px;
  padding: 8px;
}

.input-wrapper button {
  background: none;
  border: none;
  color: #a0a0c0;
  font-size: 16px;
  padding: 8px;
  cursor: pointer;
}

.send-btn {
  background-color: #4a4ab0 !important;
  color: white !important;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-btn:disabled {
  background-color: #3a3a80 !important;
  opacity: 0.6;
  cursor: not-allowed;
}

.input-options {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.input-options button {
  background-color: #1f2937;
  border: 1px solid #374151;
  color: #a0a0c0;
  padding: 8px 12px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Trending Topics Section */
.trending-topics-section {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto 20px;
  padding: 0 20px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.trending-topics-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #f97316;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.trending-topics-header i {
  color: #f97316;
  font-size: 14px;
}

.trending-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  color: #6b7280;
  font-size: 13px;
  grid-column: 1 / -1;
}

.trending-loading i {
  color: #f97316;
}

.suggestion-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding: 20px;
  max-width: 100%;
  width: 100%;
  transition: all 0.3s ease-out;
  opacity: 1;
  transform: translateY(0);
}

.trending-topics-section .suggestion-buttons {
  padding: 0;
  margin-bottom: 0;
}

.suggestion-buttons button {
  background-color: #1f2937;
  border: 1px solid #374151;
  color: #a0a0c0;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  line-height: 1.4;
  white-space: normal;
  height: auto;
  min-height: 44px;
  width: 100%;
  transition: all 0.2s ease;
}

.suggestion-buttons button:hover {
  background-color: #2d3748;
  border-color: #4a5568;
  color: #e2e8f0;
  transform: translateY(-1px);
}

.chat-footer {
  text-align: center;
  color: #a0a0c0;
  font-size: 12px;
  padding: 16px 0;
  border-top: 1px solid #1e293b;
}

.chat-footer a {
  color: #8282f5;
  text-decoration: none;
}

/* Input Action Buttons - Below input field, ChatGPT style */
.input-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 800px;
  margin: 12px auto 0;
  padding: 0;
  position: relative;
}

.input-action-buttons button {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: transparent;
  border: 1px solid #374151;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  color: #a0a0c0;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.input-action-buttons button:hover {
  background-color: #1f2937;
  border-color: #4a5568;
  color: #e2e8f0;
}

.input-action-buttons button i {
  font-size: 14px;
}

/* Response Style Button states */
.input-action-buttons .response-style-btn[data-style="citation_first"] {
  background-color: rgba(56, 189, 248, 0.1);
  border-color: #38bdf8;
  color: #38bdf8;
}

.input-action-buttons .response-style-btn[data-style="citation_first"]:hover {
  background-color: rgba(56, 189, 248, 0.2);
}

.input-action-buttons .response-style-btn[data-style="academic"] {
  background-color: rgba(139, 92, 246, 0.1);
  border-color: #8b5cf6;
  color: #8b5cf6;
}

.input-action-buttons .response-style-btn[data-style="academic"]:hover {
  background-color: rgba(139, 92, 246, 0.2);
}

.input-action-buttons .response-style-btn[data-style="devotional"] {
  background-color: rgba(236, 72, 153, 0.1);
  border-color: #ec4899;
  color: #ec4899;
}

.input-action-buttons .response-style-btn[data-style="devotional"]:hover {
  background-color: rgba(236, 72, 153, 0.2);
}

.input-action-buttons .response-style-btn[data-style="summary"] {
  background-color: rgba(34, 197, 94, 0.1);
  border-color: #22c55e;
  color: #22c55e;
}

.input-action-buttons .response-style-btn[data-style="summary"]:hover {
  background-color: rgba(34, 197, 94, 0.2);
}

/* Response Style Dropdown */
.response-style-dropdown {
  position: relative;
}

.style-dropdown-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background-color: #1a1a3a;
  border: 1px solid #2d2d5b;
  border-radius: 8px;
  min-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  padding: 8px;
}

.style-dropdown-menu.active {
  display: block;
  animation: slideUp 0.2s ease-out;
}

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

.style-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
  color: #e0e0f0;
}

.style-option:hover {
  background-color: rgba(99, 102, 241, 0.1);
}

.style-option.active {
  background-color: rgba(99, 102, 241, 0.15);
}

.style-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.2);
  border-radius: 6px;
  flex-shrink: 0;
}

.style-icon i {
  color: #6366f1;
  font-size: 16px;
}

.style-info {
  flex: 1;
  min-width: 0;
}

.style-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
  color: #fff;
}

.style-desc {
  font-size: 12px;
  color: #a0a0c0;
  line-height: 1.3;
}

.style-check {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6366f1;
  opacity: 0;
  flex-shrink: 0;
}

.style-option.active .style-check {
  opacity: 1;
}

/* Verify Button states */
.input-action-buttons .verify-position-btn[data-enabled="true"],
.input-action-buttons .verify-position-btn.active {
  background-color: rgba(251, 191, 36, 0.1);
  border-color: #fbbf24;
  color: #fbbf24;
}

.input-action-buttons .verify-position-btn[data-enabled="true"]:hover,
.input-action-buttons .verify-position-btn.active:hover {
  background-color: rgba(251, 191, 36, 0.2);
}

/* Share Button styling */
.input-action-buttons .share-btn {
  background-color: rgba(74, 74, 176, 0.1);
  border-color: #4a4ab0;
  color: #8282f5;
}

.input-action-buttons .share-btn:hover {
  background-color: rgba(74, 74, 176, 0.2);
  color: #a5a5ff;
}

/* =========================================================================
   Search Filter Dropdown
   ========================================================================= */
.search-filter-dropdown {
  position: relative;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-btn.has-filters {
  background-color: rgba(16, 185, 129, 0.1) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
}

.filter-btn.has-filters:hover {
  background-color: rgba(16, 185, 129, 0.2) !important;
}

.filter-dropdown-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background-color: #1a1a3a;
  border: 1px solid #2d2d5b;
  border-radius: 8px;
  min-width: 280px;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  padding: 0;
  overflow: hidden;
}

.filter-dropdown-menu.active {
  display: block;
  animation: slideUp 0.2s ease-out;
}

.filter-tabs {
  display: flex;
  border-bottom: 1px solid #2d2d5b;
}

.filter-tab {
  flex: 1;
  padding: 10px 8px;
  background: transparent;
  border: none;
  color: #a0a0c0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.filter-tab:hover {
  color: #e0e0f0;
  background: rgba(99, 102, 241, 0.05);
}

.filter-tab.active {
  color: #6366f1;
  border-bottom-color: #6366f1;
}

.filter-tab.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.filter-tab-content {
  display: none;
  padding: 10px 12px;
  max-height: 300px;
  overflow-y: auto;
  position: relative;
}

.filter-tab-content.active {
  display: block;
}

.filter-tab-content.disabled-tab {
  opacity: 0.3;
  pointer-events: none;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  color: #e0e0f0;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}

.filter-checkbox:hover {
  background: rgba(99, 102, 241, 0.08);
}

.filter-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #6366f1;
  cursor: pointer;
  flex-shrink: 0;
}

.filter-subgroup-title {
  font-size: 11px;
  font-weight: 600;
  color: #8282b0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 4px 4px;
  margin-top: 4px;
}

.filter-subgroup-title:first-child {
  margin-top: 0;
  padding-top: 0;
}

.filter-disabled-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 26, 58, 0.85);
  color: #a0a0c0;
  font-size: 13px;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 5;
  pointer-events: none;
}

.filter-tab-content.disabled-tab .filter-disabled-overlay,
.filter-tab-content.show-overlay .filter-disabled-overlay {
  display: flex;
}

.filter-actions {
  padding: 8px 12px;
  border-top: 1px solid #2d2d5b;
  display: flex;
  justify-content: flex-end;
}

#filter-clear-btn {
  background: transparent;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #a0a0c0;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

#filter-clear-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #ef4444;
}

.permanent-disclaimer {
  text-align: center;
  color: #ff9494;
  font-size: 13px;
  padding: 8px 16px;
  margin: 12px auto;
  background-color: rgba(255, 148, 148, 0.1);
  border-radius: 6px;
  max-width: 450px;
  line-height: 1.4;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background-color: #1f2937;
  border-radius: 12px;
  width: fit-content;
  margin-left: 52px;
  margin-bottom: 16px;
  align-self: flex-start;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background-color: #8282f5;
  border-radius: 50%;
  animation: typing-dot 1.4s infinite both;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-dot {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-6px);
  }
}

/* Responsive styles */
@media (max-width: 768px) {
  .chatbot-container {
    flex-direction: column;
  }
  
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-toggle {
    display: flex;
    margin-right: 12px;
    z-index: 10;
  }
  
  .chat-area {
    width: 100%;
    margin-left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
  }
  
  .upgrade-section span {
    display: none;
  }
  
  .chat-header {
    padding: 12px;
  }
  
  .header-actions {
    gap: 12px;
  }
  
  .chat-input-area {
    padding: 12px;
    position: relative;
    bottom: 0;
  }
  
  /* Mobile: Input fixed at bottom when conversation is active */
  .chat-area.has-conversation .chat-input-area {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto; /* Override width: 100% to let left/right define the width */
    z-index: 100;
  }
  
  /* Allow action buttons to wrap on tablet */
  .input-action-buttons {
    flex-wrap: wrap;
  }
  
  /* Adjust conversation container padding to account for fixed input */
  .chat-area.has-conversation .conversation-container {
    padding-bottom: 220px; /* Space for fixed input area */
  }
  
  .suggestion-buttons {
    grid-template-columns: repeat(2, 1fr);
    padding: 12px;
    gap: 8px;
    margin-bottom: 12px;
  }
  
  .suggestion-buttons button:nth-child(n+5) {
    display: none; /* Hide all buttons after the 4th one on tablets */
  }
  
  .input-options {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .welcome-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 90%;
    padding: 16px;
    margin: 0;
  }
  
  .welcome-message .bot-icon {
    font-size: 28px;
    margin-bottom: 12px;
  }
  
  .permanent-disclaimer {
    font-size: 12px;
    padding: 6px 12px;
    margin: 8px auto;
    max-width: 95%;
  }
  
  /* Input action buttons tablet */
  .input-action-buttons {
    justify-content: center;
  }
  
  .input-action-buttons button {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  /* Style dropdown mobile adjustments */
  .style-dropdown-menu {
    min-width: 280px;
    max-width: calc(100vw - 32px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
  
  .style-name {
    font-size: 13px;
  }
  
  .style-desc {
    font-size: 11px;
  }
  
  /* Filter dropdown mobile adjustments */
  .filter-dropdown-menu {
    min-width: 260px;
    max-width: calc(100vw - 32px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

@media (max-width: 480px) {
  .suggestion-buttons {
    grid-template-columns: repeat(3, 1fr);
    padding: 8px;
    gap: 6px;
    margin-bottom: 8px;
  }
  
  .suggestion-buttons button {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 36px;
  }

  .suggestion-buttons button:nth-child(n+4) {
    display: none; /* Hide all buttons after the 3rd one on mobile */
  }
  
  .chat-header {
    padding: 8px;
    gap: 6px;
  }
  
  .welcome-message h1 {
    font-size: 24px;
    margin-bottom: 8px;
  }
  
  .welcome-message p {
    font-size: 14px;
  }
  
  .permanent-disclaimer {
    font-size: 11px;
    padding: 6px 10px;
    margin: 6px auto;
    max-width: 100%;
  }
  
  .message {
    max-width: 95%;
  }
  
  .chat-footer {
    font-size: 10px;
    padding: 8px 0;
  }
  
  /* Mobile header responsiveness - language dropdown and buttons */
  .ui-language-switcher-container {
    flex: 1;
    min-width: 0;
    margin-left: 8px !important;
  }
  
  .ui-language-switcher-container select {
    width: 100%;
    max-width: 120px;
    font-size: 0.75em !important;
    padding: 4px 6px !important;
  }
  
  .header-actions {
    gap: 6px !important;
    flex-shrink: 0;
  }
  
  .search-btn {
    padding: 6px 8px !important;
    font-size: 12px;
  }
  
  .search-btn span {
    display: none;
  }
  
  .search-btn i {
    margin: 0;
    font-size: 14px;
  }
  
  .user-profile {
    display: none;
  }
  
  .upgrade-section {
    display: none;
  }
  
  /* Input action buttons mobile */
  .input-action-buttons {
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px auto 0;
  }
  
  .input-action-buttons button {
    padding: 6px 10px;
    font-size: 11px;
  }
  
  .input-action-buttons button span {
    display: none;
  }
  
  .input-action-buttons button i {
    font-size: 14px;
  }
  
  /* Style dropdown - ensure it fits on small screens */
  .style-dropdown-menu {
    min-width: 260px;
    max-width: calc(100vw - 24px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
  
  /* Filter dropdown - ensure it fits on small screens */
  .filter-dropdown-menu {
    min-width: 240px;
    max-width: calc(100vw - 24px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
  
  .filter-btn span {
    display: none;
  }
  
  /* Mobile small screen: Adjust fixed input bottom spacing */
  .chat-area.has-conversation .conversation-container {
    padding-bottom: 190px; /* Slightly less padding on smaller screens */
  }
}

/* Extra small screens */
@media (max-width: 360px) {
  .chat-header {
    padding: 6px;
    gap: 4px;
  }
  
  .sidebar-toggle {
    padding: 6px;
    font-size: 16px;
  }
  
  .ui-language-switcher-container select {
    max-width: 100px;
    font-size: 0.7em !important;
    padding: 3px 4px !important;
  }
  
  .search-btn,
  .share-btn {
    padding: 5px 6px !important;
  }
  
  .search-btn i,
  .share-btn i {
    font-size: 12px;
  }
  
  /* Extra small: Adjust fixed input bottom spacing */
  .chat-area.has-conversation .conversation-container {
    padding-bottom: 180px;
  }
}

/* Reference links - ensure they are clickable */
.reference-link {
  color: #6366f1;
  text-decoration: underline;
  cursor: pointer !important;
  display: inline;
  padding: 0 2px;
  font-weight: 500;
  pointer-events: auto !important;
  position: relative;
  z-index: 10;
}

.reference-link:hover {
  color: #818cf8;
  background-color: rgba(99, 102, 241, 0.1);
  border-radius: 3px;
}

/* Cite button next to references */
.cite-ref-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  background: rgba(99, 102, 241, 0.2);
  border: none;
  border-radius: 3px;
  color: #6366f1;
  font-size: 10px;
  cursor: pointer !important;
  vertical-align: middle;
  transition: all 0.2s;
  opacity: 0.7;
  pointer-events: auto !important;
  position: relative;
  z-index: 10;
}

.cite-ref-btn:hover {
  background: rgba(99, 102, 241, 0.4);
  opacity: 1;
}

/* Unverified Quote Styles - Minimal inline indicator */
.unverified-quote {
  display: inline;
  font-style: italic;
}

.unverified-quote-content {
  display: inline;
  color: #e5e7eb;
}

.unverified-quote-content p {
  display: inline;
  margin: 0;
}

/* Warning Badge - Small inline icon */
.quote-warning-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 6px;
  background: transparent;
  border: none;
  color: #f59e0b;
  font-size: 11px;
  font-style: normal;
  font-weight: 400;
  cursor: help;
  opacity: 0.8;
  vertical-align: middle;
}

.quote-warning-badge i {
  font-size: 12px;
  color: #f59e0b;
}

/* Hide the text, show only icon */
.quote-warning-badge {
  font-size: 0;
}

.quote-warning-badge i {
  font-size: 14px;
}

/* Show tooltip on hover */
.quote-warning-badge:hover {
  opacity: 1;
}

.quote-warning-badge::after {
  content: attr(title);
  display: none;
  position: absolute;
  background: #1f2937;
  color: #fbbf24;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  margin-top: 20px;
  margin-left: -50px;
  z-index: 100;
}

/* ===== PRINT STYLES ===== */
@media print {
    /* Force all text to dark colors for print */
    * {
        color: #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body {
        background: white !important;
        color: #333 !important;
    }

    /* Hide UI elements not needed for print */
    .sidebar,
    .chat-header,
    .chat-input-area,
    .source-panel,
    .share-dialog,
    .citation-modal,
    .sidebar-toggle,
    .new-chat-btn,
    .input-wrapper,
    .input-action-buttons,
    .input-options,
    .chat-footer,
    .permanent-disclaimer,
    .typing-indicator,
    .suggestion-buttons,
    .trending-topics-section,
    .welcome-message,
    .cite-ref-btn,
    .verify-ref-btn,
    .message-avatar {
        display: none !important;
    }

    /* Reset container styles for print */
    .chatbot-container,
    .chat-container {
        position: static !important;
        display: block !important;
        height: auto !important;
        overflow: visible !important;
        background: white !important;
    }

    .chat-area {
        position: static !important;
        display: block !important;
        flex: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        height: auto !important;
        overflow: visible !important;
    }

    .conversation-container {
        position: static !important;
        display: block !important;
        overflow: visible !important;
        height: auto !important;
        padding: 0 !important;
    }

    .messages-container {
        position: static !important;
        display: block !important;
        overflow: visible !important;
        height: auto !important;
        padding: 0 !important;
    }

    /* Message styling for print */
    .message {
        display: block !important;
        max-width: 100% !important;
        margin-bottom: 20px;
        page-break-inside: auto !important;
        border-bottom: 1px solid #eee;
        padding-bottom: 15px;
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }

    .message-content {
        max-width: 100% !important;
        background: none !important;
        background-color: transparent !important;
        overflow: visible !important;
        border-radius: 0 !important;
        padding: 0 !important;
        color: #333 !important;
    }

    .message-bubble {
        background: white !important;
        color: #333 !important;
        padding: 10px 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
        font-size: 11pt !important;
        line-height: 1.6 !important;
        overflow: visible !important;
        max-height: none !important;
        height: auto !important;
    }

    .message-bubble p,
    .message-bubble li,
    .message-bubble span,
    .message-bubble div,
    .message-bubble td,
    .message-bubble th,
    .message-bubble blockquote {
        color: #333 !important;
    }

    /* User message styling for print */
    .user-message {
        margin-left: 0 !important;
        align-self: stretch !important;
        flex-direction: row !important;
    }

    .user-message::before {
        content: "QUESTION:";
        font-weight: bold;
        color: #4a76a8 !important;
        display: block;
        margin-bottom: 5px;
        font-size: 10pt;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .user-message .message-bubble,
    .user-message .message-content {
        background: #f0f4f8 !important;
        color: #333 !important;
        padding: 15px !important;
        border-left: 4px solid #4a76a8 !important;
        border-right: none !important;
        border-top: none !important;
        border-bottom: none !important;
    }

    /* AI/Assistant message styling for print */
    .ai-message::before,
    .assistant-message::before {
        content: "RESPONSE:";
        font-weight: bold;
        color: #2e7d32 !important;
        display: block;
        margin-bottom: 5px;
        font-size: 10pt;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .ai-message .message-bubble,
    .assistant-message .message-bubble {
        background: white !important;
        color: #333 !important;
        border: none !important;
        border-left: 4px solid #2e7d32 !important;
        padding: 15px !important;
        box-shadow: none !important;
    }

    .ai-message .message-content,
    .assistant-message .message-content {
        background: none !important;
        color: #333 !important;
    }

    /* Blockquote styling for print - EGW quotes */
    .message-bubble blockquote {
        background: #f9f9f9 !important;
        border-left: 4px solid #6366f1 !important;
        margin: 15px 0 !important;
        padding: 15px 20px !important;
        font-style: italic !important;
        color: #333 !important;
        page-break-inside: avoid;
    }

    /* Reference links for print */
    .reference-link {
        color: #333 !important;
        background: none !important;
        text-decoration: none !important;
        font-weight: bold !important;
        padding: 0 !important;
    }

    .reference-link::after {
        content: " [" attr(data-source) "]";
        font-weight: normal;
        font-style: normal;
        color: #666 !important;
        font-size: 9pt;
    }

    /* Strong/bold text for print */
    .ai-message .message-bubble strong,
    .assistant-message .message-bubble strong {
        display: block !important;
        color: #333 !important;
        border-bottom: 1px solid #ddd !important;
        padding-bottom: 5px !important;
        margin-top: 15px !important;
        margin-bottom: 8px !important;
    }

    /* Table styling for print */
    .message-bubble table {
        border: 1px solid #ccc !important;
        background: white !important;
    }

    .message-bubble th {
        background: #f0f0f0 !important;
        color: #333 !important;
        border: 1px solid #ccc !important;
    }

    .message-bubble td {
        border: 1px solid #ccc !important;
        color: #333 !important;
        background: white !important;
    }

    .message-bubble tr:nth-child(even) {
        background: #f9f9f9 !important;
    }

    /* Print header/footer */
    .print-header {
        display: block !important;
        text-align: center;
        padding: 20px 0 30px;
        border-bottom: 2px solid #333;
        margin-bottom: 30px;
    }

    .print-header h1 {
        font-size: 24pt;
        color: #333 !important;
        margin: 0 0 5px;
    }

    .print-header .print-subtitle {
        font-size: 12pt;
        color: #666 !important;
        margin: 0 0 10px;
    }

    .print-header .print-date {
        font-size: 10pt;
        color: #888 !important;
    }

    .print-footer {
        display: block !important;
        text-align: center;
        padding: 20px 0;
        border-top: 1px solid #ddd;
        margin-top: 30px;
        font-size: 9pt;
        color: #888 !important;
    }

    /* Page break controls */
    .user-message {
        page-break-inside: avoid;
    }

    @page {
        margin: 1in;
        size: letter;
    }

    @page :first {
        margin-top: 0.5in;
    }
}

/* Hide footer and options when conversation is active on mobile */
@media (max-width: 768px) {
    /* Footer is now hidden globally when has-conversation is active, but keeping this for safety/specificity */
    .chat-area.has-conversation .chat-footer {
        display: none;
    }

    .chat-area.has-conversation .input-options {
        display: none;
    }
  
  /* Compact input area on mobile when conversation is active */
  .chat-area.has-conversation .chat-input-area {
    padding: 10px 12px;
  }
  
  .chat-area.has-conversation .permanent-disclaimer {
    font-size: 10px;
    padding: 4px 8px;
    margin: 6px auto 4px;
  }
  
  .chat-area.has-conversation .input-action-buttons {
    margin-top: 8px;
  }
} 