/* === ENHANCED THEME VARIABLES === */
:root {
  --bg: #0a0b0d;
  --bg-gradient: radial-gradient(ellipse at top, #151619 0%, #0a0b0d 100%);
  --text: #f8f9fa;
  --text-secondary: #b8bcc4;
  --bot-bg: rgba(28, 30, 33, 0.95);
  --bot-bubble: rgba(26, 27, 30, 0.9);
  --user-bg: rgba(42, 45, 49, 0.9);
  --input-bg: rgba(25, 27, 29, 0.95);
  --input-border: #333;
  --input-focus: #4fd1c7;
  --accent: #4fd1c7;
  --accent-hover: #38b2ac;
  --accent-secondary: #f56565;
  --shadow: rgba(79, 209, 199, 0.15);
  --shadow-heavy: rgba(0, 0, 0, 0.4);
  --link-color: #4a9eff;
  --glass-bg: rgba(26, 29, 33, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --success: #48bb78;
  --warning: #ed8936;
  --error: #f56565;
}

:root.light-mode {
  --bg: #f7fafc;
  --bg-gradient: radial-gradient(ellipse at top, #ffffff 0%, #f7fafc 100%);
  --text: #2d3748;
  --text-secondary: #718096;
  --bot-bg: rgba(255, 255, 255, 0.95);
  --bot-bubble: rgba(237, 242, 247, 0.9);
  --user-bg: rgba(79, 209, 199, 0.1);
  --input-bg: rgba(255, 255, 255, 0.95);
  --input-border: #e2e8f0;
  --input-focus: #38b2ac;
  --accent: #38b2ac;
  --accent-hover: #319795;
  --accent-secondary: #e53e3e;
  --shadow: rgba(56, 178, 172, 0.2);
  --shadow-heavy: rgba(0, 0, 0, 0.1);
  --link-color: #3182ce;
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(0, 0, 0, 0.1);
  --success: #38a169;
  --warning: #dd6b20;
  --error: #e53e3e;
}

/* Add these at the top of your CSS file */
:root {
  /* Set viewport height custom property that works better on iOS */
  height: 100vh;
  height: -webkit-fill-available;
}

html, body {
  /* Use the custom height */
  height: 100vh;
  height: -webkit-fill-available;
  overflow: hidden;
}

/* === LANDING PAGE FLOATING ORBS BACKGROUND === */
.bg-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Left floating orb - matches landing page */
.bg-glow::before {
  content: '';
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 209, 199, 0.1) 0%, transparent 70%);
  top: 10%;
  left: -10%;
  filter: blur(60px);
  animation: floatOrb 20s ease-in-out infinite;
}

/* Right floating orb - purple accent from landing */
.bg-glow::after {
  content: '';
  position: fixed;
  width: 800px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(156, 39, 176, 0.08) 0%, transparent 70%);
  bottom: 20%;
  right: -15%;
  filter: blur(80px);
  animation: floatOrb 25s ease-in-out infinite reverse;
}

/* Smooth floating animation */
@keyframes floatOrb {
  0%, 100% {
    transform: translate(0, 0);
  }
  33% {
    transform: translate(30px, -20px);
  }
  66% {
    transform: translate(-20px, 30px);
  }
}

/* Parallax effect on scroll (optional) */
@media (min-width: 768px) {
  .bg-glow::before {
    transition: transform 0.3s ease-out;
  }
  
  .bg-glow::after {
    transition: transform 0.3s ease-out;
  }
}
/* Make sure your main content is above the glow */
header, main, footer, #messages, .chat-controls, #car-profile {
  position: relative;
  z-index: 1;
}

/* Optional: Make the glow more subtle in light mode */
.light-mode .bg-glow::before,
.light-mode .bg-glow::after {
  opacity: 0.3;
}

/* === BASE STYLES === */
* {
  box-sizing: border-box;
}

body, html {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-gradient);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Prevent zoom on input focus */
input, textarea, select {
    font-size: 16px !important; /* iOS zooms if font-size is less than 16px */
}

/* Prevent double-tap zoom */
* {
    touch-action: manipulation;
}

/* Jump to Bottom Button - Matching TorqueBot Design */
.jump-to-bottom {
  position: fixed;
  bottom: 100px; /* Above the input area */
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent, #00BFA5);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 191, 165, 0.3);
  z-index: 100;
}

.jump-to-bottom::before {
  content: '↓';
  font-size: 16px;
  font-weight: bold;
}

.jump-to-bottom.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.jump-to-bottom:hover {
  background: var(--accent-hover, #00a694);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 191, 165, 0.4);
}

.jump-to-bottom.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 4px 12px rgba(0, 191, 165, 0.3);
  }
  50% {
    box-shadow: 0 4px 20px rgba(0, 191, 165, 0.6);
  }
  100% {
    box-shadow: 0 4px 12px rgba(0, 191, 165, 0.3);
  }
}

.char-counter {
  user-select: none;
  font-family: monospace;
}

/* Input area adjustments */
.chat-controls {
  position: relative;
}

#user-input {
  padding-right: 110px; /* Make room for counter */
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .jump-to-bottom {
    bottom: 90px;
    padding: 8px 16px;
    font-size: 13px;
  }
  
  .char-counter {
    right: 55px;
    font-size: 10px;
  }
  
  #user-input {
    padding-right: 90px;
  }
}

/* Remove any quick actions CSS */
.quick-actions {
  display: none !important;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(0, 191, 165, 0.3);
  }
  50% {
    box-shadow: 0 2px 20px rgba(0, 191, 165, 0.6),
                0 2px 30px rgba(0, 191, 165, 0.4);
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .jump-to-bottom {
    bottom: 120px; /* Adjust for mobile keyboard */
    right: 15px;
    padding: 10px 20px;
    font-size: 13px;
  }
}

/* Animated background particles */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 20% 50%, rgba(79, 209, 199, 0.03) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(245, 101, 101, 0.03) 0%, transparent 50%),
              radial-gradient(circle at 40% 80%, rgba(237, 137, 54, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 1rem 0;
  min-height: 100vh;
  box-sizing: border-box;
}

/* === ENHANCED HEADER === */
h1 {
  margin-top: 1rem !important;
  text-align: center;
  font-size: 2.3rem;
  font-weight: 800;
  color: var(--accent);
  margin: 1rem 0 1.5rem 0;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 10;
  width: 100%;
  flex-shrink: 0;
  display: flex;
  /* Better text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.7;
}


.logo {
  height: 80px; /* Adjust this value to make it bigger/smaller */
  width: auto; /* Keeps aspect ratio */
  max-width: 300px; /* Prevents it from being too wide */
  object-fit: contain;
}

.logoLogin {
  height: 80px; /* Adjust this value to make it bigger/smaller */
  width: auto; /* Keeps aspect ratio */
  max-width: 300px; /* Prevents it from being too wide */
  object-fit: contain;
}


/* Light mode - invert the header logo colors */
:root.light-mode .logo,
:root.light-mode .logoLogin {
  filter: invert(1) brightness(0.8);
}

/* === TOP CONTROLS === */
#top-controls {
  position: fixed;
  top: 15px;
  left: 15px;
  display: flex;
  gap: 12px;
  z-index: 1000;
}

#top-controls button {
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  color: var(--text);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

#top-controls button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s;
}

#top-controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--shadow);
  border-color: var(--accent);
}

#top-controls button:hover::before {
  left: 100%;
}

#top-controls button:active {
  transform: translateY(0);
}

/* === CAR PROFILE POSITION FIX === */
#car-profile {
  position: fixed;
  top: 15px !important;
  right: 15px !important;
  width: 50px; /* Same size as hamburger */
  height: 50px; /* Same size as hamburger */
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 12px; /* Same radius as hamburger */
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px var(--shadow); /* Same shadow as hamburger */
  transform: translateX(300px);
  opacity: 0;
}

#car-profile.visible {
  transform: translateX(0);
  opacity: 1;
}

#car-profile:hover {
  transform: translateY(-2px); /* Same hover effect as hamburger */
  box-shadow: 0 8px 25px var(--shadow);
  border-color: var(--accent);
}

/* Expanded state - when clicked */
#car-profile.expanded {
  width: 200px;
  height: auto;
  padding: 1rem 1.25rem;
  border-radius: 16px;
  justify-content: flex-start;
  flex-direction: column;
  align-items: flex-start;
}

/* Car icon - remove aqua background */
#car-profile .profile-icon {
  font-size: 1.4rem; /* Match hamburger icon size */
  color: var(--accent); /* Just the accent color, no background */
  background: none; /* Remove aqua square background */
  width: auto;
  height: auto;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  transition: all 0.3s ease;
}

/* Hide details by default (collapsed state) */
#car-profile .profile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
  transition: all 0.3s ease;
}

#car-profile .profile-title,
#car-profile .profile-details {
  display: none; /* Hidden by default */
  opacity: 0;
  transition: all 0.3s ease;
}

/* Show details when expanded */
#car-profile.expanded .profile-header {
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--glass-border);
}

#car-profile.expanded .profile-title,
#car-profile.expanded .profile-details {
  display: block;
  opacity: 1;
}

#car-profile.expanded .profile-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: -0.2px;
}

#car-profile.expanded .profile-details {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
  font-weight: 600;
  margin-top: 0.5rem;
}

#car-profile.expanded .profile-details small {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  display: block;
  margin-top: 0.25rem;
}


/* === FIXED CENTERING FOR ALL SCREEN SIZES === */
#messages {
  /* Core styles */
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 1.5rem 1.25rem;
  
  /* Fixed dimensions */
  width: 850px;
  height: calc(100vh - 265px);
  
  /* BETTER CENTERING - Multiple methods */
  position: fixed;
  top: 110px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0 auto; /* Fallback centering */
  
  /* Content */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  
  /* Visual */
  box-shadow: 0 20px 40px var(--shadow-heavy);
  
  /* Remove any animations */
  transition: none !important;
  animation: none !important;
}

/* === MOBILE CENTERING FIXES === */


/* Large tablets */
@media (max-width: 900px) {
  #messages {
    width: calc(100% - 2rem) !important;
    height: calc(100vh - 275px) !important;
    top: 125px !important;
    left: 1rem !important;
    right: 1rem !important;
    transform: none !important;
    margin: 0 !important;
    padding: 1rem !important;
    border-radius: 16px !important;
  }

  .logo {
    height: 60px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
  }

  .logoLogin{
    height: 60px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
  }
}

/* Large phones (430px screens like yours) */
@media (max-width: 440px) {
  #messages {
    width: calc(100% - 1.5rem) !important;
    height: calc(100vh - 200px) !important;
    height: calc(-webkit-fill-available - 220px) !important;
    top: 80px !important;
    left: 0.75rem !important;
    right: 0.75rem !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0.875rem !important;
    border-radius: 12px !important;
  }

  .logo {
    height: 75px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
  }

    .logoLogin{
    height: 60px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
  }
}


/* Large phones (430px screens like yours) */
@media (max-width: 432px) {
  #messages {
    width: calc(100% - 1.5rem) !important;
    height: calc(100vh - 200px) !important;
    height: calc(-webkit-fill-available - 220px) !important;
    top: 80px !important;
    left: 0.75rem !important;
    right: 0.75rem !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0.875rem !important;
    border-radius: 12px !important;
  }

  .logo {
    height: 75px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
  }

    .logoLogin{
    height: 60px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
  }
}

/* iPhone 13 Pro and similar */
@media (max-width: 414px) {
  #messages {
    width: calc(100% - 1rem) !important;
    height: calc(100vh - 200px) !important;
    height: calc(-webkit-fill-available - 220px) !important;
    top: 80px !important;
    left: 0.5rem !important;
    right: 0.5rem !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0.75rem !important;
    border-radius: 12px !important;
  }

  .logo {
    height: 75px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
  }

    .logoLogin{
    height: 60px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
  }
}

/* Standard phones */
@media (max-width: 402px) {
  #messages {
    width: calc(100% - 1rem) !important;
    height: calc(100vh - 200px) !important;
    height: calc(-webkit-fill-available - 200px) !important;
    top: 75px !important;
    left: 0.5rem !important;
    right: 0.5rem !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0.75rem !important;
    border-radius: 12px !important;
  }

  .logo {
    height: 75px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
  }

    .logoLogin{
    height: 60px;
    width: auto;
    max-width: 270px;
    object-fit: contain;
  }
}

/* Standard phones */
@media (max-width: 400px) {
  #messages {
    width: calc(100% - 1rem) !important;
    height: calc(100vh - 200px) !important;
    height: calc(-webkit-fill-available - 200px) !important;
    top: 75px !important;
    left: 0.5rem !important;
    right: 0.5rem !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0.75rem !important;
    border-radius: 12px !important;
  }

  .logo {
    height: 75px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
  }

      .logoLogin{
    height: 60px;
    width: auto;
    max-width: 270px;
    object-fit: contain;
  }
}

/* Small phones */
@media (max-width: 375px) {
  #messages {
    width: calc(100% - 0.75rem) !important;
    height: calc(100vh - 190px) !important;
    height: calc(-webkit-fill-available - 190px) !important;
    top: 70px !important;
    left: 0.375rem !important;
    right: 0.375rem !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0.625rem !important;
    border-radius: 10px !important;
  }

  .logo {
    height: 75px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
  }

      .logoLogin{
    height: 60px;
    width: auto;
    max-width: 270px;
    object-fit: contain;
  }
}

/* Very small phones */
@media (max-width: 360px) {
  #messages {
    width: calc(100% - 0.5rem) !important;
    height: calc(100vh - 180px) !important;
    height: calc(-webkit-fill-available - 200px) !important;
    top: 75px !important;
    left: 0.25rem !important;
    right: 0.25rem !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0.5rem !important;
    border-radius: 8px !important;
  }

  .logo {
    height: 75px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
  }

      .logoLogin{
    height: 60px;
    width: auto;
    max-width: 270px;
    object-fit: contain;
  }
}

/* Tiny phones */
@media (max-width: 320px) {
  #messages {
    width: calc(100% - 0.5rem) !important;
    height: calc(100vh - 170px) !important;
    height: calc(-webkit-fill-available - 170px) !important;
    top: 60px !important;
    left: 0.25rem !important;
    right: 0.25rem !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0.5rem !important;
    border-radius: 8px !important;
  }

  .logo {
    height: 30px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
  }
}

/* Custom scrollbar */
#messages::-webkit-scrollbar {
  width: 6px;
}

#messages::-webkit-scrollbar-track {
  background: transparent;  
}

#messages::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
  opacity: 0.6;
}

#messages::-webkit-scrollbar-thumb:hover {
  opacity: 1;
}

/* Stop Button Styles */
.send-button.stop-mode {
  background: #dc3545 !important;  /* Red color */
  color: white !important;
  animation: pulse-stop 1.5s infinite;
}

.send-button.stop-mode:hover {
  background: #c82333 !important;  /* Darker red on hover */
}

@keyframes pulse-stop {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}


.cars-list {
  max-height: 200px;
  overflow-y: auto;
}

.car-item {
  display: flex;
  align-items: center;
  padding: 10px;
  margin: 5px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.05);
}

.car-item:hover {
  background: rgba(0, 191, 165, 0.1);
  transform: translateX(5px);
}

.car-item.active {
  background: rgba(0, 191, 165, 0.2);
  border-left: 3px solid #00BFA5;
}

.car-item.empty {
  opacity: 0.7;
  border: 2px dashed rgba(0, 191, 165, 0.3);
}

.car-item.empty:hover {
  opacity: 1;
  border-color: #00BFA5;
}

.car-indicator {
  margin-right: 10px;
  color: #00BFA5;
  font-size: 12px;
  transition: transform 0.2s ease;
}

.car-item:hover .car-indicator {
  transform: translateX(3px);
}

.car-details {
  flex: 1;
}

.car-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.car-engine {
  font-size: 12px;
  opacity: 0.8;
}

.add-car {
  color: #00BFA5;
  font-weight: 500;
}

.car-switch-notification {
  animation: slideInRight 0.3s ease;
}

.car-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  transition: all 0.3s ease;
}

.car-item:hover {
  background: rgba(0, 191, 165, 0.05);
}

.car-main {
  flex: 1;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.car-actions {
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.car-item:hover .car-actions {
  opacity: 1;
}

.car-action-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.car-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.edit-btn:hover {
  background: rgba(33, 150, 243, 0.3);
}

.delete-btn:hover {
  background: rgba(244, 67, 54, 0.3);
}

.car-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.active-check {
  color: var(--accent, #00BFA5);
  font-weight: bold;
}

.car-subtitle {
  font-size: 0.85em;
  opacity: 0.8;
  margin-top: 2px;
}

.car-subtitle.nickname {
  color: var(--accent, #00BFA5);
  font-style: italic;
  opacity: 0.9;
}

.car-subtitle.engine {
  opacity: 0.7;
}

/* Make the car name slightly smaller when nickname is shown */
.car-details {
  line-height: 1.3;
}

.car-name-text {
  font-weight: 500;
}
/* Notification animations */
@keyframes slideOutRight {
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

/* Expanded state adjustments */
#car-profile.expanded .car-actions {
  opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .car-actions {
    opacity: 1; /* Always visible on mobile */
  }
  
  .car-action-btn {
    width: 35px;
    height: 35px;
  }
}

/* When collapsed, hide the cars list */
#car-profile:not(.expanded) .cars-list {
  display: none;
}

/* Only show the header when collapsed */
#car-profile:not(.expanded) {
  overflow: hidden;
  height: auto; /* Let header determine height */
}

/* Ensure profile header doesn't wrap */
#car-profile .profile-header {
  white-space: nowrap;
  overflow: hidden;
}

/* Clean up the collapsed state */
#car-profile:not(.expanded) .profile-title {
  font-size: 14px; /* Slightly smaller when collapsed */
}


@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}


/* === ENHANCED CHAT MESSAGES === */
.message-row {
  display: flex;
  align-items: flex-end;
  width: 100%;
  margin-bottom: 8px;
  gap: 12px;
  animation: messageSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.message-row[style*="flex-end"] { 
  justify-content: flex-end; 
}

.message-row[style*="flex-start"] { 
  justify-content: flex-start; 
}

/* === ENHANCED AVATARS === */

/* === ENHANCED MESSAGE BUBBLES === */
.bubble-bot, .bubble-user {
  display: inline-block;
  max-width: 75vw;
  padding: 1rem 1.25rem;
  border-radius: 20px;
  font-size: 1rem;
  margin: 3px 0;
  word-break: break-word;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  white-space: pre-line;
  line-height: 1.6;
  position: relative;
  transition: all 0.3s ease;
}

.bubble-bot {
  background: var(--bot-bubble);
  color: var(--text);
  border-bottom-left-radius: 8px;
}

.bubble-bot:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.bubble-user {
  background: var(--user-bg);
  color: var(--text);
  border-bottom-right-radius: 8px;
  font-weight: 500;
  margin-left: 50px;
}

.bubble-user:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px var(--shadow);
}

/* === ENHANCED THINKING BUBBLE === */
.thinking-bubble {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--bot-bubble) 0%, rgba(79, 209, 199, 0.1) 100%);
  border: 1px solid var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { 
    box-shadow: 0 4px 20px rgba(79, 209, 199, 0.2); 
  }
  50% { 
    box-shadow: 0 4px 30px rgba(79, 209, 199, 0.4); 
  }
}

.thinking-text {
  display: inline-block;
  font-weight: 500;
}

/* === ENHANCED TYPING ANIMATION === */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.typing-dot {
  width: 8px; 
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.6;
  animation: bounce 1.4s infinite both;
}

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

@keyframes bounce {
  0%, 100% { 
    transform: translateY(0) scale(1); 
    opacity: 0.6; 
  }
  50% { 
    transform: translateY(-6px) scale(1.2); 
    opacity: 1; 
  }
}

/* === ENHANCED RETAILER LINKS === */
.message-links {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.retailer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #ffffff !important;
  text-decoration: none;
  border-radius: 12px;
  font-size: 0.9em;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(79, 209, 199, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.retailer-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.retailer-link:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(79, 209, 199, 0.4);
}

.retailer-link:hover::before {
  left: 100%;
}

/* Retailer-specific styling */
.retailer-link[data-retailer="supercheap-auto"] {
  background: linear-gradient(135deg, #e31e24 0%, #ff3339 100%);
  box-shadow: 0 4px 15px rgba(227, 30, 36, 0.3);
}

.retailer-link[data-retailer="repco"] {
  background: linear-gradient(135deg, #c41e3a 0%, #d93651 100%);
  box-shadow: 0 4px 15px rgba(196, 30, 58, 0.3);
}

.retailer-link[data-retailer="autobarn"] {
  background: linear-gradient(135deg, #004d9f 0%, #0066cc 100%);
  box-shadow: 0 4px 15px rgba(0, 77, 159, 0.3);
}

/* === ENHANCED PRODUCT IMAGES === */
.message-images {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.image-wrapper {
  position: relative;
  display: inline-block;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.clickable-product {
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.clickable-product:hover {
  transform: translateY(-4px) scale(1.02);
}

.product-image {
  max-width: 140px;
  max-height: 140px;
  object-fit: cover;
  border-radius: 16px;
  border: 3px solid var(--accent);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.clickable-product:hover .product-image {
  transform: scale(1.05);
  box-shadow: 0 12px 35px rgba(79, 209, 199, 0.4);
  border-color: var(--accent-secondary);
}

.image-label {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.75em;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(79, 209, 199, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* === BUY HINT === */
.buy-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.7em;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}

.clickable-product:hover .buy-hint {
  opacity: 1;
  transform: translateY(-2px);
}

/* === ENHANCED VIDEO WRAPPER === */
.video-wrapper {
  position: relative;
  margin: 5px;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
  width: 180px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  /* Make entire wrapper clickable */
  text-decoration: none;
  color: inherit;
}

.video-wrapper:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 15px 40px rgba(245, 101, 101, 0.3);
}

/* Video thumbnail improvements */
.video-thumbnail {
  width: 180px;
  height: 100px;
  object-fit: cover;
  border-radius: 16px;
  border: 3px solid var(--accent-secondary);
  /* Remove pointer-events to let wrapper handle clicks */
  pointer-events: none;
}

/* Enhanced video label with YouTube icon */
.video-label {
  position: absolute;
  bottom: 30px;
  left: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
  text-align: center;
  backdrop-filter: blur(10px);
  /* Add YouTube icon */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.watch-hint {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: linear-gradient(135deg, var(--accent-secondary) 0%, #ff6b6b 100%);
  color: white;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
  text-align: center;
  opacity: 0;
  transition: all 0.3s ease;
  font-weight: 600;
}

.video-label::before {
  content: "▶️";
  font-size: 10px;
}

.watch-hint {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%); /* YouTube red */
  color: white;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
  text-align: center;
  opacity: 0;
  transition: all 0.3s ease;
  font-weight: 600;
}

.video-wrapper:hover .watch-hint {
  opacity: 1;
  transform: translateY(-2px);
}

/* === ENHANCED IMAGE MODAL === */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  cursor: pointer;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(20px);
  }
}

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 32px;
  font-weight: bold;
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(245, 101, 101, 0.1);
}

.modal-close:hover {
  color: var(--accent-secondary);
  background: rgba(245, 101, 101, 0.2);
  transform: scale(1.1);
}

.modal-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-caption {
  text-align: center;
  margin-top: 16px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
}

/* === ENHANCED CHAT INPUT === */
#chat-controls {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 1rem;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 -10px 40px var(--shadow-heavy);
  z-index: 1000;
  max-width: 850px;
  width: calc(100% - 2rem);
  border-radius: 20px 20px 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  /* Ensure enough space above for quick actions */
  min-height: 80px;
}

#user-input {
  flex: 1;
  padding: 1rem 1.25rem;
  border-radius: 16px;
  border: 2px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

#user-input::placeholder {
  color: var(--text-secondary);
}

#user-input:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(79, 209, 199, 0.2);
  transform: translateY(-1px);
}

#chat-controls button {
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #ffffff;
  border: none;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(79, 209, 199, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-width: 100px;
}

#chat-controls button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

#chat-controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(79, 209, 199, 0.6);
}

#chat-controls button:hover::before {
  left: 100%;
}

#chat-controls button:active {
  transform: translateY(0);
}

/* === QUICK ACTIONS === */
.quick-actions {
  position: fixed;
  bottom: 100px; /* Changed from calc(100% + 1rem) to fixed distance */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0;
  transform: translateX(-50%) translateY(15px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  max-width: 850px;
  width: calc(100% - 2rem);
  z-index: 999; /* Lower than chat controls */
  padding: 0 1rem;
}

.quick-actions.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: all;
}

/* Improved quick action buttons */
.quick-action {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 0.8rem 1.5rem;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  font-weight: 600;
  flex: 0 0 auto;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  line-height: 1.3;
  letter-spacing: -0.2px;
  position: relative;
  overflow: hidden;
}

/* === HAMBURGER MENU STYLES === */
#hamburger-toggle {
  position: fixed;
  top: 15px !important;
  left: 15px !important;
  width: 50px !important;
  height: 50px !important;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  cursor: pointer;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px var(--shadow);
}

#hamburger-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--shadow);
  border-color: var(--accent);
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

/* Hamburger animation to X */
#hamburger-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

#hamburger-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

#hamburger-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Menu overlay */
#menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Slide-out menu */
#hamburger-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 320px;
  height: 100vh;
  background: var(--glass-bg);
  backdrop-filter: blur(25px);
  border-right: 1px solid var(--glass-border);
  z-index: 1001;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 30px var(--shadow-heavy);
  display: flex;
  flex-direction: column;
}

#hamburger-menu.active {
  transform: translateX(0);
}

/* Menu header */
.menu-header {
  padding: 2.5rem 2rem 1.5rem 2rem;
  border-bottom: 1px solid var(--glass-border);
  background: linear-gradient(135deg, rgba(79, 209, 199, 0.1) 0%, rgba(79, 209, 199, 0.05) 100%);
  position: relative;

}

.menu-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}

.menu-header h3 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

/* Menu items container */
.menu-items {
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

/* Individual menu items */
/* Individual menu items - clean text-only design */
.menu-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.menu-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(79, 209, 199, 0.1), transparent);
  transition: left 0.5s ease;
}

.menu-item:hover {
  background: rgba(79, 209, 199, 0.1);
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: 0 4px 15px rgba(79, 209, 199, 0.2);
}

.menu-item:hover::before {
  left: 100%;
}

.menu-item:active {
  transform: translateX(2px);
}

/* Hide all icons */
.menu-icon {
  display: none !important;
}

/* Menu text - full width, centered */
.menu-text {
  width: 100%;
  text-align: left;
  font-weight: 600;
  letter-spacing: -0.1px;
}

/* Menu items container */
.menu-items {
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

/* Menu header */
.menu-header {
  padding: 2rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  background: linear-gradient(135deg, rgba(79, 209, 199, 0.08) 0%, rgba(79, 209, 199, 0.03) 100%);
  position: relative;
}

.menu-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
}

.menu-header h3 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}
/* Mobile responsive adjustments */
@media (max-width: 768px) {
  #hamburger-menu {
    width: 100vw;
    max-width: 320px;
  }
  
    .menu-header {
      padding: 1.5rem 1rem 0.75rem 1rem;
    }
    
    .menu-items {
      padding: 1rem 0.75rem;
      gap: 0.5rem;
    }
    
    .menu-item {
      padding: 0.875rem 1rem;
      font-size: 0.9rem;
      gap: 0.75rem;
    }
    
    .menu-icon {
      font-size: 1.1rem;
      min-width: 1.5rem;
      height: 1.5rem;
    }
  }
  
  @media (max-width: 480px) {
    .menu-header h3 {
      font-size: 1.2rem;
    }
    
    .menu-item {
      padding: 0.75rem 0.875rem;
      font-size: 0.85rem;
      gap: 0.5rem;
    }
    
    .menu-icon {
      font-size: 1rem;
      min-width: 1.25rem;
      height: 1.25rem;
    }
  }

@media (max-width: 480px) {
  #hamburger-toggle {
    top: 10px;
    left: 10px;
    width: 45px;
    height: 45px;
  }
  
  .hamburger-line {
    width: 20px;
  }
  
  #hamburger-menu {
    width: 100vw;
    max-width: 280px;
  }
  
  .menu-header h3 {
    font-size: 1.3rem;
  }
  
  .menu-item {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
  
  .menu-icon {
    font-size: 1.1rem;
    min-width: 1.25rem;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  #hamburger-toggle,
  #menu-overlay,
  #hamburger-menu,
  .hamburger-line,
  .menu-item {
    transition: none !important;
  }
}

/* Focus states for keyboard navigation */
#hamburger-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.menu-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.quick-action:hover {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #ffffff;
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(79, 209, 199, 0.4);
  border-color: var(--accent);
}

/* === FIX FOR HEADING GAPS - MAIN ISSUE === */
.bubble-bot h1, .bubble-bot h2, .bubble-bot h3, .bubble-bot h4, .bubble-bot h5, .bubble-bot h6 {
  margin: 0.5rem 0 0.3rem 0 !important; /* Much tighter spacing */
  padding: 0 !important;
  line-height: 1.3 !important;
  color: var(--accent) !important; /* Torque blue color for all headings */
  font-weight: 600 !important;
}

.bubble-bot h1:first-child, .bubble-bot h2:first-child, .bubble-bot h3:first-child, 
.bubble-bot h4:first-child, .bubble-bot h5:first-child, .bubble-bot h6:first-child {
  margin-top: 0 !important; /* Remove top margin for first heading */
}

.bubble-bot h1:last-child, .bubble-bot h2:last-child, .bubble-bot h3:last-child, 
.bubble-bot h4:last-child, .bubble-bot h5:last-child, .bubble-bot h6:last-child {
  margin-bottom: 0 !important; /* Remove bottom margin for last heading */
}

/* === ENHANCED LISTS === */
.bubble-bot ul, .bubble-bot ol {
  margin: 8px 0 !important; /* Reduced from 12px */
  padding-left: 20px !important; /* Reduced from 24px */
}

.bubble-bot li {
  margin: 4px 0 !important; /* Reduced from 8px */
  line-height: 1.5 !important; /* Slightly tighter */
  position: relative;
}

.bubble-bot ul li::marker {
  color: var(--accent);
}

.bubble-bot ol li::marker {
  color: var(--accent);
  font-weight: 600;
}

.bubble-bot p {
  margin: 8px 0 !important; /* Reduced from 12px */
}

.bubble-bot strong {
  color: var(--accent);
  font-weight: 600;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
  body {
    padding: 0.25rem 0.5rem 0;
  }

  h1 {
    font-size: 1.8rem;
    margin: 0.5rem 0 1rem 0;
    padding-top: 0.25rem;
  }

  #top-controls {
    top: 10px;
    left: 10px;
    flex-direction: column;
    gap: 8px;
  }

  #top-controls button {
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
  }


  .bubble-bot, .bubble-user {
    max-width: 85vw;
    font-size: 0.95rem;
    padding: 0.85rem 1rem;
    border-radius: 16px;
  }



  .product-image {
    max-width: 120px;
    max-height: 120px;
  }

  .video-wrapper {
    width: 160px;
  }

  .video-thumbnail {
    width: 160px;
    height: 90px;
  }

  #chat-controls {
    width: calc(100% - 1rem);
    padding: 0.75rem;
    gap: 12px;
  }

  #user-input {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
  }

  #chat-controls button {
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
    min-width: 80px;
  }

  .message-links {
    gap: 8px;
  }

  .retailer-link {
    padding: 6px 12px;
    font-size: 0.8em;
  }

  .modal-content {
    padding: 20px;
    margin: 15px;
  }

  .buy-hint {
    font-size: 0.65em;
    padding: 3px 6px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0.1rem 0.25rem 0;
  }

  h1 {
    font-size: 1.6rem;
    margin: 0.25rem 0 0.75rem 0;
    padding-top: 0.1rem;
  }

  #top-controls {
    top: 8px;
    left: 8px;
  }

  #top-controls button {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }



  .profile-title {
    font-size: 0.8rem !important;
  }

  .profile-details {
    font-size: 0.75rem !important;
  }

#messages {
  padding: 0.75rem 0.5rem;
  border-radius: 16px;
  margin-bottom: 10rem;
  height: calc(100vh - 160px); /* Fixed height for small mobile */
}

  .bubble-bot, .bubble-user {
    max-width: 90vw;
    font-size: 0.9rem;
    padding: 0.75rem 0.9rem;
    border-radius: 14px;
  }


  .product-image {
    max-width: 100px;
    max-height: 100px;
  }

  .video-wrapper {
    width: 140px;
  }

  .video-thumbnail {
    width: 140px;
    height: 80px;
  }

  #chat-controls {
    width: calc(100% - 0.5rem);
    padding: 0.6rem;
    gap: 10px;
    border-radius: 16px 16px 0 0;
  }

  #user-input {
    padding: 0.75rem 0.9rem;
    font-size: 0.9rem;
    border-radius: 12px;
  }

  #chat-controls button {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    min-width: 70px;
    border-radius: 12px;
  }

  .quick-actions {
    position: fixed;
    bottom: 50px; /* Moved up for better spacing */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    opacity: 0;
    transform: translateX(-50%) translateY(15px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    max-width: 850px;
    width: calc(100% - 2rem);
    z-index: 999;
    padding: 0 1rem;
  }

  .quick-action::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(79, 209, 199, 0.2), transparent);
  transition: left 0.5s ease;
}

.quick-action:hover {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #ffffff;
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 30px rgba(79, 209, 199, 0.4);
  border-color: var(--accent);
}

.quick-action:hover::before {
  left: 100%;
}

  .quick-action {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 16px;
  }

  .message-images {
    gap: 12px;
  }

  .message-links {
    gap: 6px;
  }

  .retailer-link {
    padding: 5px 10px;
    font-size: 0.75em;
    border-radius: 10px;
  }

  .image-label {
    font-size: 0.7em;
    padding: 3px 8px;
    border-radius: 6px;
  }

  .video-label {
    font-size: 10px;
    padding: 3px 6px;
  }

  .watch-hint {
    font-size: 10px;
    padding: 3px 6px;
  }

  .buy-hint {
    font-size: 0.6em;
    top: 6px;
    right: 6px;
    padding: 2px 5px;
  }

  .modal-content {
    padding: 15px;
    margin: 10px;
    border-radius: 16px;
  }

  .modal-close {
    top: 10px;
    right: 15px;
    font-size: 28px;
    width: 35px;
    height: 35px;
  }
}

/* === ENHANCED HOVER STATES === */
@media (hover: hover) {
  .bubble-bot:hover,
  .bubble-user:hover {
    transform: translateY(-1px);
  }

  .retailer-link:hover {
    transform: translateY(-2px) scale(1.02);
  }

  .clickable-product:hover {
    transform: translateY(-4px) scale(1.02);
  }

  .video-wrapper:hover {
    transform: translateY(-4px) scale(1.02);
  }

  #top-controls button:hover {
    transform: translateY(-2px);
  }

  #chat-controls button:hover {
    transform: translateY(-2px);
  }

  .quick-action:hover {
    transform: translateY(-2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  #hamburger-toggle,
  #menu-overlay,
  #hamburger-menu,
  .hamburger-line,
  .menu-item,
  .quick-action,
  #car-profile {
    transition: none !important;
  }
}

/* Enhanced focus states */
.menu-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: rgba(79, 209, 199, 0.1);
}

.quick-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  transform: translateY(-2px);
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }



  .thinking-bubble {
    animation: none;
  }

  .typing-dot {
    animation: none;
  }

  .messageSlideIn {
    animation: none;
  }
}

@media (prefers-contrast: high) {
  :root {
    --accent: #00ffff;
    --accent-hover: #00cccc;
    --accent-secondary: #ff0066;
    --input-border: #ffffff;
    --glass-border: rgba(255, 255, 255, 0.3);
  }

  :root.light-mode {
    --accent: #006666;
    --accent-hover: #004444;
    --accent-secondary: #cc0044;
    --input-border: #000000;
    --glass-border: rgba(0, 0, 0, 0.3);
  }
}

/* === FOCUS STATES === */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#user-input:focus-visible {
  outline: none;
}

button:focus-visible {
  outline-offset: 4px;
}

.retailer-link:focus-visible,
.clickable-product:focus-visible,
.video-wrapper:focus-visible {
  outline-offset: 4px;
  transform: translateY(-2px);
}

/* === LOADING STATES === */
.loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--accent);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* === SUCCESS/ERROR STATES === */
.success {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.2) !important;
}

.error {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.2) !important;
}

.warning {
  border-color: var(--warning) !important;
  box-shadow: 0 0 0 3px rgba(237, 137, 54, 0.2) !important;
}

/* Upgrade Modal Styles */
.upgrade-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.upgrade-overlay.show {
  opacity: 1;
}

.upgrade-modal {
  background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
  border: 1px solid rgba(79, 209, 199, 0.3);
  border-radius: 20px;
  max-width: 500px;
  width: 100%;
  box-shadow: 
      0 20px 60px rgba(0, 0, 0, 0.5),
      0 0 100px rgba(79, 209, 199, 0.1);
  animation: slideUp 0.3s ease;
  overflow: hidden;
}

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

.modal-header {
  padding: 30px 30px 20px;
  text-align: center;
  background: linear-gradient(135deg, rgba(79, 209, 199, 0.1), transparent);
}

.modal-header h2 {
  font-size: 2rem;
  margin: 0 0 10px 0;
  background: linear-gradient(135deg, #4fd1c7, #3bb6ac);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: #a0a0a0;
  font-size: 1.1rem;
  margin: 0;
}

.modal-body {
  padding: 0 30px 20px;
}

.benefits-list {
  margin: 20px 0;
}

.benefit-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #e0e0e0;
  font-size: 0.95rem;
  line-height: 1.5;
  animation: fadeInLeft 0.5s ease forwards;
  opacity: 0;
}

.benefit-item:nth-child(1) { animation-delay: 0.1s; }
.benefit-item:nth-child(2) { animation-delay: 0.2s; }
.benefit-item:nth-child(3) { animation-delay: 0.3s; }
.benefit-item:nth-child(4) { animation-delay: 0.4s; }
.benefit-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInLeft {
  to {
      opacity: 1;
      transform: translateX(0);
  }
  from {
      opacity: 0;
      transform: translateX(-20px);
  }
}

.pricing-box {
  background: linear-gradient(135deg, rgba(79, 209, 199, 0.15), rgba(79, 209, 199, 0.05));
  border: 1px solid rgba(79, 209, 199, 0.3);
  border-radius: 15px;
  padding: 20px;
  margin: 25px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.pricing-box::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(79, 209, 199, 0.1), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.price-tag {
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin-bottom: 10px;
}

.currency {
  font-size: 1.5rem;
  color: #4fd1c7;
  margin-right: 2px;
}

.amount {
  font-size: 3rem;
  font-weight: bold;
  color: #4fd1c7;
}

.period {
  font-size: 1.2rem;
  color: #a0a0a0;
  margin-left: 5px;
}

.price-comparison {
  color: #e0e0e0;
  margin: 5px 0;
  font-size: 0.9rem;
}

.value-prop {
  color: #4fd1c7;
  font-weight: 600;
  margin: 10px 0 0 0;
}

.timer-notice {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  color: #a0a0a0;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.modal-actions {
  padding: 20px 30px 30px;
  display: flex;
  gap: 15px;
}

.btn-primary {
  flex: 1;
  padding: 15px;
  background: linear-gradient(135deg, #4fd1c7, #3bb6ac);
  color: #000;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(79, 209, 199, 0.4);
}

.btn-secondary {
  padding: 15px 25px;
  background: transparent;
  color: #a0a0a0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: #e0e0e0;
}

.load-more-button {
  width: 100%;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  font-size: 14px;
  transition: all 0.3s ease;
}

.load-more-button:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

.loading-more {
  text-align: center;
  padding: 20px;
  opacity: 0.7;
}

.loading-more-spinner {
  display: inline-flex;
  gap: 4px;
}

.no-more-messages {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  opacity: 0.6;
}

.load-more-error {
  text-align: center;
  padding: 15px;
  background: var(--error-bg);
  color: var(--error);
  border-radius: 8px;
  margin: 10px;
}

/* Add to your styles */
.more-below-indicator {
  text-align: center;
  padding: 15px;
  background: var(--surface);
  border: 1px dashed var(--border);
  margin: 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  color: var(--text-secondary);
  font-size: 13px;
}

.more-below-indicator button {
  padding: 6px 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.more-below-indicator button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* Fade out animation for removed messages */
.message-row {
  transition: opacity 0.3s ease, transform 0.3s ease;
}




/* Mobile responsive */
@media (max-width: 480px) {
  .modal-header h2 {
      font-size: 1.5rem;
  }
  
  .amount {
      font-size: 2.5rem;
  }
  
  .modal-actions {
      flex-direction: column;
  }
  
  .btn-secondary {
      width: 100%;
  }
}
/* Safari bottom bar fix - MORE AGGRESSIVE */
/* Safari-specific fix - ONLY move messages up */
@supports (-webkit-touch-callout: none) {
  /* iPhone Safari detection */
  @media screen and (max-width: 414px) {
    #messages {
      /* Move messages container up significantly on Safari */
      bottom: 60px !important;
      height: calc(100vh - 260px) !important;
    }
  }
}

/* Alternative approach using webkit-specific selector */
@media screen and (max-width: 768px) {
  /* This targets Safari specifically */
  _::-webkit-full-page-media, _:future, :root #messages {
    margin-bottom: 60px !important;
    height: calc(100vh - 260px) !important;
  }
}



/* Diagram styles - ALWAYS loaded */
.diagram-container {
  margin: 20px auto;
  padding: 15px;
  background: rgba(79, 209, 199, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(79, 209, 199, 0.2);
  position: relative;
  max-width: 100%;
  overflow: hidden;
}

.diagram-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px;
  overflow-x: hidden;
}

.diagram-visual svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

details {
  text-align: center;
}

details summary {
  background: rgba(79, 209, 199, 0.1);
  border: 1px solid #4fd1c7;
  color: #4fd1c7;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: inline-block;
}

details summary:hover {
  background: rgba(79, 209, 199, 0.2);
}

@keyframes diagram-pulse {  /* CHANGED FROM 'pulse' TO 'diagram-pulse' */
  0%, 100% { opacity: 0.5; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

.diagram-node-rect {
  transition: all 0.3s ease;
}

.diagram-node-rect:hover {
  fill-opacity: 0.4;
  stroke-width: 2;
}


/* Fix ASCII overflow on load */
.bubble-bot pre,
.bubble-bot code {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Add these animation definitions globally */
@keyframes loadingSweep {
  0% { left: -100%; }
  100% { left: 200%; }
}

@keyframes nodePulse {
  0%, 100% { transform: scale(0.8); opacity: 0.3; }
  50% { transform: scale(1.2); opacity: 1; }
}

@keyframes nodeConnect {
  0%, 100% { opacity: 0.1; transform: scaleX(0.5); }
  50% { opacity: 0.6; transform: scaleX(1); }
}

@keyframes tableBar {
  0%, 100% { 
    height: 10px; 
    opacity: 0.3; 
    transform: scaleY(0.3);
  }
  50% { 
    height: 30px; 
    opacity: 1; 
    transform: scaleY(1);
    filter: brightness(1.2);
  }
}
/* ============================================
   UPGRADE MODAL - MOBILE STYLES
   ============================================ */

/* Tablet adjustments */
@media (max-width: 768px) {
  .upgrade-overlay {
      padding: 15px;
      display: flex;
      align-items: center;
      justify-content: center;
  }

  .upgrade-modal {
      max-width: 100%;
      width: calc(100% - 30px);
      border-radius: 16px;
      margin: auto;
  }

  .modal-header {
      padding: 25px 25px 15px;
  }

  .modal-header h2 {
      font-size: 1.75rem;
  }

  .subtitle {
      font-size: 1rem;
  }

  .modal-body {
      padding: 0 25px 15px;
  }

  .pricing-box {
      padding: 18px;
      margin: 20px 0;
  }

  .amount {
      font-size: 2.5rem;
  }

  .currency {
      font-size: 1.3rem;
  }

  .period {
      font-size: 1.1rem;
  }

  .modal-actions {
      padding: 15px 25px 25px;
  }
}

/* Large phones */
@media (max-width: 480px) {
  .upgrade-overlay {
      padding: 10px;
      display: flex;
      align-items: center;  /* Changed from flex-end to center */
      justify-content: center;
  }

  .upgrade-modal {
      width: calc(100% - 20px);
      max-width: 400px;
      max-height: 85vh;
      margin: auto;
      border-radius: 20px;  /* Changed to round all corners */
      overflow-y: auto;
  }

  .modal-header {
      padding: 20px 20px 12px;
      position: sticky;
      top: 0;
      background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
      z-index: 10;
      border-radius: 20px 20px 0 0;
  }

  .modal-header h2 {
      font-size: 1.5rem;
      margin: 0 0 8px 0;
  }

  .subtitle {
      font-size: 0.95rem;
      line-height: 1.3;
  }

  .modal-body {
      padding: 0 20px 10px;
  }

  .benefits-list {
      margin: 15px 0;
  }

  .benefit-item {
      padding: 10px 0;
      font-size: 0.9rem;
      line-height: 1.4;
  }

  .pricing-box {
      padding: 15px;
      margin: 18px 0;
      border-radius: 12px;
  }

  .price-tag {
      margin-bottom: 8px;
  }

  .currency {
      font-size: 1.2rem;
      margin-right: 1px;
  }

  .amount {
      font-size: 2.2rem;
  }

  .period {
      font-size: 1rem;
      margin-left: 4px;
  }

  .price-comparison {
      font-size: 0.85rem;
      margin: 4px 0;
  }

  .value-prop {
      font-size: 0.9rem;
      margin: 8px 0 0 0;
  }

  .timer-notice {
      padding: 8px;
      font-size: 0.85rem;
      gap: 6px;
      border-radius: 8px;
  }

  .modal-actions {
      padding: 15px 20px 20px;
      flex-direction: column;
      gap: 10px;
      position: sticky;
      bottom: 0;
      background: linear-gradient(to top, #0f0f1e 80%, transparent);
      margin-top: 10px;
  }

  .btn-primary {
      width: 100%;
      padding: 14px;
      font-size: 1rem;
      border-radius: 8px;
  }

  .btn-secondary {
      width: 100%;
      padding: 12px;
      font-size: 0.9rem;
      border-radius: 8px;
      order: 2;  /* Move cancel button below */
  }

  /* Animation adjustments for mobile - changed to fade in */
  @keyframes fadeInScale {
      from {
          transform: scale(0.9);
          opacity: 0;
      }
      to {
          transform: scale(1);
          opacity: 1;
      }
  }

  .upgrade-modal {
      animation: fadeInScale 0.3s ease;
  }

  /* Faster animations on mobile */
  .benefit-item {
      animation-duration: 0.3s;
  }

  .benefit-item:nth-child(1) { animation-delay: 0.05s; }
  .benefit-item:nth-child(2) { animation-delay: 0.1s; }
  .benefit-item:nth-child(3) { animation-delay: 0.15s; }
  .benefit-item:nth-child(4) { animation-delay: 0.2s; }
  .benefit-item:nth-child(5) { animation-delay: 0.25s; }
}

/* Small phones */
@media (max-width: 375px) {
  .upgrade-overlay {
      display: flex;
      align-items: center;
      justify-content: center;
  }

  .upgrade-modal {
      max-height: 90vh;
      border-radius: 16px;
  }

  .modal-header {
      padding: 18px 18px 10px;
  }

  .modal-header h2 {
      font-size: 1.35rem;
  }

  .subtitle {
      font-size: 0.9rem;
  }

  .modal-body {
      padding: 0 18px 10px;
  }

  .benefit-item {
      padding: 9px 0;
      font-size: 0.85rem;
  }

  .pricing-box {
      padding: 14px;
      margin: 15px 0;
  }

  .currency {
      font-size: 1.1rem;
  }

  .amount {
      font-size: 2rem;
  }

  .period {
      font-size: 0.95rem;
  }

  .price-comparison,
  .timer-notice {
      font-size: 0.8rem;
  }

  .value-prop {
      font-size: 0.85rem;
  }

  .modal-actions {
      padding: 12px 18px 18px;
      gap: 8px;
  }

  .btn-primary {
      padding: 12px;
      font-size: 0.95rem;
  }

  .btn-secondary {
      padding: 10px;
      font-size: 0.85rem;
  }
}

/* Tiny phones */
@media (max-width: 320px) {
  .upgrade-overlay {
      display: flex;
      align-items: center;
      justify-content: center;
  }

  .upgrade-modal {
      max-height: 92vh;
      border-radius: 16px;
  }

  .modal-header {
      padding: 15px 15px 8px;
  }

  .modal-header h2 {
      font-size: 1.25rem;
  }

  .subtitle {
      font-size: 0.85rem;
  }

  .modal-body {
      padding: 0 15px 8px;
  }

  .benefits-list {
      margin: 12px 0;
  }

  .benefit-item {
      padding: 8px 0;
      font-size: 0.8rem;
      line-height: 1.35;
  }

  .pricing-box {
      padding: 12px;
      margin: 12px 0;
      border-radius: 10px;
  }

  .currency {
      font-size: 1rem;
  }

  .amount {
      font-size: 1.8rem;
  }

  .period {
      font-size: 0.9rem;
  }

  .price-comparison,
  .timer-notice,
  .value-prop {
      font-size: 0.75rem;
  }

  .modal-actions {
      padding: 10px 15px 15px;
  }

  .btn-primary {
      padding: 11px;
      font-size: 0.9rem;
      border-radius: 6px;
  }

  .btn-secondary {
      padding: 9px;
      font-size: 0.8rem;
      border-radius: 6px;
  }
}

/* Special handling for iOS Safari safe areas */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 480px) {
      .upgrade-modal {
          padding-bottom: env(safe-area-inset-bottom);
      }

      .modal-actions {
          padding-bottom: calc(20px + env(safe-area-inset-bottom));
      }
  }
}

/* Landscape mode adjustments */
@media (max-height: 500px) and (orientation: landscape) {
  .upgrade-modal {
      max-height: 95vh;
  }

  .modal-header {
      padding: 15px 20px 8px;
  }

  .modal-header h2 {
      font-size: 1.3rem;
  }

  .subtitle {
      display: none;  /* Hide subtitle in landscape to save space */
  }

  .benefits-list {
      margin: 10px 0;
  }

  .benefit-item {
      padding: 6px 0;
      font-size: 0.8rem;
  }

  .pricing-box {
      padding: 10px;
      margin: 10px 0;
  }

  .amount {
      font-size: 1.8rem;
  }

  .modal-actions {
      flex-direction: row;
      padding: 10px 20px 15px;
  }

  .btn-primary,
  .btn-secondary {
      padding: 10px 15px;
      font-size: 0.85rem;
  }
}

