/* CHANGE: Switched to a more modern, professional font */
body { 
  font-family: 'Inter', 'Source Sans Pro', sans-serif; 
  /* CHANGE: Increased base font size for mobile */
  font-size: 18px; 
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* CHANGE: Media query to adjust font size on larger screens */
@media (min-width: 768px) {
  body {
    font-size: 17px;
  }
}

/* REMOVED overflow: hidden to allow the page to scroll */
html, body { 
  height: 100%;
  max-width: 100%; 
}

#app-container { 
  max-width: 100%; 
}

/* --- NEW: Hide scrollbar visuals on mobile only --- */
@media (max-width: 767px) {
  .custom-scrollbar::-webkit-scrollbar {
    display: none; /* For Chrome, Safari, and Opera */
  }
  .custom-scrollbar {
    -ms-overflow-style: none;  /* For IE and Edge */
    scrollbar-width: none;  /* For Firefox */
  }
}

#message-input::-webkit-scrollbar {
    display: none;
}
#message-input {
    -ms-overflow-style: none;
    scrollbar-width: none;
}


/* --- NEW: Text-first chat styles from mockup --- */
:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6b7280;
  --hint: #4b5563;
  --accent: #16a34a;

  --user-bg: #e5e7eb;
  --user-fg: #1f2937;
  --ai-fg: #111827;
}

.dark {
  --bg: #000000;
  --fg: #f5f5f5;
  --muted: #9ca3af;
  --hint: #d1d5db;
  --accent: #22c55e;

  --user-bg: #166534;
  --user-fg: #f0fdf4;
  --ai-fg: #f3f4f6;
}

.message-container {
    width: min(72ch, 100%);
    margin-inline: auto;
}

.message.user {
  background: var(--user-bg);
  color: var(--user-fg);
  padding: 14px 16px;
  border-radius: 12px;
}

.message.ai {
  color: var(--ai-fg);
}

.message .chat-bubble {
    padding: 0;
    border: none;
    background: transparent !important;
    box-shadow: none;
}

.meta {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: baseline;
}

.why-btn {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.why-btn:hover {
  opacity: 0.8;
}

.stamp {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
/* --- End of new chat styles --- */


/* --- IMPROVEMENT: Enhanced Chat Bubble Typography --- */
.chat-bubble { 
  line-height: 1.7; 
}

.chat-bubble h1, .chat-bubble h2, .chat-bubble h3 { 
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.6em;
  line-height: 1.3;
}
.chat-bubble h1 { font-size: 1.25rem; border-bottom: 1px solid rgba(0,0,0,0.1); padding-bottom: 0.3em; }
.chat-bubble h2 { font-size: 1.15rem; }
.chat-bubble h3 { font-size: 1.05rem; }
.chat-bubble > *:first-child {
    margin-top: 0;
}

.chat-bubble p { 
  margin-bottom: 1em; 
}
.chat-bubble > *:last-child {
    margin-bottom: 0;
}

.chat-bubble ul, .chat-bubble ol { 
  padding-left: 1.75rem; 
  margin-bottom: 1em; 
}
.chat-bubble ul { list-style-type: disc; }
.chat-bubble ol { list-style-type: decimal; }
.chat-bubble li { 
  margin-bottom: 0.5em; 
  padding-left: 0.25rem;
}
.chat-bubble li::marker { color: #a3a3a3; }
.dark .chat-bubble li::marker { color: #737373; }


.chat-bubble a { 
  color: #16a34a;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.dark .chat-bubble a { color: #22c55e; }

.chat-bubble code { 
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 
  font-size: 0.9em; 
  background: rgba(0,0,0,.06); 
  padding: .2rem .4rem; 
  border-radius: .35rem; 
  border: 1px solid rgba(0,0,0,0.08);
}
.dark .chat-bubble code { 
  background: rgba(255,255,255,.1); 
  border-color: rgba(255,255,255,0.15);
}

.chat-bubble pre { 
  background: #0b1220; 
  color: #e5e7eb; 
  padding: 1rem; 
  border-radius: 0.75rem; 
  overflow-x: auto; 
  font-size: 0.9rem;
  line-height: 1.5;
}
.chat-bubble pre code { background: transparent; border: none; padding: 0; }

.chat-bubble blockquote { 
  border-left: 3px solid #16a34a;
  padding-left: 1rem; 
  margin-left: 0.25rem;
  font-style: italic;
  color: #525252; 
}
.dark .chat-bubble blockquote { 
  border-color: #22c55e;
  color: #a3a3a3; 
}

.msg { 
  max-width: min(72ch, 100%); 
  word-break: break-word; 
}

.toast { 
  transform: translateY(100%); 
  opacity: 0; 
  transition: transform 0.3s ease, opacity 0.3s ease; 
}
.toast.show { 
  transform: translateY(0); 
  opacity: 1; 
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.value-chip {
    display: inline-block;
    background-color: #e5e7eb;
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.dark .value-chip {
    background-color: #374151;
    color: #d1d5db;
}

.example-prompt-btn {
    padding: 0.75rem;
    background-color: #f3f4f6;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    text-align: left;
    transition: background-color 0.2s;
}

.example-prompt-btn:hover { background-color: #e5e7eb; }
.dark .example-prompt-btn { background-color: #1f2937; }
.dark .example-prompt-btn:hover { background-color: #374151; }

.loader {
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3498db;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.thinking-spinner {
  border: 3px solid #e5e7eb; /* gray-200 */
  border-top: 3px solid #16a34a; /* green-600 */
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}
.dark .thinking-spinner {
  border: 3px solid #374151; /* gray-700 */
  border-top: 3px solid #22c55e; /* green-500 */
}
