/* Universal box-sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Design System Variables */
:root {
  /* Colors */
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  --primary: 142 76% 36%;
  --primary-foreground: 355.7 100% 97.3%;
  --primary-dark: 142 76% 28%;
  --secondary: 210 40% 98%;
  --secondary-foreground: 222.2 84% 4.9%;
  --muted: 210 40% 98%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --accent: 210 40% 98%;
  --accent-foreground: 222.2 84% 4.9%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 142 76% 36%;
  --radius: 0.5rem;

  /* Gradients */
  --gradient-hero: linear-gradient(135deg, hsl(142 76% 36%), hsl(142 76% 28%));
  --gradient-subtle: linear-gradient(180deg, hsl(0 0% 100%), hsl(210 40% 98%));

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-elevated: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);

  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;
  --popover: 222.2 84% 4.9%;
  --popover-foreground: 210 40% 98%;
  --primary: 142 76% 36%;
  --primary-foreground: 355.7 100% 97.3%;
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 142 76% 36%;
}

/* Dark mode body background */
.dark body {
  background: #0a0a0a;
}

/* Dark mode prompt cards */
.dark .prompt-card {
  background-color: hsl(var(--card));
  border-color: hsl(var(--border) / 0.3);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.dark .prompt-card:hover {
  background-color: hsl(var(--card));
  box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

/* Dark mode AI response messages */
.dark .message-group.assistant .message-content {
  background-color: hsl(var(--primary) / 0.15);
  border-color: hsl(var(--primary) / 0.3);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.dark .message-group.assistant .message-content:hover {
  background-color: hsl(var(--primary) / 0.2);
  box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

/* Dark mode floating input */
.dark .floating-input {
  background-color: hsl(var(--background));
  border-color: hsl(var(--border));
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Dark mode text colors */
.dark .text-foreground {
  color: hsl(var(--foreground));
}

.dark .text-muted-foreground {
  color: hsl(var(--muted-foreground));
}

.dark .text-primary {
  color: hsl(var(--primary));
}

/* Dark mode header text */
.dark header {
  color: hsl(var(--foreground));
}

.dark header .btn {
  color: hsl(var(--foreground));
}

.dark header .btn i {
  color: hsl(var(--foreground));
}

/* Dark mode toggle button */
.theme-toggle {
  background: none;
  border: 1px solid hsl(var(--border));
  border-radius: 0.375rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--foreground));
}

.theme-toggle:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.theme-toggle i {
  width: 1rem;
  height: 1rem;
}

/* Dark mode header button styling */
.dark .btn-outline {
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

.dark .btn-outline:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.dark .theme-toggle {
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

.dark .theme-toggle:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-color: hsl(var(--border));
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.5;
  color: hsl(var(--foreground));
  background: #f8f9fa;
  background-image: url('nh-fall-leaves-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  box-sizing: border-box;
}

.flex {
  display: flex;
}

.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.flex-1 {
  flex: 1;
}

.text-center {
  text-align: center;
}

/* Sizing */
.w-3 { width: 0.75rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-10 { width: 2.5rem; }
.w-12 { width: 3rem; }

.h-3 { height: 0.75rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-8 { height: 2rem; }
.h-10 { height: 2.5rem; }
.h-12 { height: 3rem; }

.min-h-screen {
  min-height: 100vh;
}

.min-h-400 {
  min-height: 400px;
}

.max-h-600 {
  max-height: 600px;
}

/* Spacing */
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }

.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }

.mx-auto { margin-left: auto; margin-right: auto; }

/* Colors */
.bg-background {
  background-color: hsl(var(--background));
}

.bg-card {
  background-color: hsl(var(--card));
}

.bg-gradient-hero {
  background: var(--gradient-hero);
}

.bg-background\/90 {
  background-color: hsl(var(--background) / 0.9);
}

.bg-card\/50 {
  background-color: hsl(var(--card) / 0.5);
}

.text-foreground {
  color: hsl(var(--foreground));
}

.text-muted-foreground {
  color: hsl(var(--muted-foreground));
}

.text-primary {
  color: hsl(var(--primary));
}

.text-white {
  color: white;
}

.text-muted-foreground\/50 {
  color: hsl(var(--muted-foreground) / 0.5);
}

/* Typography */
.text-xs {
  font-size: 0.75rem;
  line-height: 1rem;
}

.text-sm {
  font-size: clamp(0.8rem, 2.5vw, 0.875rem);
  line-height: clamp(1.1rem, 3vw, 1.25rem);
}

.text-3xl {
  font-size: clamp(1.5rem, 4vw, 1.875rem);
  line-height: clamp(1.75rem, 4.5vw, 2.25rem);
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

/* Borders */
.border {
  border-width: 1px;
}

.border-b {
  border-bottom-width: 1px;
}

.border-t {
  border-top-width: 1px;
}

.border-border\/50 {
  border-color: hsl(var(--border) / 0.5);
}

.rounded-full {
  border-radius: 9999px;
}

.rounded-lg {
  border-radius: 0.5rem;
}

/* Position */
.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.sticky {
  position: sticky;
}

.inset-0 {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.top-0 {
  top: 0;
}

.z-10 {
  z-index: 10;
}

.z-40 {
  z-index: 40;
}

/* Backdrop */
.backdrop-blur-sm {
  backdrop-filter: blur(4px);
}

.backdrop-blur-\[0\.5px\] {
  backdrop-filter: blur(0.5px);
}

/* Overflow */
.overflow-y-auto {
  overflow-y: auto;
}

/* Max Width */
.max-w-2xl {
  max-width: 42rem;
}

.max-w-4xl {
  max-width: 56rem;
}

/* Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition-smooth);
  cursor: pointer;
  border: none;
  text-decoration: none;
  outline: none;
}

.btn:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.btn-default {
  height: 2.5rem;
  padding: 0.5rem 1rem;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-sm);
}

.btn-default:hover {
  background-color: hsl(var(--primary-dark));
  box-shadow: var(--shadow-elevated);
}

.btn-outline {
  height: 2.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
}

.btn-outline:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.btn-link {
  color: hsl(var(--primary));
  text-decoration: underline;
  text-underline-offset: 4px;
  background: transparent;
  padding: 0;
  height: auto;
}

.btn-link:hover {
  text-decoration: none;
}

.btn-sm {
  height: 2.25rem;
  border-radius: 0.375rem;
  padding: 0 0.75rem;
}

.input {
  display: flex;
  height: 2.5rem;
  width: 100%;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  transition: var(--transition-smooth);
  outline: none;
}


/* Floating input styles */
.floating-input {
  position: fixed;
  bottom: 10px;
  left: 10px;
  right: 10px;
  z-index: 50;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
}

.floating-input .input {
  border: 1px solid hsl(var(--border) / 0.3);
  background: transparent;
  border-radius: 20px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.floating-input .btn {
  border-radius: 0.5rem;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

/* Mobile floating input adjustments */
@media (max-width: 768px) {
  
  .floating-input {
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 0.375rem;
    gap: 0.375rem;
  }
  
  .floating-input .input {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
  }
  
  .floating-input .btn {
    width: 2.25rem;
    height: 2.25rem;
    margin-left: 0.375rem;
  }
}

@media (max-width: 480px) {
  
  .floating-input {
    left: 6px;
    right: 6px;
    bottom: 6px;
    padding: 0.25rem;
    gap: 0.25rem;
  }
  
  .floating-input .input {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
  }
  
  .floating-input .btn {
    width: 2rem;
    height: 2rem;
    margin-left: 0.25rem;
  }
}

/* Adjust messages container when floating input is active */
.messages-container-floating {
  padding-bottom: 80px;
}

/* Ensure example questions remain visible when floating input is active */
#suggested-prompts {
  position: relative;
  z-index: 10;
  margin-bottom: 100px; /* Add space for floating input */
}

/* Desktop: Always show blue border for input field only */
@media (min-width: 768px) {
  #message-input.input {
    border: 1px solid hsl(214 95% 50%) !important; /* Blue border */
    box-shadow: 0 0 0 1px hsl(214 95% 50% / 0.2) !important; /* Subtle blue glow */
  }
}


.input:hover {
  border-color: hsl(var(--border));
  box-shadow: 0 0 0 1px hsl(var(--border) / 0.5);
}

.input:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.input::placeholder {
  color: hsl(var(--muted-foreground));
}

/* Base styles (applies to all sizes unless overridden) - only for logo images */
.text-center img.w-12.h-12 {
  width: auto !important; /* Use native width */
  height: auto !important; /* Use native height */
  max-width: 100% !important; /* Fit within parent container */
  object-fit: contain !important; /* Preserve aspect ratio */
  display: block !important; /* Ensure proper alignment */
  margin: 0 auto !important; /* Center horizontally */
}

/* Extra Large Screens (min-width: 1280px) - e.g., 4K monitors */
@media (min-width: 1280px) {
  .text-center img.w-12.h-12 {
    max-width: 600px !important; /* Cap at estimated native width */
    height: auto !important;
  }
}

/* Large Screens (min-width: 1024px) - e.g., tablets in landscape */
@media (min-width: 1024px) and (max-width: 1279px) {
  .text-center img.w-12.h-12 {
    max-width: 500px !important; /* Slightly reduced for large tablets */
    height: auto !important;
  }
}

/* Medium Screens (min-width: 768px) - e.g., tablets in portrait, small laptops */
@media (min-width: 768px) and (max-width: 1023px) {
  .text-center img.w-12.h-12 {
    max-width: 400px !important; /* Scaled for medium screens */
    height: auto !important;
  }
}

/* Small Screens (min-width: 481px) - e.g., larger phones in landscape */
@media (min-width: 481px) and (max-width: 767px) {
  .text-center img.w-12.h-12 {
    max-width: 350px !important; /* Fit within typical phone landscape (e.g., 600px) */
    height: auto !important;
  }
}

/* Extra Small Screens (max-width: 480px) - e.g., iPhone SE (375px) */
@media (max-width: 480px) {
  .text-center img.w-12.h-12 {
    width: 100% !important; /* Full width of container (up to 375px) */
    height: auto !important; /* Maintain aspect ratio */
    max-width: 375px !important; /* Match iPhone SE viewport */
    margin: 0 auto !important;
    display: block !important;
  }
  .text-center {
    overflow: visible !important; /* Prevent clipping */
    padding: 0 0.5rem !important; /* Match container padding */
  }
  .container {
    overflow: visible !important; /* Prevent clipping */
    max-width: 100% !important;
    padding: 0 0.5rem !important;
  }
}

.prompt-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 1px solid hsl(var(--border) / 0.3);
  border-radius: 12px;
  background-color: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  text-align: center;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.prompt-card p {
  text-align: center;
  margin: 0;
}

.prompt-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, hsl(var(--primary) / 0.05), hsl(var(--primary) / 0.02));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.prompt-card:hover {
  background-color: #ffffff;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  border-color: hsl(var(--primary) / 0.3);
}

.prompt-card:hover::before {
  opacity: 1;
}

.prompt-card:active {
  transform: translateY(-1px) scale(1.01);
  transition: all 0.1s ease;
}

/* Chat Interface Styles */
.message-group {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.message-group.user {
  align-items: flex-end;
}

.message-group.assistant {
  align-items: flex-start;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.message-sender {
  display: none; /* Hide the sender text completely */
}

.message-timestamp {
  display: none; /* Hide timestamps completely */
}

.message-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message-group.user .message-avatar {
  background-color: hsl(var(--primary));
  color: white;
}

.message-group.assistant .message-avatar {
  background: var(--gradient-hero);
  color: white;
}

.messages-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* GROK-LIKE SCROLLING: Smooth scrolling improvements */
#messages-container {
  scroll-behavior: smooth;
  scrollbar-width: thin;
}

#messages-container::-webkit-scrollbar {
  width: 6px;
}

#messages-container::-webkit-scrollbar-thumb {
  background-color: hsl(var(--muted-foreground) / 0.3);
  border-radius: 3px;
}

#messages-container::-webkit-scrollbar-thumb:hover {
  background-color: hsl(var(--muted-foreground) / 0.5);
}

.message-content {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border) / 0.5);
  max-width: 80%;
  word-wrap: break-word;
  line-height: 1.6;
}

.message-group.user .message-content {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
  font-weight: 500;
}

.message-group.assistant .message-content {
  background-color: hsl(var(--primary) / 0.1);
  color: hsl(var(--foreground));
  border-color: hsl(var(--primary) / 0.2);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.message-group.assistant .message-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, hsl(var(--primary) / 0.05), hsl(var(--primary) / 0.02));
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.message-group.assistant .message-content:hover {
  background-color: hsl(var(--primary) / 0.15);
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  border-color: hsl(var(--primary) / 0.3);
}

.message-group.assistant .message-content:hover::before {
  opacity: 1;
}

/* Add margin to lists in assistant messages */
.message-group.assistant .message-content ul,
.message-group.assistant .message-content ol {
  margin-left: 1rem;
  margin-right: 0.5rem;
  padding-left: 1rem;
}

.message-group.assistant .message-content li {
  margin-bottom: 0.25rem;
}

/* Link styling for assistant messages */
.message-group.assistant .message-content a {
  color: hsl(var(--primary));
  text-decoration: underline;
  text-decoration-color: hsl(var(--primary) / 0.5);
  transition: all 0.2s ease;
}

.message-group.assistant .message-content a:hover {
  color: hsl(var(--primary-dark));
  text-decoration-color: hsl(var(--primary-dark));
  text-decoration-thickness: 2px;
}

/* Add visual indicator for external links */
.message-group.assistant .message-content a[target="_blank"]::after {
  content: " ↗";
  font-size: 0.8em;
  opacity: 0.7;
  margin-left: 0.2em;
}

/* Styling for response separators */
.message-group.assistant .message-content hr {
  border: none;
  border-top: 1px solid hsl(var(--border));
  margin: 1.5rem 0;
  opacity: 0.5;
}

/* Message states */
.message-state {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.message-state.sending {
  color: hsl(var(--muted-foreground));
}

.message-state.streaming {
  color: hsl(var(--primary));
}

.message-state.failed {
  color: hsl(var(--destructive));
}

.streaming-dots {
  display: flex;
  gap: 0.25rem;
}

.streaming-dots span {
  width: 0.25rem;
  height: 0.25rem;
  border-radius: 50%;
  background-color: currentColor;
  animation: pulse 1.5s ease-in-out infinite;
}

.streaming-dots span:nth-child(2) {
  animation-delay: 0.1s;
}

.streaming-dots span:nth-child(3) {
  animation-delay: 0.2s;
}

/* Message actions */
.message-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message-content:hover .message-actions {
  opacity: 1;
}

.message-action {
  background: none;
  border: none;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: color 0.2s ease;
}

.message-action:hover {
  color: hsl(var(--foreground));
  background-color: hsl(var(--accent));
}

/* Long message collapse - disabled */

/* Responsive Design */
@media (min-width: 768px) {
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Header styling */
header {
  width: 100% !important;
}

.header-buttons {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 0.5rem !important;
  width: 100% !important;
  margin-left: auto !important;
}

/* Force right alignment with additional specificity */
header .header-buttons {
  display: flex !important;
  justify-content: flex-end !important;
  margin-left: auto !important;
  width: 100% !important;
}

/* Header button styling */
#new-chat-btn {
  padding: 0.5rem;
  min-width: auto;
}

#new-chat-btn:hover {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

/* Base viewport and overflow control */
body {
  overflow-x: hidden !important;
  margin: 0 !important;
}

/* Input focus styling to prevent layout shifts */
input, textarea {
  border: 1px solid hsl(var(--border)) !important;
  box-sizing: border-box !important;
  outline: none !important;
  width: 100% !important;
}

/* Specific rule for message input to ensure visibility */
#message-input {
  border: 1px solid hsl(var(--border)) !important;
  background-color: hsl(var(--background)) !important;
}

/* Even more specific rule for mobile */
@media (max-width: 768px) {
  #message-input.input {
    border: 1px solid hsl(var(--border)) !important;
    background-color: hsl(var(--background)) !important;
  }
}

/* Dark mode input styling */
.dark #message-input {
  color: hsl(var(--foreground)) !important;
  background-color: hsl(var(--background)) !important;
  border-color: hsl(var(--border)) !important;
}

.dark #message-input::placeholder {
  color: hsl(var(--muted-foreground)) !important;
}

input:focus, textarea:focus {
  border-color: #007AFF !important; /* iOS blue for consistency */
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.3) !important; /* Accessible focus indicator */
}

/* Logo and container adjustments */
.text-center {
  width: 100% !important;
  margin: 0 auto !important;
  padding: 0 0.5rem !important;
}
.text-center img {
  max-width: 100% !important;
  height: auto !important;
  margin-bottom: 1rem !important;
}

/* Mobile keyboard and layout adjustments */
@media (max-width: 768px) {
  .container {
    max-width: 100% !important;
    padding: 0 0.5rem !important;
  }
  
  /* Improve touch targets */
  .btn, .prompt-card, .theme-toggle {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Better spacing for mobile */
  .py-16 {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  
  /* Optimize header spacing */
  header {
    padding: 0.75rem 1rem;
  }
  
}

/* Mobile header adjustments */
@media (max-width: 640px) {
  /* Optimize button sizes for mobile usability */
  .btn-default,
  .btn-outline {
    height: 3rem;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
  }
  
  .btn-sm {
    height: 1.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
  
  /* Optimize input field size */
  .input {
    height: 3rem;
    font-size: 0.8rem;
    padding: 0.75rem 1rem;
  }
  
  /* Prevent iOS auto-zoom on input focus */
  #message-input,
  .input {
    font-size: 16px !important;
  }
  
  /* Adjust main heading size */
  .text-3xl {
    font-size: 1.5rem;
    line-height: 1.75rem;
  }
  
  
  .text-center img {
    max-width: 100% !important; /* Full container width */
    height: auto !important;    /* Maintain aspect ratio */
    margin-bottom: 1rem !important; /* Consistent spacing */
  }
  
  /* Adjust section padding */
  .py-16 {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  
  /* Optimize container padding */
  .container {
    padding: 0 0.75rem !important;
    max-width: 100% !important;
  }
  
  /* Adjust message container */
  #messages-container {
    padding: 1rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-height: 200px;
    max-height: 400px;
  }
  
  /* Optimize prompt card and message content */
  .prompt-card {
    padding: 0.75rem;
    font-size: 0.8rem;
  }
  
  .message-content {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
  
  /* Adjust footer padding */
  footer {
    padding: 1.5rem 0;
  }
  
  /* Reduce icon sizes in buttons */
  .btn i {
    width: 0.875rem;
    height: 0.875rem;
  }
  
  /* Optimize header button padding */
  header .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }
  
  header .btn i {
    width: 0.875rem;
    height: 0.875rem;
  }
  
  #new-chat-btn {
    padding: 0.25rem;
  }
  
  /* Reduce gaps between form elements */
  #chat-form {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100 !important;
    gap: 0.5rem;
  }
  
  #suggested-prompts {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100 !important;
    gap: 0.75rem;
  }
  
  /* Optimize dynamically created chat elements */
  .message-group {
    margin-bottom: 1rem;
  }
  
  .message-avatar {
    width: 1.75rem;
    height: 1.75rem;
  }
  
  .message-avatar i {
    width: 0.875rem;
    height: 0.875rem;
  }
  
  .message-header {
    margin-bottom: 0.375rem;
  }
  
  .messages-container {
    gap: 0.375rem;
  }
  
  /* Prevent horizontal overflow */
  body, html, #app {
    overflow-x: hidden !important;
  }
  
  /* Ensure input focus doesn't shift layout */
  input:focus {
    width: 100% !important;
    margin: 0 !important;
  }
  
  .max-w-4xl {
    max-width: 100% !important;
  }
}


/* Additional mobile adjustments for smaller screens */
@media (max-width: 480px) {
  /* Even smaller buttons for very small screens */
  .btn-default,
  .btn-outline {
    height: 2.5rem; /* Increased for better mobile usability */
    padding: 0.5rem 0.75rem; /* Increased padding for better mobile usability */
    font-size: 0.75rem;
  }
  
  .input {
    height: 2.5rem; /* Increased for better mobile usability */
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem; /* Increased padding for better mobile usability */
  }
  
  /* Prevent iOS auto-zoom on very small screens */
  #message-input,
  .input {
    font-size: 16px !important;
  }
  
  /* Smaller heading */
  .text-3xl {
    font-size: 1.25rem; /* Further reduced */
    line-height: 1.5rem;
  }
  
  
  /* Tighter spacing */
  .py-16 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }
  
  .container {
    padding: 0 0.5rem !important;
  }
  
  #messages-container {
    padding: 0.75rem !important;
    min-height: 150px !important;
    max-height: 350px !important;
  }
  
  .text-center h2 {
    font-size: 1.25rem !important;
  }
  
  .text-center p {
    font-size: 0.8rem !important;
  }
  
  /* Ensure input form fits properly */
  #chat-form {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
  
  #message-input {
    width: 100% !important;
    margin-bottom: 0.5rem !important;
  }
  
  #chat-form button {
    width: 100% !important;
  }
  
  /* Further reduce prompt card size */
  .prompt-card {
    padding: 0.5rem;
    font-size: 0.75rem;
  }
  
  /* Further reduce message content */
  .message-content {
    padding: 0.375rem 0.5rem;
    font-size: 0.8rem;
  }
  
  /* Mobile optimizations for dynamically created chat elements */
  .message-group {
    margin-bottom: 1rem; /* Reduced from 1.5rem */
  }
  
  .message-avatar {
    width: 1.5rem; /* Reduced from 2rem */
    height: 1.5rem; /* Reduced from 2rem */
  }
  
  .message-avatar i {
    width: 0.75rem; /* Reduced from 1rem */
    height: 0.75rem; /* Reduced from 1rem */
  }
  
  .message-header {
    margin-bottom: 0.25rem; /* Reduced from 0.5rem */
  }
  
  .messages-container {
    gap: 0.25rem; /* Reduced from 0.5rem */
  }
}

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

@keyframes pulse {
  0%, 70%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  35% {
    transform: scale(1.2);
    opacity: 0.7;
  }
}

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

@keyframes typing {
  0%, 20% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Staggered animation for prompt cards */
.prompt-card {
  animation: slideInUp 0.6s ease-out forwards;
  opacity: 0;
}

.prompt-card:nth-child(1) { animation-delay: 0.1s; }
.prompt-card:nth-child(2) { animation-delay: 0.2s; }
.prompt-card:nth-child(3) { animation-delay: 0.3s; }
.prompt-card:nth-child(4) { animation-delay: 0.4s; }
.prompt-card:nth-child(5) { animation-delay: 0.5s; }
.prompt-card:nth-child(6) { animation-delay: 0.6s; }

/* Typing indicator animation */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.typing-indicator span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: hsl(var(--muted-foreground));
  animation: typing 1.4s infinite;
}

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

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

/* Floating input transition */
.floating-input {
  animation: slideInUp 0.4s ease-out;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .prompt-card,
  .floating-input,
  .typing-indicator span {
    animation: none;
  }
  
  .prompt-card {
    opacity: 1;
  }
}