/* Font import (MUST BE AT THE TOP) */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

/* --- Base & Variables (ChatGPT-like Dark Theme - Black Version) --- */
:root {
  --primary-bg: #000000; /* Main background (PURE BLACK) */
  --secondary-bg: #1a1a1a; /* Very dark gray for contrast (messages, input) */
  --sidebar-bg: #000000; /* Black sidebar */
  --text-primary: #eaeaeb; /* Slightly adjusted light gray text for black bg */
  --text-secondary: #9a9a9f; /* Slightly adjusted medium gray text */
  --text-light: #ffffff; /* Pure white text */
  --border-color: #363636; /* Slightly lighter border for black bg */
  --icon-color: #9a9a9f; /* Default icon color */
  --accent-color: #ffffff; /* Changed from teal to white */
  --hover-bg: #1f1f1f; /* Background hover for items */
  --button-bg: #ffffff; /* Changed from teal to white */
  --button-text: #000000; /* Changed to black for contrast with white buttons */
  --button-hover-bg: #e6e6e6; /* Changed to light gray for white button hover */
  --send-button-bg: #333333; /* Grey send button background */
  --send-button-icon: #9a9a9f; /* Grey send button icon color */
  --send-button-hover-bg: #000000; /* Black send button hover background */
  --send-button-active-bg: #000000; /* Black send button active background when text is entered */
  --sidebar-width: 260px; /* Default sidebar width */
  --sidebar-minimized-width: 76px; /* Increased from 70px to provide more space */
  --transition-speed: 0.2s;
  --transition-speed-slow: 0.3s; /* Slower transition for smoother animations */
  /* Smoother cubic bezier */
  --transition-cubic: cubic-bezier(0.4, 0, 0.2, 1);

  /* Added new variables for messages */
  --user-msg-bg: #2d2d2d; /* Slightly lighter for user messages */
  --ai-msg-bg: #101010; /* Very subtle background for AI messages */
  --code-block-bg: #1e1e1e; /* Background for code blocks */
  --code-block-color: #d4d4d4; /* Text color for code blocks */
  --code-block-border: #3a3a3a; /* Border for code blocks */

  /* Use Inter font (imported above) */
  --font-primary: "Inter", sans-serif;
  --font-title: "Inter", sans-serif;
  --font-title-weight: 600; /* Adjusted weight for Inter */
  --container-padding: 1rem;
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 16px; /* New larger border radius for more rounded elements */

  /* Modal specific variables */
  --modal-bg: #000000; /* Updated to black */
  --modal-overlay-bg: rgba(0, 0, 0, 0.75); /* Darker overlay */
  --modal-border-color: var(--border-color);
  --modal-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  --modal-max-width: 480px;
  --modal-border-radius: var(--border-radius-lg);
  --modal-title-color: var(--text-light);
  --modal-text-color: var(--text-primary);
  --modal-icon-bg: rgba(
    255,
    255,
    255,
    0.08
  ); /* Lighter, more subtle icon background */
  --modal-icon-color: var(--accent-color); /* Use white accent for icons */
  --modal-button-bg: #1a1a1a; /* Updated to off-black */
  --modal-button-hover-bg: var(--button-hover-bg);
  --modal-close-button-color: var(--text-light); /* Updated to white */
  --modal-close-button-hover-bg: rgba(
    255,
    255,
    255,
    0.1
  ); /* Subtle white hover effect */
  --modal-close-button-active-bg: rgba(
    255,
    255,
    255,
    0.15
  ); /* Slightly stronger on active */
  --modal-section-bg: rgba(
    30,
    30,
    30,
    0.6
  ); /* Subtle background for sections */
  --modal-section-hover-bg: rgba(
    40,
    40,
    40,
    0.8
  ); /* Slightly lighter on hover */
  --modal-section-border: 1px solid rgba(255, 255, 255, 0.05); /* Very subtle border */
  --modal-gradient-text: linear-gradient(
    135deg,
    #ffffff 0%,
    #cccccc 100%
  ); /* White gradient for highlights */

  /* Settings menu specific variables */
  --settings-menu-bg: #1a1a1a;
  --settings-menu-border: var(--border-color);
  --settings-menu-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  --settings-header-bg: #141414;
  --settings-divider: var(--border-color);
  --settings-button-bg: #2d2d2d;
  --settings-button-hover-bg: #363636;
  --settings-toggle-bg: #2d2d2d;
  --settings-toggle-active-bg: var(--accent-color);

  /* Sign-in prompt variables */
  --signin-overlay-bg: rgba(
    0,
    0,
    0,
    0.85
  ); /* Even darker overlay for sign-in */
  --signin-container-bg: #101010; /* Very dark background for the container */
  --signin-border-color: var(--border-color);
  --signin-max-width: 400px;
  --signin-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* --- Reset & Base Styles --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  height: 100%; /* Ensure HTML takes full height */
}

body {
  font-family: var(--font-primary);
  background-color: var(--primary-bg); /* Updated to black */
  color: var(--text-primary);
  line-height: 1.6;
  font-weight: 400;
  height: 100%; /* Changed from 100vh to 100% */
  /* Prevent body scrolling, especially on mobile */
  overflow: hidden; /* CHANGED from auto */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

ul {
  list-style: none;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}
a:hover {
  color: var(--text-light);
}

button {
  font-family: inherit;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

img {
  max-width: 100%;
  display: block;
}

/* General Glass Effect Class (Can be reused if needed) */
.card-glass {
  background: rgba(45, 45, 45, 0.65);
  backdrop-filter: blur(12px); /* Increased blur slightly */
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25); /* Slightly more pronounced shadow */
}

/* --- Sign-In Prompt --- */
.signin-prompt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--signin-overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2500; /* Above modal, below sign-in */
  padding: 20px;
  opacity: 0; /* Initially hidden */
  visibility: hidden;
  transition: opacity var(--transition-speed-slow) ease,
    visibility 0s linear var(--transition-speed-slow);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.signin-prompt-overlay.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--transition-speed-slow) ease, visibility 0s linear;
}

.signin-prompt-container {
  background-color: var(--signin-container-bg);
  border: 1px solid var(--signin-border-color);
  border-radius: var(--border-radius-lg);
  padding: 32px 40px;
  width: 100%;
  max-width: var(--signin-max-width);
  box-shadow: var(--signin-shadow);
  text-align: center;
  transform: scale(0.95);
  opacity: 0;
  transition: transform var(--transition-speed-slow) var(--transition-cubic),
    opacity var(--transition-speed-slow) ease;
}

.signin-prompt-overlay.visible .signin-prompt-container {
  transform: scale(1);
  opacity: 1;
}

.signin-logo {
  height: 40px;
  width: auto;
  margin: 0 auto 20px auto;
}

.signin-prompt-container h2 {
  color: var(--text-light);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 10px;
  font-family: var(--font-title);
}

.signin-prompt-container p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 25px;
  line-height: 1.5;
}

/* Style the container for the Google button for centering */
.signin-prompt-container .g_id_signin {
  display: inline-block; /* Allow centering via text-align */
  margin: 0 auto;
}

/* --- App Layout --- */
.app-layout {
  display: flex;
  height: 100%; /* Use 100% to fill body height */
  position: relative; /* Needed for overlay positioning */
  overflow: hidden; /* Prevent layout shifts from scrollbars */
  opacity: 1; /* Default visible state */
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Class to hide the app layout until signed in */
.app-layout.hidden-until-signin {
  opacity: 0;
  visibility: hidden;
  pointer-events: none; /* Prevent interaction when hidden */
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg); /* Remains black */
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  transition: width var(--transition-speed-slow) var(--transition-cubic),
    transform var(--transition-speed-slow) var(--transition-cubic),
    /* Use transform for mobile sliding */ margin-left
      var(--transition-speed-slow) var(--transition-cubic); /* Keep margin for desktop */
  position: fixed; /* Changed to fixed for both desktop and mobile */
  left: 0;
  top: 0;
  z-index: 1001; /* Above chat overlay */
  border-right: 1px solid var(--border-color); /* Add border */
  transform: translateX(0); /* Default transform state */
}

.sidebar-header {
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  transition: padding var(--transition-speed-slow) var(--transition-cubic);
}

.sidebar-controls {
  display: flex;
  align-items: center;
  transition: all var(--transition-speed-slow) var(--transition-cubic);
}

/* Add desktop-specific style for minimize button */
@media (min-width: 769px) {
  .sidebar-header {
    padding-right: 6px; /* Reduce right padding to move button closer to edge */
  }

  .sidebar-controls {
    width: 100%; /* Ensure controls span full width */
    justify-content: flex-end; /* Right-align controls */
  }

  .minimize-sidebar-button {
    margin-left: auto; /* Push to the right edge of container */
    margin-right: 0; /* Ensure no right margin */
  }
}

.new-chat-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  flex-grow: 1;
  margin-right: 8px;
  font-size: 0.9rem;
  font-family: var(--font-title);
  font-weight: var(--font-title-weight);
  background-color: #ffffff;
  color: #000000;
  border-color: #ffffff;
  overflow: hidden; /* Prevent text from spilling during transition */
  transition: background-color var(--transition-speed-slow)
      var(--transition-cubic),
    border-color var(--transition-speed-slow) var(--transition-cubic),
    opacity var(--transition-speed-slow) var(--transition-cubic),
    transform var(--transition-speed-slow) var(--transition-cubic),
    width var(--transition-speed-slow) var(--transition-cubic),
    height var(--transition-speed-slow) var(--transition-cubic),
    padding var(--transition-speed-slow) var(--transition-cubic),
    margin var(--transition-speed-slow) var(--transition-cubic),
    border-radius var(--transition-speed-slow) var(--transition-cubic),
    flex-grow var(--transition-speed-slow) var(--transition-cubic);
}
.new-chat-button:hover {
  background-color: #ffffff;
  border-color: #ffffff;
  color: #000000;
  opacity: 0.9;
  transform: scale(0.98);
}
.new-chat-button i {
  font-size: 0.85rem;
  color: #000000;
  transition: margin var(--transition-speed-slow) var(--transition-cubic),
    transform var(--transition-speed-slow) var(--transition-cubic);
}

.sidebar-toggle {
  padding: 8px;
  border-radius: var(--border-radius-sm);
  color: var(--icon-color);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  transition: background-color var(--transition-speed) ease,
    color var(--transition-speed) ease,
    /* Added color transition */ transform var(--transition-speed-slow)
      var(--transition-cubic),
    /* Added transform transition */ width var(--transition-speed-slow)
      var(--transition-cubic),
    height var(--transition-speed-slow) var(--transition-cubic),
    padding var(--transition-speed-slow) var(--transition-cubic),
    margin var(--transition-speed-slow) var(--transition-cubic),
    border-radius var(--transition-speed-slow) var(--transition-cubic);
  margin-left: 4px;
}
.sidebar-toggle:hover {
  background-color: var(--hover-bg);
  color: var(--text-light); /* Change color on hover */
}

/* Specific icon transition for desktop minimize button */
.minimize-sidebar-button i {
  transition: transform var(--transition-speed-slow) var(--transition-cubic);
}
.app-layout.sidebar-minimized .minimize-sidebar-button i {
  transform: rotate(180deg);
}

.close-sidebar-button {
  display: none; /* Hide close button by default (shown on mobile) */
}

.chat-history {
  flex-grow: 1;
  overflow-y: auto;
  padding: 10px 0;
  /* Improve scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}
.chat-history::-webkit-scrollbar {
  width: 6px;
}
.chat-history::-webkit-scrollbar-track {
  background: transparent;
}
.chat-history::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 3px;
}

.chat-history ul {
  padding: 0 10px;
}
.chat-history li {
  margin-bottom: 2px;
}
.chat-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--border-radius-md);
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: padding var(--transition-speed-slow) var(--transition-cubic),
    justify-content var(--transition-speed-slow) var(--transition-cubic),
    width var(--transition-speed-slow) var(--transition-cubic),
    height var(--transition-speed-slow) var(--transition-cubic),
    gap var(--transition-speed-slow) var(--transition-cubic),
    background-color var(--transition-speed) ease;
}
.chat-history-item:hover {
  background-color: var(--hover-bg);
}
.chat-history-item.active {
  background-color: rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--accent-color);
  font-weight: var(--font-title-weight);
  font-family: var(--font-title);
}
.chat-history-item i {
  font-size: 0.9rem;
  color: var(--icon-color);
  flex-shrink: 0;
  transition: margin var(--transition-speed-slow) var(--transition-cubic);
  opacity: 0.8; /* Slightly transparent for a sleek look */
  filter: drop-shadow(
    0 1px 1px rgba(0, 0, 0, 0.2)
  ); /* Subtle shadow for depth */
}

.chat-history-item:hover i {
  opacity: 1; /* Full opacity on hover */
  color: var(--text-light); /* Brighter color on hover */
}

.chat-history-item.active i {
  color: var(--accent-color); /* Accent color for active state */
  opacity: 1;
}

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}
.sidebar-footer ul {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sidebar-footer li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--border-radius-md);
  font-size: 0.9rem;
  transition: padding var(--transition-speed-slow) var(--transition-cubic),
    justify-content var(--transition-speed-slow) var(--transition-cubic),
    width var(--transition-speed-slow) var(--transition-cubic),
    height var(--transition-speed-slow) var(--transition-cubic),
    gap var(--transition-speed-slow) var(--transition-cubic),
    background-color var(--transition-speed) ease;
}
.sidebar-footer li a:hover {
  background-color: var(--hover-bg);
}
.sidebar-footer li a i,
.sidebar-footer li a .footer-icon {
  font-size: 1rem;
  color: var(--icon-color);
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  transition: margin var(--transition-speed-slow) var(--transition-cubic);
}
.sidebar-footer li a .footer-icon {
  height: 18px;
  width: 18px;
  opacity: 0.8;
}

/* --- Chat Area --- */
.chat-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%; /* Use full available height */
  background-color: var(--primary-bg); /* Updated to black */
  /* Use margin-left only for desktop adjustments */
  margin-left: var(--sidebar-width);
  transition: margin-left var(--transition-speed-slow) var(--transition-cubic);
  position: relative; /* Ensure it's part of the stacking context if needed */
  overflow: hidden; /* ADDED: Prevent this container itself from scrolling */
}

/* Chat Header */
.chat-header {
  background-color: var(--primary-bg);
  padding: 12px var(--container-padding);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0; /* Prevent header from shrinking */
  border-bottom: 1px solid var(--border-color);
  z-index: 1000; /* Above chat content, potentially below sidebar */
  transition: padding var(--transition-speed-slow) var(--transition-cubic);
  position: relative; /* Needed for any potential future absolutely positioned elements */
}

/* Mobile Sidebar Toggle Button in Header */
.mobile-sidebar-toggle {
  display: none; /* Hidden by default, shown via media query */
  background: none;
  border: none;
  color: var(--icon-color);
  font-size: 1.2rem;
  padding: 8px;
  margin-right: 8px; /* Space between toggle and title */
  cursor: pointer;
  z-index: 1002; /* Above chat header content */
  transition: color var(--transition-speed) ease;
}
.mobile-sidebar-toggle:hover {
  color: var(--text-light);
}

.chat-title {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 0;
}

.chat-header-logo {
  display: block;
  margin: 0 auto;
  height: 40px;
  width: auto;
  max-width: 160px;
}

/* Removed Header Icon Button (for Snapshot Toggle) */

/* --- Chat Main Area --- */
.chat-main {
  flex-grow: 1; /* Allow main area to take up remaining space */
  overflow-y: auto; /* Allow *internal* scrolling for messages */
  padding: 20px 0; /* Keep vertical padding */
  background-color: var(--primary-bg);
  /* Crucial for flexbox growth calculation in some browsers */
  min-height: 0;
  display: flex; /* ADDED: Make chat-main a flex container */
  flex-direction: column; /* ADDED: Stack children vertically */
}

.chat-messages-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--container-padding);
  display: flex;
  flex-direction: column;
  gap: 25px;
  width: 100%; /* ADDED: Ensure it takes full width of parent */
  /* Let initial greeting handle flex grow when visible */
  flex-grow: 1; /* ADDED: Allow messages to take space */
  flex-shrink: 1; /* ADDED: Allow shrinking if needed */
}

/* --- Messages --- */
.message {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  font-size: 0.95rem;
  animation: fadeInUp 0.4s ease-out forwards;
  opacity: 0;
  padding: 0.75rem 0;
  position: relative; /* For potential hover effects */
  width: 100%;
}

.message-icon-wrapper {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background-color: var(--primary-bg);
  border: 1px solid var(--border-color);
  margin-top: 0.15rem; /* Slight top margin for better alignment with text */
}

.message-icon {
  font-size: 1rem;
  color: var(--text-light);
}

.ai-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.message-content {
  padding-top: 2px;
  flex-grow: 1;
  max-width: calc(100% - 50px); /* Account for icon and gap */
  line-height: 1.5; /* Improved line height */
  transition: background-color 0.2s ease;
}

.message-content p {
  margin-bottom: 0.75rem; /* Space between paragraphs */
  line-height: 1.7;
  white-space: pre-wrap; /* Let text wrap */
  word-wrap: break-word; /* Break long words if needed */
}

.message-content p:last-child {
  margin-bottom: 0; /* Remove bottom margin from last paragraph */
}

/* Make links stand out more */
.message-content p a,
.message-content a {
  /* Apply to links outside paragraphs too */
  color: var(--accent-color);
  text-decoration: underline;
  text-underline-offset: 2px; /* Space between text and underline */
  transition: color 0.2s ease, text-decoration 0.2s ease;
  word-break: break-all; /* Allow long links to break */
}

.message-content p a:hover,
.message-content a:hover {
  color: #15c29b; /* Lighter accent */
  text-decoration-thickness: 2px; /* Thicker underline on hover */
}

/* User message styling */
.user-message {
  justify-content: flex-end; /* Align user messages to the right */
}

.user-message .message-icon-wrapper {
  order: 2; /* Move icon to the right */
}

.user-message .message-content {
  background-color: var(--user-msg-bg);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  order: 1; /* Content before icon */
  margin-right: 0.5rem;
}

/* AI message styling */
.ai-message .message-content {
  background-color: var(--ai-msg-bg);
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.ai-message .message-content strong,
.ai-message .message-content b {
  font-weight: 600; /* Ensure bold stands out */
  color: var(--text-light);
}

.ai-message .message-content ul,
.ai-message .message-content ol {
  margin-left: 1.5rem; /* Indent lists */
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  padding-left: 0; /* Reset browser default padding */
}

.ai-message .message-content li {
  margin-bottom: 0.25rem;
  padding-left: 0.25rem;
  position: relative; /* Needed for potential custom bullets */
}
/* Optional: Style list bullets if needed */
.ai-message .message-content ul li::before {
  /* content: '•'; Example custom bullet */
  /* ... styles for custom bullet ... */
}

/* Code block styling for AI responses - simulate syntax highlighting */
.ai-message .message-content pre {
  background-color: var(--code-block-bg);
  border-radius: var(--border-radius-md);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  overflow-x: auto;
  border: 1px solid var(--code-block-border);
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 0.9rem;
  color: var(--code-block-color);
  white-space: pre; /* Preserve whitespace and line breaks */
  box-shadow: inset 0 0 0.5rem rgba(0, 0, 0, 0.2);
  word-wrap: normal; /* Prevent wrapping inside code blocks */
}

.ai-message .message-content code {
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  font-size: 0.9em;
  padding: 0.2em 0.4em;
  background-color: var(--code-block-bg);
  border-radius: 3px;
  color: var(--code-block-color);
}
/* Ensure inline code doesn't break line */
.ai-message .message-content p code {
  white-space: nowrap;
}

/* Thinking indicator */
.message.thinking .message-content p {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Ensure spinner animation is defined */
.message.thinking .fa-spinner.fa-spin {
  animation: fa-spin 1.5s linear infinite;
}

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

/* Message hover effect */
.message:hover {
  background-color: rgba(255, 255, 255, 0.02); /* Very subtle highlight */
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .message {
    padding: 0.5rem 0;
  }

  .user-message {
    justify-content: flex-end;
  }

  .user-message .message-content,
  .ai-message .message-content {
    max-width: calc(100% - 45px);
    padding: 0.625rem 0.875rem;
  }

  .chat-header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .chat-title {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    position: static;
  }

  .chat-header-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    height: 32px;
    max-width: 120px;
    display: block;
  }
}

/* --- Input Area --- */
.chat-input-area {
  flex-shrink: 0;
  padding: 15px 0 10px 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0),
    var(--primary-bg) 58.85%
  );
  border-top: 1px solid transparent;
  z-index: 999;
}

.input-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--container-padding);
  width: 100%;
  position: relative;
}

/* Reset Chat Button */
.reset-chat-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--settings-button-bg);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: background-color var(--transition-speed) ease,
    color var(--transition-speed) ease;
  border: 1px solid var(--border-color);
  margin-right: 16px; /* Increased margin for separation */
  flex-shrink: 0;
}

.reset-chat-button:hover {
  background-color: var(--settings-button-hover-bg);
  color: var(--text-light);
}

#message-form {
  display: flex;
  flex-direction: row; /* Changed from column to row */
  align-items: center; /* Vertically center items */
  gap: 0;
  padding-left: 0; /* Remove left padding */
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  background-color: var(--secondary-bg);
  border-radius: var(--border-radius-lg);
  padding: 8px 8px 8px 15px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  width: 100%;
  transform: translateZ(0);
}

.input-wrapper:focus-within {
  /* No visual change needed on focus-within based on design */
}

@media (max-width: 480px) {
  .reset-chat-button {
    width: 38px;
    height: 38px;
    margin-right: 10px; /* Slightly more space for mobile */
  }

  #message-form {
    padding-left: 0; /* Remove left padding for mobile too */
  }
}

#message-input {
  flex-grow: 1;
  background: transparent;
  border: none;
  outline: none; /* Ensure no focus outline */
  color: var(--text-primary);
  font-size: 1rem; /* Consistent font size */
  font-family: var(--font-primary);
  resize: none;
  line-height: 1.5; /* Adjusted line height */
  max-height: 150px; /* Lower max height for mobile */
  overflow-y: auto; /* Allow internal scroll for long input */
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-top: 6px; /* Fine-tune alignment */
  padding-bottom: 6px;
  min-width: 0; /* Help flexbox calculation */
  scrollbar-gutter: stable both-edges;
}
#message-input::-webkit-scrollbar {
  display: none;
}
#message-input:focus {
  outline: none; /* Reiterate no outline */
}

#message-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.8;
  font-family: var(--font-primary);
}

.send-button {
  background-color: var(--send-button-bg);
  color: var(--send-button-icon);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: all var(--transition-speed) ease;
  margin-left: 8px;
  border: 1px solid transparent;
}
.send-button:hover:not(:disabled) {
  background-color: var(--send-button-hover-bg);
  color: var(--text-light);
  border-color: var(--border-color);
}
.send-button.active {
  background-color: var(--accent-color);
  color: var(--button-text);
}
.send-button:disabled {
  background-color: transparent;
  color: var(--text-secondary);
  opacity: 0.5;
  cursor: not-allowed;
  border-color: transparent;
}

.disclaimer {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 0;
  padding-top: 8px; /* More space above disclaimer */
}

/* --- Initial Greeting & Suggestions --- */
#initial-greeting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Center content vertically */
  text-align: center;
  padding: 6vh var(--container-padding) 4vh; /* Adjusted padding */
  animation: fadeIn 0.8s ease-out forwards;
  flex-grow: 1; /* Make it take available space when messages are empty */
  flex-shrink: 0; /* Don't shrink initial greeting */
  min-height: 0; /* Prevent overflow in flex context */
  width: 100%; /* Ensure it takes full width */
  overflow: hidden; /* Hide overflow if absolutely needed */
  will-change: opacity, transform; /* Optimize for animation */
}

.initial-greeting-text {
  font-size: clamp(1.8rem, 5vw, 2.5rem); /* Responsive font size */
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 30px; /* More space before suggestions */
  font-family: var(--font-title);
}
.greeting-line-1,
.greeting-line-2 {
  display: block;
}
.greeting-line-2 {
  margin-top: 0.25em;
}
.initial-greeting-text .bold-name {
  font-weight: var(--font-title-weight);
  background: linear-gradient(45deg, #ffffff, #999999); /* Adjusted gradient */
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

/* Suggestion Pills Styling (Glassmorphism) */
.suggestion-scroll-viewport {
  overflow: hidden;
  max-width: 90%; /* Wider on mobile */
  margin: 20px auto 0; /* Adjusted margin */
  padding-top: 4px; /* Space for potential hover transform */
  -webkit-mask-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 1) 10%,
    rgba(0, 0, 0, 1) 90%,
    rgba(0, 0, 0, 0) 100%
  );
  mask-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 1) 10%,
    rgba(0, 0, 0, 1) 90%,
    rgba(0, 0, 0, 0) 100%
  );
  will-change: opacity, transform; /* Optimize for animation */
}

.suggestion-examples.initial-suggestions {
  display: flex;
  gap: 12px; /* Increased gap slightly */
  width: max-content;
  animation: fadeIn 0.8s ease-out forwards, scrollPills 45s linear infinite;
  will-change: transform; /* Optimize for animation */
}

/* Send Button Pulse Effect */
.send-button.active {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Pause animation on hover */
.suggestion-scroll-viewport:hover .suggestion-examples.initial-suggestions {
  animation-play-state: paused;
}

.suggestion-pill {
  /* Glassmorphism Base */
  background: rgba(255, 255, 255, 0.05); /* Subtle light glass effect */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px); /* Safari */
  border: 1px solid rgba(255, 255, 255, 0.1); /* Subtle white border */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); /* Soft shadow for depth */

  /* Shape, Text, Layout */
  border-radius: 100px; /* Pill shape */
  padding: 10px 18px; /* Slightly more padding */
  font-size: 0.88rem; /* Adjusted font size */
  color: var(--text-primary); /* Light text for contrast */
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px; /* Space between icon and text */
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); /* Subtle shadow for readability */

  /* Transitions */
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease,
    box-shadow 0.2s ease;
}

.suggestion-pill:hover {
  background: rgba(255, 255, 255, 0.1); /* Slightly more opaque on hover */
  border-color: rgba(255, 255, 255, 0.25); /* Brighter border */
  transform: translateY(-2px); /* Lift effect */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); /* Enhanced shadow */
}

.suggestion-pill i {
  font-size: 0.85rem; /* Adjusted icon size */
  opacity: 0.85; /* Slightly less transparent */
  filter: drop-shadow(
    0 1px 1px rgba(0, 0, 0, 0.3)
  ); /* Add shadow to icon for depth */
}

/* Suggestion Pill Specific Icon Colors */
.suggestion-pill .icon-market {
  color: var(--accent-color);
}
.suggestion-pill .icon-econ {
  color: #4285f4;
}
.suggestion-pill .icon-gain-loss {
  color: #34a853;
}
.suggestion-pill .icon-drivers {
  color: #a050f0;
}
.suggestion-pill .icon-etf {
  color: #4285f4;
} /* Reusing color, adjust if needed */
.suggestion-pill .icon-portfolio {
  color: #fbbc05;
}

/* --- Removed Snapshot Popover Styles --- */

/* --- Sidebar Toggle States (Desktop) --- */
.app-layout.sidebar-hidden .sidebar {
  margin-left: calc(-1 * var(--sidebar-width));
  transform: translateX(0);
}
.app-layout.sidebar-hidden .chat-container {
  margin-left: 0;
}
.app-layout.sidebar-minimized .sidebar {
  width: var(--sidebar-minimized-width);
  overflow: hidden;
  margin-left: 0;
  transform: translateX(0);
  transition: width var(--transition-speed-slow) var(--transition-cubic),
    transform var(--transition-speed-slow) var(--transition-cubic);
}
.app-layout.sidebar-minimized .chat-container {
  margin-left: var(--sidebar-minimized-width);
  transition: margin-left var(--transition-speed-slow) var(--transition-cubic);
}

/* --- Styles SPECIFIC to Minimized State --- */
.app-layout.sidebar-minimized .new-chat-button span,
.app-layout.sidebar-minimized .chat-history-item span,
.app-layout.sidebar-minimized .sidebar-footer li a span {
  opacity: 0;
  visibility: hidden;
  width: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.1s ease, visibility 0s linear 0.1s,
    width var(--transition-speed-slow) var(--transition-cubic),
    max-width var(--transition-speed-slow) var(--transition-cubic);
}
.new-chat-button span,
.chat-history-item span,
.sidebar-footer li a span {
  opacity: 1;
  visibility: visible;
  width: auto;
  max-width: 200px;
  transition: opacity var(--transition-speed-slow) ease 0.1s,
    visibility 0s linear,
    width var(--transition-speed-slow) var(--transition-cubic),
    max-width var(--transition-speed-slow) var(--transition-cubic);
}
.app-layout.sidebar-minimized .sidebar-header {
  padding: 12px 6px;
}
.app-layout.sidebar-minimized .sidebar-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.app-layout.sidebar-minimized .new-chat-button,
.app-layout.sidebar-minimized .sidebar-toggle,
.app-layout.sidebar-minimized .chat-history-item,
.app-layout.sidebar-minimized .sidebar-footer li a {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-left: auto;
  margin-right: auto;
  border-radius: var(--border-radius-md);
  flex-shrink: 0;
  gap: 0;
}
.app-layout.sidebar-minimized .new-chat-button {
  background-color: #ffffff;
  border: 1px solid #ffffff;
  color: #000000;
  margin-bottom: 0;
  margin-right: auto;
  flex-grow: 0;
  transform-origin: center;
}
.app-layout.sidebar-minimized .new-chat-button:hover {
  opacity: 0.9;
  transform: scale(0.98);
}
.app-layout.sidebar-minimized .sidebar-toggle {
  background-color: transparent;
}
.app-layout.sidebar-minimized .sidebar-toggle:hover {
  background-color: var(--hover-bg);
}
.app-layout.sidebar-minimized .chat-history-item:hover {
  background-color: var(--hover-bg);
}
.app-layout.sidebar-minimized .chat-history-item.active {
  background-color: var(--secondary-bg);
}
.app-layout.sidebar-minimized .sidebar-footer li a:hover {
  background-color: var(--hover-bg);
}
.app-layout.sidebar-minimized .new-chat-button i,
.app-layout.sidebar-minimized .sidebar-toggle i,
.app-layout.sidebar-minimized .chat-history-item i,
.app-layout.sidebar-minimized .sidebar-footer li a i,
.app-layout.sidebar-minimized .sidebar-footer li a .footer-icon {
  margin: 0;
  line-height: 1;
  display: block;
  font-size: 1.1rem;
  text-align: center;
}
.app-layout.sidebar-minimized .new-chat-button i {
  transform: scale(1.1);
  color: #000000;
}
.app-layout.sidebar-minimized .sidebar-footer li a .footer-icon {
  width: 1.1rem;
  height: 1.1rem;
}
.app-layout.sidebar-minimized .close-sidebar-button {
  display: none;
}

/* --- Sidebar Overlay (Mobile) --- */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1500; /* Below modal and sign-in prompt */
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-speed-slow) ease,
    visibility 0s linear var(--transition-speed-slow);
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--transition-speed-slow) ease, visibility 0s linear 0s;
}

/* --- Onboarding Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--modal-overlay-bg);
  display: flex; /* Use flex to center modal */
  align-items: center;
  justify-content: center;
  z-index: 2000; /* Above sidebar overlay, below sign-in prompt */
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-speed-slow) ease,
    visibility 0s linear var(--transition-speed-slow);
  backdrop-filter: blur(3px); /* Add subtle blur to background */
  -webkit-backdrop-filter: blur(3px);
  padding: 20px; /* Add padding for small screens so modal doesn't touch edges */
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--transition-speed-slow) ease, visibility 0s linear;
}

.modal {
  background-color: var(--modal-bg);
  border-radius: var(--modal-border-radius);
  padding: 28px 32px; /* Generous padding */
  width: 100%; /* Take full width of padded overlay container */
  max-width: var(--modal-max-width);
  box-shadow: var(--modal-shadow);
  position: relative;
  border: 1px solid var(--modal-border-color);
  transform: scale(0.95) translateY(10px); /* Start slightly down and scaled */
  opacity: 0;
  transition: transform var(--transition-speed-slow) var(--transition-cubic),
    opacity var(--transition-speed-slow) ease;
  max-height: calc(100vh - 40px); /* Max height considering overlay padding */
  overflow-y: auto; /* Allow scrolling if content overflows */
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}
.modal::-webkit-scrollbar {
  width: 6px;
}
.modal::-webkit-scrollbar-track {
  background: transparent;
}
.modal::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 3px;
}

.modal-overlay.visible .modal {
  transform: scale(1) translateY(0); /* Animate in */
  opacity: 1;
}

.modal-close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: rgba(25, 25, 25, 0.7); /* Dark with slight transparency */
  border: 1px solid rgba(255, 255, 255, 0.1); /* Subtle white border */
  color: var(--modal-close-button-color);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-speed) ease,
    color var(--transition-speed) ease, transform 0.1s ease;
}

.modal-close-button:hover {
  background-color: var(--modal-close-button-hover-bg);
  color: var(--text-light);
  transform: scale(1.05);
}

.modal-close-button:active {
  background-color: var(--modal-close-button-active-bg);
  transform: scale(0.95);
}

.modal-title {
  font-size: 1.5rem; /* Larger title */
  font-weight: 600;
  color: var(--modal-title-color);
  margin-bottom: 30px; /* More space below title */
  text-align: center;
  font-family: var(--font-title);
}

.gradient-text {
  background: var(--modal-gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline;
}

.modal-features-list {
  list-style: none;
  padding: 0;
  margin: 0 0 30px 0; /* Space before action button */
  display: flex;
  flex-direction: column;
  gap: 18px; /* Space between list items */
}

.modal-features-list li {
  display: flex;
  align-items: center;
  gap: 15px; /* Space between icon and text */
  font-size: 1rem;
  color: var(--modal-text-color);
  background-color: var(--modal-section-bg);
  border: var(--modal-section-border);
  border-radius: var(--border-radius-md);
  padding: 13px 15px;
  transition: background-color var(--transition-speed) ease,
    transform var(--transition-speed) ease;
}

.modal-features-list li:hover {
  background-color: var(--modal-section-hover-bg);
  transform: translateY(-2px);
}

.modal-icon {
  display: inline-flex; /* Use flex for centering icon inside */
  align-items: center;
  justify-content: center;
  width: 40px; /* Slightly larger */
  height: 40px;
  background-color: var(--modal-icon-bg);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--modal-icon-color); /* Default accent */
  border-radius: 50%; /* Circular background */
  font-size: 1.1rem; /* Slightly larger icon */
  flex-shrink: 0; /* Prevent icon container from shrinking */
  transition: transform var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
}

.modal-features-list li:hover .modal-icon {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

/* Enhanced icon colors with vibrant gradients */
.modal-features-list li:nth-child(1) .modal-icon {
  background: linear-gradient(
    135deg,
    rgba(66, 133, 244, 0.2) 0%,
    rgba(66, 133, 244, 0.1) 100%
  );
  color: #4285f4;
} /* News */

.modal-features-list li:nth-child(2) .modal-icon {
  background: linear-gradient(
    135deg,
    rgba(251, 188, 5, 0.2) 0%,
    rgba(251, 188, 5, 0.1) 100%
  );
  color: #fbbc05;
} /* Ideas */

.modal-features-list li:nth-child(3) .modal-icon {
  background: linear-gradient(
    135deg,
    rgba(52, 168, 83, 0.2) 0%,
    rgba(52, 168, 83, 0.1) 100%
  );
  color: #34a853;
} /* Reports */

.modal-features-list li:nth-child(4) .modal-icon {
  background: linear-gradient(
    135deg,
    rgba(234, 67, 53, 0.2) 0%,
    rgba(234, 67, 53, 0.1) 100%
  );
  color: #ea4335;
} /* Signals */

.modal-features-list li:nth-child(5) .modal-icon {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.15) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  color: var(--accent-color);
} /* Analyze */

.modal-features-list li:nth-child(6) .modal-icon {
  background: linear-gradient(
    135deg,
    rgba(160, 80, 240, 0.2) 0%,
    rgba(160, 80, 240, 0.1) 100%
  );
  color: #a050f0;
} /* Find */

.modal-features-list li:nth-child(7) .modal-icon {
  background: linear-gradient(
    135deg,
    rgba(255, 109, 1, 0.2) 0%,
    rgba(255, 109, 1, 0.1) 100%
  );
  color: #ff6d01;
} /* Define */

.modal-action-button {
  background: var(--secondary-bg); /* Off-black color */
  color: var(--text-primary); /* Light text for contrast */
  border: 1px solid rgba(255, 255, 255, 0.1); /* Subtle white border */
  padding: 14px 24px; /* Slightly larger button */
  border-radius: var(--border-radius-md);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background-color var(--transition-speed) ease,
    transform 0.15s ease, box-shadow var(--transition-speed) ease;
  display: block;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.modal-action-button:hover {
  background: var(--accent-color); /* White on hover */
  color: var(--button-text); /* Black text on hover */
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.modal-action-button:active {
  transform: scale(0.98) translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Enhanced mobile styling for modal elements */
@media (max-width: 480px) {
  .modal-features-list li {
    padding: 12px;
  }

  .modal-icon {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
  }

  .modal-features-list {
    gap: 14px;
  }
}

/* --- Keyframes --- */
@keyframes scrollPills {
  0% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(-50%);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeOutUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-30px);
  }
}
@keyframes pulseLoading {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
  .minimize-sidebar-button {
    display: none;
  }
  .close-sidebar-button {
    display: flex;
  }
  .mobile-sidebar-toggle {
    display: block;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    width: 80%;
    max-width: 300px;
    transform: translateX(-100%);
    transition: transform var(--transition-speed-slow) var(--transition-cubic);
    z-index: 1001;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--sidebar-bg);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed-slow) var(--transition-cubic);
  }

  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
  }

  .chat-container {
    margin-left: 0;
    width: 100%;
  }

  /* Sign-in prompt responsive */
  .signin-prompt-container {
    padding: 24px 28px;
  }
  .signin-prompt-container h2 {
    font-size: 1.3rem;
  }
  .signin-prompt-container p {
    font-size: 0.9rem;
    margin-bottom: 20px;
  }
}

@media (max-width: 480px) {
  :root {
    --container-padding: 10px;
    --sidebar-width: 240px;
  }
  .message {
    gap: 10px;
  }
  .message-icon-wrapper {
    width: 30px;
    height: 30px;
  }
  .message-content {
    padding-top: 0;
  }
  .user-message .message-content {
    padding: 8px 12px;
  }
  .ai-message .message-content {
    padding: 8px 12px;
  }
  .chat-messages-container {
    gap: 20px;
    padding: 0 10px;
  }
  .input-container {
    padding: 0 10px;
  }
  .input-wrapper {
    padding: 6px 6px 6px 12px;
    border-radius: var(--border-radius-md);
  }
  #message-input {
    font-size: 0.95rem;
    padding-top: 5px;
    padding-bottom: 5px;
    max-height: 120px;
  }
  .send-button {
    width: 32px;
    height: 32px;
    margin-left: 6px;
  }
  .disclaimer {
    font-size: 0.7rem;
    padding-top: 5px;
  }
  #initial-greeting {
    padding: 4vh var(--container-padding) 2vh;
  }
  .initial-greeting-text {
    margin-bottom: 20px;
  }
  .suggestion-scroll-viewport {
    margin-top: 15px;
    max-width: 95%; /* Slightly wider mask on very small screens */
  }
  .suggestion-pill {
    font-size: 0.8rem; /* Smaller font on mobile */
    padding: 8px 14px; /* Adjust padding */
    gap: 6px; /* Adjust gap */
  }
  .suggestion-pill i {
    font-size: 0.8rem; /* Adjust icon size */
  }

  /* Modal Responsive Adjustments */
  .modal-overlay {
    padding: 10px; /* Reduce padding for overlay on very small screens */
  }
  .modal {
    padding: 24px 20px; /* Reduce padding on small screens */
    max-height: calc(100vh - 20px); /* Adjust max height */
  }
  .modal-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
  }
  .modal-features-list {
    gap: 15px;
    margin-bottom: 24px;
  }
  .modal-features-list li {
    gap: 12px;
    font-size: 0.9rem;
  }
  .modal-icon {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }
  .modal-action-button {
    padding: 10px 16px;
    font-size: 0.95rem;
  }
  /* Removed snapshot popover responsive styles */

  /* Sign-in prompt responsive */
  .signin-prompt-overlay {
    padding: 10px;
  }
  .signin-prompt-container {
    padding: 20px 24px;
  }
  .signin-logo {
    height: 35px;
    margin-bottom: 15px;
  }
  .signin-prompt-container h2 {
    font-size: 1.2rem;
  }
  .signin-prompt-container p {
    font-size: 0.85rem;
    margin-bottom: 15px;
  }
}

/* --- Sidebar Footer --- */
.sidebar-footer li a.active {
  background-color: var(--hover-bg);
}
/* Add hover state for account button (can be used for sign out) */
#account-button:hover {
  background-color: var(--hover-bg);
}

/* User avatar styling */
.user-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-footer li a .user-avatar {
  width: 18px;
  height: 18px;
  margin-right: 0;
}

.app-layout.sidebar-minimized .sidebar-footer li a .user-avatar {
  width: 24px;
  height: 24px;
  margin: 0;
}

/* --- Settings Menu --- */
.settings-menu {
  position: fixed;
  z-index: 2000;
  background-color: rgba(26, 26, 26, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95);
  transition: opacity var(--transition-speed-slow) ease,
    visibility 0s linear var(--transition-speed-slow),
    transform var(--transition-speed-slow) var(--transition-cubic);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
  max-height: calc(90vh - 40px);

  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 360px;
  max-width: 90%;
  margin: 0 auto;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.settings-menu::-webkit-scrollbar {
  width: 3px;
}

.settings-menu::-webkit-scrollbar-track {
  background: transparent;
}

.settings-menu::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}

.settings-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity var(--transition-speed-slow) ease, visibility 0s linear 0s,
    transform var(--transition-speed-slow) var(--transition-cubic);
}

@media (max-height: 600px) {
  .settings-menu {
    max-height: 85vh;
  }

  .settings-menu-content {
    padding: 10px 14px;
  }

  .settings-section {
    margin-bottom: 12px;
  }

  .settings-section h4 {
    margin: 0 0 8px 0;
  }

  .settings-option {
    margin-bottom: 5px;
    padding: 4px 6px;
  }
}

.settings-menu-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background-color: rgba(20, 20, 20, 0.7);
  border-radius: 14px 14px 0 0;
}

.settings-menu-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-light);
  font-family: var(--font-title);
  letter-spacing: -0.01em;
}

.settings-close-button {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 3px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transition: all 0.15s ease;
}

.settings-close-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  transform: rotate(90deg);
}

.settings-menu-content {
  padding: 14px 16px;
}

.settings-section {
  margin-bottom: 16px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: rgba(255, 255, 255, 0.8);
  font-family: var(--font-title);
  border-left: 2px solid var(--accent-color);
  padding-left: 8px;
  letter-spacing: -0.01em;
}

.settings-option {
  margin-bottom: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.settings-option:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.settings-option:last-child {
  margin-bottom: 0;
}

.settings-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  cursor: pointer;
  padding: 4px 0;
}

.settings-toggle span {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
  flex-shrink: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: 0.3s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
  background-color: var(--accent-color);
  box-shadow: 0 0 0 1px var(--accent-color);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
  background-color: var(--button-text);
}

.settings-button {
  width: 100%;
  padding: 8px 14px;
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-button:after {
  content: "\f054";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
  margin-left: 8px;
}

.settings-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.settings-button:active {
  transform: translateY(0);
}

/* Responsive Adjustments for Settings Menu */
@media (max-width: 768px) {
  .settings-menu-header {
    padding: 10px 14px;
  }

  .settings-menu-content {
    padding: 12px 14px;
  }

  .settings-section {
    margin-bottom: 14px;
  }

  .settings-option {
    margin-bottom: 6px;
  }

  .settings-toggle span {
    font-size: 0.8rem;
  }

  .settings-button {
    padding: 7px 12px;
    font-size: 0.8rem;
  }

  .toggle-switch {
    width: 36px;
    height: 18px;
  }

  .toggle-slider:before {
    height: 12px;
    width: 12px;
  }

  input:checked + .toggle-slider:before {
    transform: translateX(18px);
  }
}

/* Typewriter cursor for greeting */
.type-cursor {
  display: inline-block;
  margin-left: 2px;
  color: var(--accent-color, #fff);
  font-weight: 600;
  font-size: 1em;
  opacity: 1;
  transition: opacity 0.4s;
  pointer-events: none;
  user-select: none;
}

/* --- Sidebar Chat Delete Button (Maximized) --- */
.delete-chat-btn {
  background: none;
  border: none;
  color: var(--icon-color);
  margin-left: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
}
.delete-chat-btn:hover {
  background: var(--hover-bg);
  color: #ea4335;
}
.delete-chat-btn i {
  pointer-events: none;
}

/* --- Context Menu Popup (Minimized Sidebar) --- */
.delete-context-menu {
  position: absolute;
  z-index: 3000; /* Above other elements */
  background: #181818;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  padding: 6px 0;
  min-width: 90px;
  animation: fadeIn 0.18s ease;
}
.delete-context-btn {
  background: none;
  border: none;
  color: #ea4335;
  font-size: 0.98rem;
  padding: 7px 18px 7px 12px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}
.delete-context-btn:hover {
  background: var(--hover-bg);
}
.delete-context-btn i {
  font-size: 1rem;
}

/* --- Mobile Delete Chat Button in Chat Header --- */
.mobile-delete-chat-btn {
  display: none;
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: #ea4335;
  font-size: 1.25rem;
  padding: 6px 8px;
  border-radius: 50%;
  z-index: 10;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mobile-delete-chat-btn:hover {
  background: rgba(234, 67, 53, 0.08);
  color: #fff;
}
.mobile-delete-chat-btn i {
  pointer-events: none;
}
@media (max-width: 768px) {
  .mobile-delete-chat-btn {
    display: block;
  }
  .chat-header {
    position: relative;
  }
}

/* Clear All button special hover effect */
#clear-all-button:hover {
  background-color: rgba(255, 77, 77, 0.1);
  color: #b87979; /* Changed from #ff6b6b to a softer muted red */
}

/* Clear All button icon color when sidebar is minimized */
.app-layout.sidebar-minimized #clear-all-button i {
  color: #b87979; /* Changed from #ff6b6b to a softer muted red */
}

/* Ensure Clear All button only appears in the sidebar on mobile */
@media (max-width: 768px) {
  #clear-all-button {
    display: flex; /* Ensure it's displayed in the sidebar */
  }

  /* Hide any instances of the clear all button outside the sidebar */
  .chat-container #clear-all-button {
    display: none;
  }
}

/* Override for mobile to keep the sidebar hidden when app-layout has sidebar-hidden */
@media (max-width: 768px) {
  .app-layout.sidebar-hidden .sidebar {
    margin-left: 0;
    transform: translateX(-100%) !important;
  }
}

/* --- Sign Out Confirmation Popup --- */
.confirmation-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 2100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.confirmation-backdrop.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0s linear 0s;
}

.confirmation-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background-color: rgba(26, 26, 26, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  z-index: 2200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s,
    transform 0.3s var(--transition-cubic);
  width: 300px;
  max-width: 90%;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.confirmation-popup.visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 0.3s ease, visibility 0s linear 0s,
    transform 0.3s var(--transition-cubic);
}

.confirmation-popup-content {
  padding: 20px;
}

.confirmation-popup h3 {
  margin: 0 0 15px 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-light);
}

.confirmation-popup p {
  margin: 0 0 20px 0;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.confirmation-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.confirmation-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.cancel-btn {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.cancel-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.confirm-btn {
  background-color: #ea4335;
  color: white;
}

.confirm-btn:hover {
  background-color: #d33426;
  transform: translateY(-1px);
}

.confirm-btn:active {
  transform: translateY(0);
}

@media (max-width: 480px) {
  .confirmation-popup {
    width: 280px;
  }

  .confirmation-popup-content {
    padding: 18px;
  }

  .confirmation-popup h3 {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  .confirmation-popup p {
    font-size: 0.9rem;
    margin-bottom: 18px;
  }

  .confirmation-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
  }
}

/* Market Snapshot Button */
.market-snapshot-button {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: 18px; /* Keep rounded */
  height: 36px; /* Keep height */
  padding: 0 12px; /* Keep padding */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px; /* Keep gap */
  font-size: 0.9rem; /* Keep font size */
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  z-index: 10;
  backdrop-filter: blur(5px); /* Keep blur */
  -webkit-backdrop-filter: blur(5px);
}

.market-snapshot-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.08); /* Keep background */
  border-radius: 18px; /* Keep rounded */
  z-index: -1;
  transition: all var(--transition-speed) ease;
}

.market-snapshot-button:hover {
  color: var(--text-light);
  transform: translateY(-50%) scale(1.03); /* Keep hover scale */
}

.market-snapshot-button:hover::before {
  background: rgba(255, 255, 255, 0.15); /* Keep hover background */
}

.market-snapshot-button:active {
  transform: translateY(-50%) scale(0.97); /* Keep active scale */
}

.market-snapshot-button i {
  font-size: 0.9rem; /* Keep icon size */
  color: var(--text-light); /* Keep icon color */
}

.market-snapshot-button span {
  /* Span styling removed as it's hidden by default on mobile */
  display: none; /* Hide text by default */
}

/* Show span on desktop */
@media (min-width: 769px) {
  .market-snapshot-button span {
    display: inline; /* Show text on desktop */
    font-weight: 500;
    letter-spacing: 0.01em;
    background: var(--modal-gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

@media (max-width: 768px) {
  .market-snapshot-button {
    right: 10px;
    width: 34px; /* Keep mobile size */
    height: 34px; /* Keep mobile size */
    padding: 0; /* Keep mobile padding */
  }

  .market-snapshot-button span {
    display: none; /* Ensure span is hidden on mobile */
  }

  .market-snapshot-button i {
    font-size: 1rem; /* Keep mobile icon size */
  }

  .market-snapshot-button::before {
    border-radius: 50%; /* Keep mobile border radius */
  }
}

/* --- Market Snapshot Modal Styles --- */

/* Enhanced modal overlay */
#market-snapshot-modal {
  /* Inherits .modal-overlay styles which are fine */
}

/* Enhanced base modal style */
#market-snapshot-modal .modal {
  background: rgba(16, 16, 16, 0.85); /* Darker, less transparent base */
  backdrop-filter: blur(15px); /* Increase blur */
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.12); /* Slightly more visible border */
  border-radius: var(--border-radius-lg); /* Use larger radius */
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35); /* Deeper shadow */
  max-width: 600px; /* Increase max width slightly */
  padding: 28px 35px; /* Adjust padding */
  max-height: 85vh; /* Limit height - Adjusted */
  overflow: hidden; /* Hide main modal overflow */
  display: flex;
  flex-direction: column;
  /* Add transition for the modal appearance itself */
  transition: opacity var(--transition-speed-slow) ease,
    transform var(--transition-speed-slow) var(--transition-cubic);
}

/* Add fade-in for the modal overlay */
#market-snapshot-modal {
  transition: opacity var(--transition-speed-slow) ease,
    visibility 0s linear var(--transition-speed-slow);
}
#market-snapshot-modal.visible {
  transition: opacity var(--transition-speed-slow) ease, visibility 0s linear 0s;
}
#market-snapshot-modal.visible .modal {
  /* Ensure modal animates in with the overlay */
  transform: scale(1) translateY(0);
  opacity: 1;
}

#market-snapshot-modal .modal-title {
  font-size: 1.6rem; /* Increase title size */
  font-weight: 600;
  margin-bottom: 24px; /* More space below title */
  text-align: center;
  color: var(--text-light); /* Brighter title */
  font-family: var(--font-title);
  flex-shrink: 0; /* Prevent title shrinking */
}

#market-snapshot-modal .gradient-text {
  /* Use a more subtle gradient for the title */
  background: linear-gradient(120deg, #eaeaeb 30%, #b0b0b5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Content area with custom scrollbar */
#market-snapshot-modal .snapshot-content {
  flex-grow: 1; /* Allow content to take available space */
  overflow-y: auto; /* Enable vertical scroll */
  padding: 10px 20px 10px 4px; /* Add padding, more on right for scrollbar */
  margin-right: -16px; /* Offset scrollbar padding */
  display: flex;
  flex-direction: column;
  gap: 20px; /* Increase gap between sections */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent; /* Custom scrollbar color */
}

#market-snapshot-modal .snapshot-content::-webkit-scrollbar {
  width: 5px;
}

#market-snapshot-modal .snapshot-content::-webkit-scrollbar-track {
  background: transparent;
  margin: 10px 0;
}

#market-snapshot-modal .snapshot-content::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 5px;
}

#market-snapshot-modal .snapshot-content::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

/* Section styling with entrance animation */
#market-snapshot-modal .snapshot-section {
  background-color: rgba(
    255,
    255,
    255,
    0.04
  ); /* Very subtle section background */
  border-radius: var(--border-radius-md); /* Consistent radius */
  padding: 18px 20px; /* Adjust section padding */
  border: 1px solid rgba(255, 255, 255, 0.08); /* Subtle border */
  /* Add subtle inner shadow for depth */
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: background-color var(--transition-speed) ease,
    border-color var(--transition-speed) ease, opacity 0.4s ease,
    transform 0.4s ease;
  margin-bottom: 0; /* Remove margin, use gap in parent */
  transform: translateY(10px); /* Start slightly lower for animation */
  opacity: 0; /* Start hidden for animation */
}

/* Staggered animation for sections */
#market-snapshot-modal.visible .snapshot-section {
  opacity: 1;
  transform: translateY(0);
}
#market-snapshot-modal.visible .snapshot-section:nth-child(1) {
  transition-delay: 0.05s;
}
#market-snapshot-modal.visible .snapshot-section:nth-child(2) {
  transition-delay: 0.1s;
}
#market-snapshot-modal.visible .snapshot-section:nth-child(3) {
  transition-delay: 0.15s;
}
/* Add more if needed */

#market-snapshot-modal .snapshot-section:hover {
  background-color: rgba(255, 255, 255, 0.06); /* Slightly lighter on hover */
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(0); /* Reset transform on hover */
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); /* Keep inner shadow */
}

#market-snapshot-modal .snapshot-section-title {
  font-size: 1.05rem; /* Adjust title size */
  font-weight: 500; /* Medium weight */
  margin-bottom: 14px; /* Adjust space below title */
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary); /* Use primary text color */
  border-bottom: 1px solid rgba(255, 255, 255, 0.06); /* Add subtle separator */
  padding-bottom: 8px;
}

#market-snapshot-modal .snapshot-section-title i {
  font-size: 1rem; /* Adjusted icon size */
  color: var(--accent-color); /* White icon color */
  background: rgba(255, 255, 255, 0.08); /* Use icon background from root */
  width: 28px; /* Consistent size */
  height: 28px;
  border-radius: 8px; /* Rounded square */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background-color 0.2s ease; /* Add icon transition */
}

#market-snapshot-modal .snapshot-section:hover .snapshot-section-title i {
  transform: scale(1.05); /* Slight scale on section hover */
  background-color: rgba(255, 255, 255, 0.1);
}

/* News List */
#market-snapshot-modal .snapshot-news-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px; /* Space between news items */
}

#market-snapshot-modal .snapshot-news-list li {
  display: flex;
  align-items: center; /* Vertically center time and headline */
  padding: 8px 10px; /* Adjust item padding */
  border-radius: var(--border-radius-sm); /* Smaller radius for items */
  background: rgba(0, 0, 0, 0.15); /* Darker item background */
  border: none; /* Remove item border */
  transition: background-color var(--transition-speed) ease,
    transform 0.15s ease; /* Add transform transition */
  gap: 10px; /* Space between time and headline */
}

#market-snapshot-modal .snapshot-news-list li:hover {
  background: rgba(0, 0, 0, 0.25); /* Darker hover */
  transform: scale(1.015); /* Subtle scale on hover */
}

/* Snapshot News Time */
#market-snapshot-modal .snapshot-news-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background-color: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 10px; /* Pill shape */
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

#market-snapshot-modal .snapshot-news-headline {
  font-size: 0.9rem; /* Slightly larger headline */
  color: var(--text-primary);
  line-height: 1.4; /* Adjust line height */
  font-weight: 400; /* Regular weight */
}

/* Footer styling */
#market-snapshot-modal .snapshot-footer {
  display: flex;
  justify-content: space-between; /* Space out disclaimer and timestamp */
  align-items: center;
  margin-top: 18px; /* More space above footer */
  /* Subtle gradient border */
  border-top: 1px solid;
  border-image-slice: 1;
  border-image-source: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0.05)
  );
  padding-top: 14px;
  font-size: 0.8rem; /* Adjust font size */
  color: var(--text-secondary);
  flex-shrink: 0; /* Prevent footer shrinking */
}

#market-snapshot-modal .snapshot-disclaimer {
  margin: 0;
  text-align: left; /* Align left */
  opacity: 0.8; /* Slightly more opaque */
}

#market-snapshot-modal .snapshot-timestamp {
  margin: 0;
  font-variant-numeric: tabular-nums;
  background: none; /* Remove background */
  padding: 0; /* Remove padding */
  font-weight: 400; /* Regular weight */
  text-align: right; /* Align right */
}

/* Top Movers */
#market-snapshot-modal .movers-container {
  display: grid; /* Use grid for better alignment */
  grid-template-columns: 1fr 1fr; /* Equal columns */
  gap: 20px; /* Increase gap */
}

#market-snapshot-modal .movers-column {
  /* Column styling handled by grid */
}

#market-snapshot-modal .movers-header {
  font-size: 0.9rem; /* Slightly larger header */
  font-weight: 600;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* More visible border */
  text-transform: uppercase;
  letter-spacing: 0.08em; /* More spacing */
  text-align: center;
}

#market-snapshot-modal .movers-header.up {
  /* Keep gradient */
}

#market-snapshot-modal .movers-header.down {
  /* Keep gradient */
}

#market-snapshot-modal .movers-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px; /* Space between movers */
}

#market-snapshot-modal .movers-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 4px; /* Adjust padding slightly */
  font-size: 0.9rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05); /* Dashed subtle separator */
  border-radius: 4px; /* Add small radius */
  transition: background-color var(--transition-speed) ease,
    transform 0.15s ease; /* Add transitions */
}

#market-snapshot-modal .movers-list li:hover {
  background-color: rgba(255, 255, 255, 0.04); /* Subtle hover background */
  transform: scale(1.015); /* Subtle scale */
}

#market-snapshot-modal .movers-list li:last-child {
  border-bottom: none;
}

#market-snapshot-modal .ticker {
  font-weight: 500; /* Medium weight */
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* Change color styles */
#market-snapshot-modal .change {
  font-weight: 600;
  font-variant-numeric: tabular-nums; /* Align numbers */
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: background-color 0.2s ease, color 0.2s ease; /* Add transition */
}
#market-snapshot-modal .change.up {
  color: #34a853;
  background-color: rgba(52, 168, 83, 0.1); /* Subtle green background */
}
#market-snapshot-modal .change.down {
  color: #ea4335;
  background-color: rgba(234, 67, 53, 0.1); /* Subtle red background */
}

/* Close Button */
#snapshot-close-button {
  position: absolute;
  top: 14px; /* Adjust position */
  right: 16px; /* Adjust position */
  background: rgba(255, 255, 255, 0.06); /* Subtle background */
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 1rem; /* Adjust size */
  cursor: pointer;
  padding: 0;
  line-height: 1;
  border-radius: 50%;
  width: 30px; /* Adjust size */
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-speed) ease,
    color var(--transition-speed) ease,
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); /* Springy transition */
}

#snapshot-close-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  transform: scale(1.1) rotate(90deg); /* Combine scale and rotation */
}

#snapshot-close-button:active {
  transform: scale(0.95) rotate(90deg);
}

/* --- Removed Market Trends Chart Specific Styles --- */
/* Placeholder if charts are added later */
.trend-chart {
  height: 50px; /* Example height */
  background-color: rgba(255, 255, 255, 0.05); /* Placeholder */
  border-radius: 4px;
  margin-top: 8px;
}

/* Responsive tweaks for snapshot modal */
@media (max-width: 768px) {
  #market-snapshot-modal .modal {
    max-width: 95%;
    padding: 24px 28px; /* Keep horizontal padding */
    /* Use a smaller max-height, leaving more space for browser UI */
    /* Use calc to account for overlay padding (20px * 2 = 40px) */
    max-height: calc(100vh - 60px); /* Reduced max height */
    max-height: calc(100dvh - 60px); /* Use dvh for dynamic viewport height */
  }
  #market-snapshot-modal .modal-title {
    font-size: 1.4rem;
    margin-bottom: 20px;
  }
  #market-snapshot-modal .snapshot-content {
    padding: 5px 15px 5px 2px;
    margin-right: -13px;
    gap: 16px;
  }
  #market-snapshot-modal .snapshot-section {
    padding: 16px 18px;
  }
  #market-snapshot-modal .snapshot-section-title {
    font-size: 1rem;
    gap: 8px;
  }
  #market-snapshot-modal .snapshot-section-title i {
    width: 26px;
    height: 26px;
    font-size: 0.9rem;
  }
  #market-snapshot-modal .snapshot-footer {
    flex-direction: column;
    gap: 8px;
    align-items: center;
    padding-top: 12px;
    margin-top: 16px;
    font-size: 0.75rem;
    border-image: none; /* Remove gradient border on mobile */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  #market-snapshot-modal .snapshot-disclaimer,
  #market-snapshot-modal .snapshot-timestamp {
    text-align: center;
  }
  #snapshot-close-button {
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 480px) {
  #market-snapshot-modal .modal {
    padding: 20px 22px; /* Keep horizontal padding */
    /* Further reduce max-height for very small screens */
    /* Use calc to account for overlay padding (10px * 2 = 20px) */
    max-height: calc(100vh - 40px); /* Reduced max height */
    max-height: calc(100dvh - 40px); /* Use dvh for dynamic viewport height */
  }
  #market-snapshot-modal .modal-title {
    font-size: 1.3rem;
    margin-bottom: 16px;
  }
  #market-snapshot-modal .snapshot-content {
    padding: 5px 10px 5px 2px;
    margin-right: -8px;
    gap: 14px;
  }
  #market-snapshot-modal .snapshot-section {
    padding: 14px 16px;
    box-shadow: none; /* Ensure no shadow on mobile */
  }
  #market-snapshot-modal .snapshot-section-title {
    font-size: 0.95rem;
  }
  #market-snapshot-modal .movers-container {
    grid-template-columns: 1fr; /* Stack movers columns */
    gap: 16px;
  }
  #market-snapshot-modal .movers-header {
    font-size: 0.85rem;
  }
  #market-snapshot-modal .movers-list li {
    font-size: 0.85rem;
    padding: 4px 2px; /* Adjust padding */
    transform: none; /* Disable hover scale on mobile */
  }
  #market-snapshot-modal .movers-list li:hover {
    background-color: transparent; /* Disable hover bg on mobile */
    transform: none;
  }
  #market-snapshot-modal .change {
    font-size: 0.8rem;
    padding: 2px 5px;
  }
  #market-snapshot-modal .snapshot-news-headline {
    font-size: 0.85rem;
  }
  #market-snapshot-modal .snapshot-news-time {
    font-size: 0.7rem;
    padding: 2px 6px;
  }
  #market-snapshot-modal .snapshot-news-list li:hover {
    transform: none; /* Disable hover scale on mobile */
  }
}

/* Fallback if JS doesn't add .visible quickly enough */
#market-snapshot-modal:not(.visible) .snapshot-section {
  opacity: 0;
}

/* Add styles for the trend charts */
#market-snapshot-modal .trend-chart {
  height: 45px; /* Height for the sparkline */
  width: 100%; /* Take full width */
  margin-top: 8px;
  overflow: hidden; /* Hide any overflow */
}

#market-snapshot-modal .trend-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

#market-snapshot-modal .trend-chart polyline {
  fill: none;
  stroke-width: 2; /* Line thickness */
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Specific stroke colors based on up/down class of the parent trend item */
#market-snapshot-modal .trend-item.up .trend-chart polyline {
  stroke: #34a853; /* Green for up */
  /* Optional: Add a subtle gradient fill */
  /* fill: url(#gradient-up); */
}

#market-snapshot-modal .trend-item.down .trend-chart polyline {
  stroke: #ea4335; /* Red for down */
  /* Optional: Add a subtle gradient fill */
  /* fill: url(#gradient-down); */
}

/* Default stroke color if no class (or add neutral class later) */
#market-snapshot-modal .trend-item:not(.up):not(.down) .trend-chart polyline {
  stroke: var(--text-secondary); /* Grey for neutral */
}

/* Market Trends Section */
#market-snapshot-modal .market-trends {
  display: flex;
  flex-direction: column;
  gap: 15px; /* Space between trend items */
}

#market-snapshot-modal .trend-item {
  background-color: rgba(0, 0, 0, 0.1); /* Subtle background for each item */
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.2s ease;
}

#market-snapshot-modal .trend-item:hover {
  background-color: rgba(0, 0, 0, 0.2);
}

#market-snapshot-modal .trend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  margin-bottom: 5px;
}

#market-snapshot-modal .trend-name {
  font-weight: 500;
  color: var(--text-primary);
}

#market-snapshot-modal .trend-value {
  font-weight: 500;
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
}

/* Footer styling */
#market-snapshot-modal .snapshot-footer {
  display: flex;
  justify-content: space-between; /* Space out disclaimer and timestamp */
  align-items: center;
  margin-top: 18px; /* More space above footer */
  /* Subtle gradient border */
  border-top: 1px solid;
  border-image-slice: 1;
  border-image-source: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0.05)
  );
  padding-top: 14px;
  font-size: 0.8rem; /* Adjust font size */
  color: var(--text-secondary);
  flex-shrink: 0; /* Prevent footer shrinking */
}
