:root {
  /* Light theme colors */
  --primary-light: #408dfb;
  --secondary-light: #6CAEFB;
  --accent-light: #3173d6;
  --text-light: #21263C;
  --background-light: #FFFFFF;
  --card-background-light: #FCFCFE;
  --border-light: #EBF4FE;
  --success-light: #4caf50;
  --error-light: #f44336;

  /* Dark theme colors - updated with new color scheme */
  --primary-dark: #408dfb;
  --secondary-dark: #6CAEFB;
  --accent-dark: #3173d6;
  --text-dark: #21263C;
  --background-dark: #FFFFFF;
  --card-background-dark: #FCFCFE;
  --border-dark: #EBF4FE;
  --success-dark: #4caf50;
  --error-dark: #f44336;
  
  /* Global sizing */
  --max-width: 1200px;
  --border-radius: 8px;
  --header-height: 64px;
  --footer-height: 60px;
}

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

html,
body {
  max-width: 100vw;
  height: 100%;
  overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

/* Theme styles */
body.light {
  color: var(--text-light);
  background: var(--background-light);
}

body.dark {
  color: var(--text-dark);
  background: var(--background-dark);
}

a {
  color: inherit;
  text-decoration: none;
}

/* App layout */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 1.5rem;
  background-color: var(--card-background-dark);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  display: flex;
  flex-direction: column;
}

.logo h1 {
  font-size: 2.25rem; /* Increased by 50% from 1.5rem */
  font-weight: 700;
  margin: 0;
  padding: 0;
  line-height: 0.9; /* Reduce the space below the text */
  background: linear-gradient(to right, #3B82F6, #8B5CF6); /* Medium blue to medium purple gradient */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
}

.subtitle {
  font-size: 0.9rem; /* Slightly larger */
  opacity: 0.9;
  color: #8B5CF6; /* Match the medium purple color from the gradient */
  font-weight: 500; /* Slightly bolder */
  margin-top: 1px; /* Reduced from 4px to bring closer to logo */
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
}

/* Chat interface */
.chat-interface {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - var(--footer-height) - 2rem);
  max-height: 800px;
  background-color: var(--card-background-dark);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.messages-container {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.3s ease;
}

/* Modified for right-aligned user messages */
.message.user {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

.message-avatar {
  margin-right: 1rem;
  flex-shrink: 0;
}

/* Modified for right-aligned user messages */
.message.user .message-avatar {
  margin-right: 0;
  margin-left: 1rem;
}

.assistant-avatar, .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.assistant-avatar {
  background-color: var(--primary-dark);
  color: #000;
}

.user-avatar {
  background-color: var(--accent-dark);
  color: #000;
}

.message-content-wrapper {
  flex: 1;
  max-width: calc(100% - 50px);
}

.message-text {
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  position: relative;
}

.message.assistant .message-text {
  background-color: #f9f9fb;
  text-align: left;
}

.message.user .message-text {
  background-color: rgba(49, 115, 214, 0.15);
  text-align: right;
  border: 1px solid rgba(49, 115, 214, 0.1);
}

/* Add styles for user message content alignment */
.message.user .message-content-wrapper {
  display: flex;
  justify-content: flex-end;
}

.message-text p {
  margin-bottom: 0.5rem;
}

.message-text p:last-child {
  margin-bottom: 0;
}

/* Tool results styling */
.chart-display {
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  background-color: rgba(30, 30, 30, 0.5);
  border-radius: var(--border-radius);
  overflow: visible;
  max-width: 100%;
  height: auto;
  min-height: 600px;
}

.chart-container {
  width: 100%;
  padding: 1rem;
  min-height: 600px;
  overflow: visible;
}

.chart-image {
  width: 100%;
  max-width: 100%;
  min-height: 400px;
  max-height: 700px;
  height: auto;
  object-fit: contain;
  overflow: visible;
}

.plotly-chart {
  width: 100%;
  height: 600px;
  overflow: visible;
}

.chart-error {
  margin-top: 1rem;
  background-color: rgba(250, 128, 114, 0.15);
  border: 1px solid rgba(244, 67, 54, 0.3);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--error-dark);
  text-align: center;
}

.chart-error .error-icon {
  margin-bottom: 1rem;
}

.chart-error .error-message {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
}

.chart-error .error-message p {
  margin-bottom: 0.5rem;
  color: var(--error-dark);
}

.chart-error .error-help {
  font-size: 0.85rem;
  color: var(--text-dark);
  opacity: 0.8;
  margin-top: 0.5rem;
}

/* Message state styling */
.message.streaming .message-text {
  background-color: #f9f9fb;
}

.typing-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.5rem;
}

.typing-indicator span {
  height: 8px;
  width: 8px;
  float: left;
  margin: 0 1px;
  background-color: var(--primary-dark);
  display: block;
  border-radius: 50%;
  opacity: 0.5;
}

.typing-indicator span:nth-of-type(1) {
  animation: typing 1s infinite 0.0s;
}

.typing-indicator span:nth-of-type(2) {
  animation: typing 1s infinite 0.2s;
}

.typing-indicator span:nth-of-type(3) {
  animation: typing 1s infinite 0.4s;
}

@keyframes typing {
  0% { transform: scale(1); }
  33% { transform: scale(1.5); }
  66% { transform: scale(1); }
  100% { transform: scale(1); }
}

.message.has-error .message-text {
  border: 1px solid var(--error-dark);
}

.error-message {
  background-color: rgba(250, 128, 114, 0.15);
  border: 1px solid rgba(244, 67, 54, 0.3);
  border-radius: var(--border-radius);
  padding: 0.75rem;
  margin-top: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.error-icon {
  font-size: 1.25rem;
  margin-top: 0.125rem;
}

.error-text {
  flex: 1;
}

.error-text strong {
  display: block;
  color: var(--error-dark);
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.error-text p {
  color: var(--text-dark);
  margin: 0 0 0.5rem 0;
  font-size: 0.85rem;
  opacity: 0.9;
}

.retry-button {
  background-color: rgba(255, 204, 0, 0.8);
  color: #000;
  border: none;
  border-radius: 4px;
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color 0.2s;
  font-weight: 500;
}

.retry-button:hover {
  background-color: var(--primary-dark);
}

/* Input and suggestion chips */
.input-container {
  padding: 1rem;
  border-top: 1px solid var(--border-dark);
}

.input-container form {
  display: flex;
  align-items: center;
}

.input-container input {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-dark);
  background-color: var(--background-dark);
  color: var(--text-dark);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.input-container input:focus {
  outline: none;
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.2);
}

.input-container input.loading {
  background-color: rgba(255, 204, 0, 0.05);
}

.send-button {
  background-color: var(--primary-dark);
  color: #000;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  margin-left: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.send-button:hover {
  background-color: var(--secondary-dark);
}

.send-button:disabled {
  background-color: var(--border-dark);
  cursor: not-allowed;
  opacity: 0.5;
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border-dark);
}

.suggestion-chip {
  background-color: rgba(235, 244, 254, 0.5);
  border: 1px solid rgba(64, 141, 251, 0.3);
  color: var(--text-dark);
  border-radius: 16px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-chip:hover {
  background-color: rgba(64, 141, 251, 0.2);
  border-color: rgba(64, 141, 251, 0.5);
}

/* Loading spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

/* Footer styling */
.disclaimer-footer {
  padding: 1rem 1.5rem;
  background-color: var(--card-background-dark);
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
  font-size: 0.75rem;
  color: var(--text-dark);
  opacity: 0.7;
}

.disclaimer-content {
  max-width: var(--max-width);
  margin: 0 auto;
}

.disclaimer-content p {
  margin-bottom: 0.5rem;
}

.disclaimer-content p:last-child {
  margin-bottom: 0;
}

/* Responsive styles */
@media (max-width: 768px) {
  .logo h1 {
    font-size: 1.85rem; /* Increased by 50% from 1.25rem */
    padding: 0;
    line-height: 0.9; /* Reduce the space below the text */
    background: linear-gradient(to right, #3B82F6, #8B5CF6); /* Medium blue to medium purple gradient */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
  }
  
  .subtitle {
    font-size: 0.75rem;
    color: #8B5CF6; /* Match the medium purple color from the gradient */
    font-weight: 500;
    margin-top: 0px; /* Bring even closer on mobile */
  }
  
  .chat-interface {
    height: calc(100vh - var(--header-height) - var(--footer-height) - 1rem);
  }
  
  .message-avatar {
    margin-right: 0.5rem;
  }
  
  .message.user .message-avatar {
    margin-right: 0;
    margin-left: 0.5rem;
  }
  
  .assistant-avatar, .user-avatar {
    width: 30px;
    height: 30px;
  }
  
  .message-text {
    padding: 0.5rem 0.75rem;
  }
  
  .disclaimer-footer {
    padding: 0.75rem 1rem;
    font-size: 0.7rem;
  }
}