.globe-languages-btn {
  background: none;
  border: none;
  margin-left: 0.5rem;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  opacity: 0.85;
}
.globe-languages-btn svg {
  width: 24px;
  height: 24px;
  stroke: #031036;
  fill: none;
  opacity: 0.85;
  vertical-align: middle;
}
.globe-languages-btn:hover {
  background: #f3f4f6;
  border-radius: 50%;
}
.languages-info-popup {
  position: fixed;
  left: 0; right: 0; bottom: 0; top: 0;
  background: rgba(40,40,60,0.35);
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.languages-info-content {
  background: #fff;
  border-radius: 1.2rem;
  box-shadow: 0 8px 32px #2223 !important;
  max-width: 480px;
  width: 95vw;
  padding: 2.2rem 2rem 1.5rem 2rem;
  position: relative;
  font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
  animation: fadeIn 0.3s;
}
.languages-info-close {
  position: absolute;
  top: 0.7rem;
  right: 1.1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #888;
  cursor: pointer;
}
.languages-info-text p {
  margin: 0.5rem 0;
  font-size: 1.05rem;
  color: #222;
}
.languages-enabled-bar {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 2.5rem;
  margin-bottom: 0.5rem;
}
.languages-enabled-btn {
  background: #f3f4f6;
  color: #222;
  border: none;
  border-radius: 2rem;
  padding: 0.7rem 2.2rem;
  font-size: 1.08rem;
  font-weight: 600;
  box-shadow: 0 2px 8px #2222;
  cursor: pointer;
  transition: background 0.2s;
  opacity: 0.85;
}
.languages-enabled-btn:hover {
  background: #e5e7eb;
  opacity: 1;
}
.languages-info-popup {
  position: fixed;
  left: 0; right: 0; bottom: 0; top: 0;
  background: rgba(40,40,60,0.35);
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.languages-info-content {
  background: #fff;
  border-radius: 1.2rem;
  box-shadow: 0 8px 32px #2223 !important;
  max-width: 480px;
  width: 95vw;
  padding: 2.2rem 2rem 1.5rem 2rem;
  position: relative;
  font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
  animation: fadeIn 0.3s;
}
.languages-info-close {
  position: absolute;
  top: 0.7rem;
  right: 1.1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #888;
  cursor: pointer;
}
.languages-info-text p {
  margin: 0.5rem 0;
  font-size: 1.05rem;
  color: #222;
}
.pace-subtle {
  opacity: 1;
  font-size: 1rem;
  margin-left: 3rem;
  justify-self: end;
  color: #031036 !important;
  font-weight: 700;
  letter-spacing: 0.01em;
  filter: none;
}

.pace-chat-subtle {
  position: fixed;
  bottom: 1.2rem;
  right: 1.5rem;
  opacity: 1;
  font-size: 0.95rem;
  z-index: 100;
  pointer-events: none;
  background: none;
  color: #031036 !important;
  font-weight: 700;
  letter-spacing: 0.01em;
  filter: none;
}
/* 
 * Consolidated CSS file for UWA Policy Agent
 * Created: August 19, 2025
 * Updated: August 19, 2025 - Added Dark Mode Support
 * This file combines all styling from separate CSS files to ensure consistent application
 * and eliminate conflicts. Dark mode implementation follows PacePublicShare style guide.
 */

/* ========================================
 * VARIABLES AND BASE STYLES 
 * ======================================== */
:root {
  /* Pace Applied Solutions Design System Colors - Light Theme (Default) */
  --pace-primary-color: #EB9110;
  --pace-primary-dark: #d48209;
  --pace-secondary-color: #505050;
  --pace-accent-color: #0046AD;
  --primary-blue: #0046AD;
  --primary-dark: #003080;
  --pace-background-color: #f9f9f9;
  --pace-card-background: #fff;
  --pace-header-background: #f8fafc; /* Light header background for logo contrast */
  --pace-text-color: #333;
  --pace-text-light: #666;
  --pace-text-color-muted: #64748b;
  --pace-border-color: #e5e5e5;
  --pace-shadow-color: rgba(0,0,0,0.08);
  
  /* Enhanced gradient backgrounds */
  --bg-gradient-primary: linear-gradient(135deg, #f9f9f9 0%, #eff6ff 50%, #f8fafc 100%);
  --bg-gradient-hero: linear-gradient(135deg, rgba(235, 145, 16, 0.05) 0%, rgba(0, 70, 173, 0.05) 100%);
  
  /* Spacing system */
  --pace-spacing-xs: 0.25rem;
  --pace-spacing-sm: 0.5rem;
  --pace-spacing-md: 1rem;
  --pace-spacing-lg: 1.5rem;
  --pace-spacing-xl: 2rem;
  --pace-spacing-2xl: 3rem;
  --pace-spacing-3xl: 4rem;
  
  /* Typography scale */
  --pace-font-size-xs: 0.75rem;
  --pace-font-size-sm: 0.875rem;
  --pace-font-size-base: 1rem;
  --pace-font-size-lg: 1.125rem;
  --pace-font-size-xl: 1.25rem;
  --pace-font-size-2xl: 1.5rem;
  --pace-font-size-3xl: 1.875rem;
  --pace-font-size-4xl: 2.25rem;
  --pace-font-size-5xl: 3rem;
  
  /* Shadows */
  --pace-shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --pace-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --pace-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --pace-shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
  
  /* Border radius */
  --pace-border-radius-sm: 4px;
  --pace-border-radius: 6px;
  --pace-border-radius-md: 6px;
  --pace-border-radius-lg: 8px;
  --pace-border-radius-xl: 12px;
  
  /* Branding sizes */
  --pace-logo-size: 50px; /* Single source of truth for Pace logo size */

  /* Transitions */
  --pace-transition-fast: 0.15s ease;
  --pace-transition: 0.2s ease;
  --pace-transition-slow: 0.3s ease;
}

/* ================================================
   Dark Theme Colors - Following PacePublicShare Style Guide
   ================================================ */
body[data-theme="dark"] {
  /* Dark Theme Color Overrides - Aligned with PacePublicShare */
  --pace-primary-color: #F59E0B;        /* Bright orange for dark mode accessibility */
  --pace-primary-dark: #D97706;         /* Darker orange for hovers and accents */
  --pace-secondary-color: #9CA3AF;      /* Lighter secondary for dark theme */
  --pace-accent-color: #60A5FA;         /* Lighter blue for better contrast */
  --primary-blue: #60A5FA;              /* Consistent with accent color */
  --primary-dark: #3B82F6;              /* Darker blue for hover states */
  --pace-background-color: #111827;     /* Dark background */
  --pace-card-background: #1F2937;      /* Dark card background */
  --pace-header-background: #e5e7eb;    /* Light header background for dark logo contrast */
  --pace-text-color: #F9FAFB;           /* Light text */
  --pace-text-light: #D1D5DB;           /* Light secondary text */
  --pace-text-color-muted: #9CA3AF;     /* Muted text for dark theme */
  --pace-border-color: #374151;         /* Dark border */
  --pace-shadow-color: rgba(0,0,0,0.3); /* Darker shadow for depth */
  
  /* Dark theme gradient backgrounds */
  --bg-gradient-primary: linear-gradient(135deg, #111827 0%, #1F2937 50%, #374151 100%);
  --bg-gradient-hero: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(96, 165, 250, 0.1) 100%);
}

/* ================================================
   System Preference Detection - Following PacePublicShare Pattern
   ================================================ */
@media (prefers-color-scheme: dark) {
  body:not([data-theme="light"]) {
    /* Only apply dark theme if user hasn't explicitly selected light */
    --pace-primary-color: #F59E0B;        /* Bright orange for system dark mode */
    --pace-primary-dark: #D97706;         /* Darker orange for hovers and accents */
    --pace-secondary-color: #9CA3AF;
    --pace-accent-color: #60A5FA;
    --primary-blue: #60A5FA;
    --primary-dark: #3B82F6;
    --pace-background-color: #111827;
    --pace-card-background: #1F2937;
    --pace-text-color: #F9FAFB;
    --pace-text-light: #D1D5DB;
    --pace-text-color-muted: #9CA3AF;
    --pace-border-color: #374151;
    --pace-shadow-color: rgba(0,0,0,0.3);
    
    /* Dark theme gradient backgrounds for system preference */
    --bg-gradient-primary: linear-gradient(135deg, #111827 0%, #1F2937 50%, #374151 100%);
    --bg-gradient-hero: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(96, 165, 250, 0.1) 100%);
  }
}

/* ========================================
 * WEB FONTS
 * ======================================== */
@font-face {
  font-family: 'Agency FB';
  src: local('Agency FB Bold'), local('AgencyFB-Bold'),
       url('./AgencyFB-Bold.ttf') format('truetype'),
       url('https://raw.githubusercontent.com/Pace-Applied-Solutions/PacePublicShare/main/assets/fonts/AgencyFB-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-gradient-primary);
  min-height: 100vh;
  color: var(--pace-text-color);
  line-height: 1.6;
  overflow: hidden; /* Prevent any scrolling at body level */
  position: fixed; /* Lock the body in place */
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh; /* Use dynamic viewport on mobile to avoid white screens */
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* ========================================
 * LAYOUT AND STRUCTURE
 * ======================================== */

/* Prevent page scrolling when chat is active */
body.chat-active {
  overflow: hidden;
  height: 100vh;
}

/* Main app container */
#app {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh; /* Improved mobile compatibility */
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Full-screen landing page layout */
.landing {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--pace-spacing-md);
  background: var(--bg-gradient-hero);
  position: relative;
  box-sizing: border-box;
  overflow: hidden; /* Prevent scrolling */
}

/* Responsive container for landing content */
.landing-content {
  width: 100%;
  max-width: min(98vw, 2000px);
  height: 100%;
  text-align: center;
  background: var(--pace-card-background);
  border-radius: var(--pace-border-radius-xl);
  padding: 10vh 2rem; /* Increased top/bottom padding */
  box-shadow: var(--pace-shadow-xl);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Distribute content vertically */
  max-width: 1200px;
  overflow-y: auto; /* Enable vertical scrolling only if needed */
  overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Version info */
.version-info {
  position: fixed;
  bottom: 0.5rem;
  right: 0.5rem;
  font-size: 0.7rem;
  opacity: 0.5;
  z-index: 1000;
}

/* ========================================
 * HEADER STYLING
 * ======================================== */

/* Header and branding styles */
.header {
  display: block !important; /* Override flex-direction: column */
  padding: 2rem 2rem;
  margin-top: 2vh !important;
  margin-bottom: 5vh !important;
  text-align: center;
  background: var(--pace-header-background);
  border-radius: var(--pace-border-radius-lg);
  box-shadow: var(--pace-shadow-sm);
  border: 1px solid var(--pace-border-color);
  /* Ensure header properly contains its content */
  overflow: visible;
  width: 100%;
  box-sizing: border-box;
}

/* Header container layout - wide screens */
.header-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  grid-template-areas: "title logo pace actions";
  gap: 0.75rem;
  position: relative;
  margin-bottom: 0;
  width: 100%;
  max-width: 100%;
  align-items: center;
  justify-items: center;
  /* Ensure container is properly centered within header */
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* Header title styling */
.header-container .title,
.header-container .title,
.header-container h1.title {
  grid-area: title;
  text-align: left;
  font-family: 'Agency FB', 'AgencyFB-Bold', Arial, sans-serif;
  font-weight: bold;
  font-size: 2.2rem;
  margin: 0;
  color: #031036;
  letter-spacing: 0.04em;
}
/* Header logo styling */
.header-container .chat-logo,
.header-container .logo {
  grid-area: logo;
  width: 150px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0 !important;
}

/* "Powered by Pace" subtitle */
.header-container .subtitle {
  grid-area: pace;
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-size: 1.1rem;
  color: var(--pace-text-color-muted);
}

/* Header actions area */
.header-container .header-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--pace-spacing-sm);
}

/* Pace logo wrapper */
.pace-logo-wrapper {
  display: flex;
  align-items: center;
  margin-right: 0.5rem;
  width: var(--pace-logo-size);
  height: var(--pace-logo-size);
}

.pace-logo-wrapper svg {
  width: 100%;
  height: 100%;
}

.pace-text {
  white-space: nowrap;
  font-size: 1.1rem;
}

/* Logo animation */
.subtitle:hover .pace-logo {
  transform: rotate(360deg);
}

/* --- Header element sizing fixes --- */
/* Pace logo element can be an <img> with class pace-logo or inline <svg> inside wrapper */
.pace-logo { width: var(--pace-logo-size); height: var(--pace-logo-size); display: inline-block; object-fit: contain; }
.pace-logo-wrapper { width: var(--pace-logo-size); height: var(--pace-logo-size); flex: 0 0 var(--pace-logo-size); }
.pace-logo-wrapper img, .pace-logo-wrapper svg { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Ensure the center logo (UWA/brand) never overflows its box */
.header-container .logo img,
.header-container .logo svg,
.header-container .chat-logo img,
.header-container .chat-logo svg { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Tighten typography height in header */
.header-container .title { line-height: 1.1; }
.header-container .subtitle { line-height: 1; align-items: center; }

/* ========================================
 * INPUT GROUP STYLING
 * ======================================== */

/* Input group base styling */
.landing-content .input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 800px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-top: 8vh;
  margin-bottom: 8vh;
  position: relative;
  z-index: 1;
}

/* Input field styling */
.landing-content input#promptInput {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
  font-size: 1.25rem;
  height: 60px;
  line-height: 1.5;
  border-radius: var(--pace-border-radius-lg);
  border: 2px solid var(--pace-border-color);
  transition: all var(--pace-transition);
  background: var(--pace-card-background);
  font-family: inherit;
}

/* Input focus states */
input:focus {
  outline: none;
  border-color: var(--pace-accent-color);
  box-shadow: 0 0 0 3px rgba(0, 70, 173, 0.1);
  transform: translateY(-2px);
}

input::placeholder {
  color: var(--pace-text-light);
}

/* Button styling */
.landing-content button#startBtn {
  width: 100%;
  max-width: 240px;
  padding: 1rem 1.75rem;
  font-size: 1.2rem;
  height: 60px;
  border-radius: var(--pace-border-radius-lg);
  background: linear-gradient(135deg, var(--pace-accent-color) 0%, #0056D6 100%);
  color: white;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--pace-transition);
  font-family: inherit;
  box-shadow: var(--pace-shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.btn:hover {
  background: linear-gradient(135deg, #0056D6 0%, var(--pace-accent-color) 100%);
  transform: translateY(-2px);
  box-shadow: var(--pace-shadow-lg);
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ========================================
 * SUGGESTIONS STYLING
 * ======================================== */

/* Suggestions section container */
.landing-content .suggestions {
  margin-top: 8vh;
  margin-bottom: 4vh;
  width: 100%;
  max-width: 100%;
}

/* Suggestions title */
.suggestions h3 {
  font-size: 1.2rem !important;
  margin-bottom: 2rem !important;
  font-weight: 500;
  color: var(--pace-text-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Suggestions grid layout */
.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem !important;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

/* Individual suggestion buttons */
.suggestion-btn {
  padding: 1.25rem !important;
  border-radius: var(--pace-border-radius-lg) !important;
  font-size: 1rem !important;
  line-height: 1.6;
  box-shadow: var(--pace-shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  min-height: 100px;
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--pace-card-background);
  border: 1px solid var(--pace-border-color);
  cursor: pointer;
  color: var(--pace-text-color);
}

/* Suggestion button affordance */
.suggestion-btn { cursor: pointer; -webkit-user-select: none; user-select: none; }
.suggestion-btn:active { transform: translateY(-1px) scale(0.996); }
/* Enhanced suggestion visuals from archive */
.suggestion-btn:hover { transform: translateY(-3px); box-shadow: var(--pace-shadow-md); border-color: var(--pace-accent-color); }
.suggestion-btn::before { content: attr(data-emoji); position: absolute; top: 1rem; left: 1rem; font-size: 1.2rem; opacity: 0.7; }

/* Ensure the suggestions container doesn't capture scroll that hides content */
.suggestions { position: relative; z-index: 1; }

/* ========================================
 * CHAT INTERFACE STYLING
 * ======================================== */

/* Chat container layout */
.chat-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  background: var(--pace-card-background);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevent container scrolling */
}

/* Ensure chat interface is fully contained */
.chat {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  overflow: hidden;
}

/* Chat header styling */
.chat-header {
  padding: 1.5rem 2rem;
  min-height: 80px;
  max-height: 90px;
  border-bottom: 1px solid var(--pace-border-color);
  display: flex;
  align-items: center;
  justify-content: center; /* Center the header container */
  background: var(--pace-header-background);
  z-index: 10;
  flex-shrink: 0;
  /* Ensure header properly contains its content */
  overflow: visible;
  width: 100%;
  box-sizing: border-box;
}

/* Ensure chat header container is properly sized */
.chat-header .header-container {
  max-width: calc(100% - 2rem);
  width: 100%;
}

/* Chat body layout */
.chat-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0; /* allow children to size correctly within flex */
}

/* Main chat area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0; /* prevent overflow issues on mobile */
}

/* Messages container - ONLY THIS SHOULD SCROLL */
.messages {
  flex: 1;
  overflow-y: auto; /* Enable scrolling here */
  padding: 2vh 0;
  scroll-behavior: smooth; /* Smooth scrolling when programmatically scrolled */
  min-height: 0; /* ensure scroll container gets space */
}

/* Layout the chat area and sidebar side-by-side on larger screens */
@media (min-width: 1024px) {
  .chat-body { display: grid; grid-template-columns: 1fr 350px; }
  .chat-main { min-width: 0; }
}

/* Show a lightweight placeholder while waiting for the first response */
.messages:empty {
  display: flex;
  align-items: center;
  justify-content: center;
}
.messages:empty::before {
  content: 'Thinking…';
  color: var(--pace-text-light);
  font-style: italic;
  animation: pulse 1.5s infinite;
}
.messages:empty::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(139, 92, 246, 0.3);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}
.status-indicator { position: absolute; top: -2rem; left: 1.5rem; font-size: 0.75rem; color: var(--pace-text-light); font-style: italic; }
.error-message { background: #FEE2E2; color: #DC2626; border: 1px solid #FECACA; border-radius: 0.5rem; padding: 0.75rem; margin: 0.5rem 0; font-size: 0.875rem; }

/* Suggestion button entrance animation and delays */
@keyframes slideInFromRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.chat-suggestion-btn { animation: slideInFromRight 0.4s ease-out backwards; }
.chat-suggestion-btn:nth-child(1) { animation-delay: 0.1s; }
.chat-suggestion-btn:nth-child(2) { animation-delay: 0.15s; }
.chat-suggestion-btn:nth-child(3) { animation-delay: 0.2s; }
.chat-suggestion-btn:nth-child(4) { animation-delay: 0.25s; }
.chat-suggestion-btn:nth-child(5) { animation-delay: 0.3s; }
.chat-suggestion-btn:nth-child(6) { animation-delay: 0.35s; }

/* Message styling */
.message {
  margin-bottom: 3vh;
  padding: 1.5vh 2vw;
  display: flex;
  align-items: flex-start;
}

/* Chat input styling */
.chat-input {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--pace-border-color);
  flex-shrink: 0; /* Prevent shrinking */
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

.chat-input input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  font-size: var(--pace-font-size-lg);
  height: 50px;
  line-height: 1.4;
  border: 2px solid var(--pace-border-color);
  border-radius: var(--pace-border-radius-lg);
  transition: all var(--pace-transition);
  background: var(--pace-card-background);
  font-family: inherit;
}

.chat-input button {
  width: 100%;
  max-width: 180px;
  margin-left: auto;
  margin-right: auto;
  padding: 0.8rem 1.25rem;
  font-size: var(--pace-font-size-lg);
  height: 50px;
  background: linear-gradient(135deg, var(--pace-accent-color) 0%, #0056D6 100%);
  color: white;
  font-weight: 600;
  border: none;
  border-radius: var(--pace-border-radius-lg);
  cursor: pointer;
  transition: all var(--pace-transition);
  font-family: inherit;
  box-shadow: var(--pace-shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chat-input button:disabled {
  background: #9CA3AF;
  cursor: not-allowed;
}

/* ========================================
 * RESPONSIVE MEDIA QUERIES
 * ======================================== */

/* Widescreen layout - input and button side by side */
@media (min-width: 768px) {
  /* Landing input group */
  .landing-content .input-group {
    flex-direction: row;
    gap: 0;
    margin-top: 6vh;
    margin-bottom: 6vh;
  }
  
  .landing-content input#promptInput {
    margin-bottom: 0;
    border-radius: var(--pace-border-radius-xl) 0 0 var(--pace-border-radius-xl);
  }
  
  .landing-content button#startBtn {
    width: 160px;
    min-width: 160px;
    border-radius: 0 var(--pace-border-radius-xl) var(--pace-border-radius-xl) 0;
  }
  
  /* Chat input */
  .chat-input {
    flex-direction: row;
    gap: 0.75rem;
    align-items: center;
  }
  
  .chat-input input {
    margin-bottom: 0;
    flex: 1;
    border-radius: var(--pace-border-radius-lg) 0 0 var(--pace-border-radius-lg);
  }
  
  .chat-input button {
    width: 100px;
    min-width: 100px;
    margin: 0;
    border-radius: 0 var(--pace-border-radius-lg) var(--pace-border-radius-lg) 0;
  }
  
  /* Suggestions grid */
  .suggestions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Better vertical spacing on desktop */
  .landing-content {
    padding: 12vh 2.5rem;
  }
  
  .landing-content .header {
    margin-bottom: 7vh;
  }
  
  .landing-content .suggestions {
    margin-top: 7vh;
    margin-bottom: 5vh;
  }
  
  /* Align input and button heights perfectly */
  .landing-content input#promptInput,
  .landing-content button#startBtn,
  .chat-input input,
  .chat-input button {
    height: 50px;
  }
}

/* Medium screens (tablet) */
@media (max-width: 940px) {
  /* Shrink logo via variable and hide pace text to preserve space */
  :root { --pace-logo-size: 24px; }
  .header-container {
    grid-template-columns: auto 1fr auto auto;
    grid-template-areas: "title logo pace actions";
    gap: 0.6rem;
  }
  
  .header-container .title {
    font-size: 1rem;
  }
  
  .header-container .chat-logo,
  .header-container .logo {
    width: 75px;
    height: 30px;
  }
  
  .pace-text {
  font-size: 0.85rem;
  display: none; /* Hide POWERED BY PACE text at medium sizes, keep logo icon */
  }
  
  .pace-logo-wrapper {
  width: var(--pace-logo-size);
  height: var(--pace-logo-size);
  }
}

/* Small screens (mobile) */
@media (max-width: 640px) {
  /* Further reduce logo and stack header vertically for maximum usable area */
  :root { --pace-logo-size: 18px; }
  .header-container {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "logo actions"
      "title title"
      "pace pace";
    justify-items: center;
    gap: 0.4rem;
  }
  
  .header-container .header-actions {
    justify-content: flex-end;
  }
  
  .header-container .title {
    font-size: 0.9rem;
    justify-content: center;
    text-align: center;
  }
  
  /* Keep the subtitle area but center it; text already hidden via .pace-text rule above */
  .header-container .subtitle { grid-area: pace; justify-content: center; }
  
  .landing-content {
    padding: 6vh 1rem;
  }
  /* Reposition version label above input area on mobile */
  .version-info { bottom: 5rem; right: var(--pace-spacing-sm); font-size: 0.625rem; padding: 0.125rem 0.25rem; }
}

/* Large screen improvements */
@media (min-width: 1200px) {
  .landing-content {
    max-width: 1400px;
    padding: 15vh 3rem;
  }
  
  .landing-content .header {
    margin-bottom: 8vh;
  }
  
  .landing-content .input-group {
    margin: 9vh 0;
  }
  
  .landing-content .suggestions {
    margin-top: 9vh;
    margin-bottom: 6vh;
  }
  
  .suggestion-btn {
    min-height: 120px;
  }
}

/* Ultra-wide screen improvements */
@media (min-width: 1920px) {
  .landing-content {
    max-width: 1600px;
    padding: 18vh 4rem;
  }
  
  .landing-content .header {
    margin-bottom: 10vh;
  }
  
  .landing-content .input-group {
    margin: 12vh 0;
  }
  
  .landing-content .suggestions {
    margin-top: 12vh;
    margin-bottom: 8vh;
  }
}

/* ========================================
 * ANIMATIONS AND TRANSITIONS
 * ======================================== */

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

/* Fade-in-up animation */
@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* --- State and branding overrides (appended) --- */

/* Ensure landing sits above by default but can be disabled when minimized */
.landing { z-index: 5; }

/* Hide chat until activated; only becomes interactive when .active is applied by JS */
.chat {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}

.chat.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s;
}

/* Ensure chat becomes visible as soon as chat mode starts to prevent white screen on mobile */
body.chat-active .chat {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s;
}

/* When sending, ensure chat is fully visible regardless of other state */
body.chat-sending .chat { opacity: 1 !important; visibility: visible !important; pointer-events: auto !important; transform: none !important; }

/* Fallback: when landing is minimized, reveal chat even if JS hasn't toggled .chat.active yet */
.landing.minimized ~ .chat-container .chat {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s;
}

/* Robust fallback: when the document contains a minimized landing, show chat regardless of DOM order */
body:has(.landing.minimized) .chat {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s;
}

/* Minimize/phase-out the landing when chat starts */
.landing.minimized {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.landing.minimized .header,
.landing.minimized .input-group,
.landing.minimized .suggestions,
.landing.minimized .landing-content {
  opacity: 0;
  transform: translateY(-8px);
  display: none; /* fully remove from flow to avoid covering chat */
}

/* If chat interface is present as a sibling, dampen landing content even before .minimized toggles */
#app:has(#chatInterface) .landing .landing-content {
  opacity: 0.001; /* effectively invisible but avoids layout jumps on older engines */
}

/* Pace branding: enforce Agency FB in ALL CAPS */
.header-container .subtitle, .pace-text {
  font-family: 'Agency FB', 'Arial Black', sans-serif !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em;
  font-weight: 700;
}

/* Keep the Pace logo icon a consistent size */
.pace-logo-wrapper { width: var(--pace-logo-size); height: var(--pace-logo-size); }
.pace-logo-wrapper svg { width: 100%; height: 100%; }

/* ========================================
 * RECOVERED FROM ARCHIVE: CHAT UI, SIDEBAR, AI STYLES
 * ======================================== */

/* Message layout and bubbles */
.message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  max-width: 85%;
  margin-bottom: 0.75rem;
}
.message.user { flex-direction: row-reverse; margin-left: auto; }
.message-avatar {
  width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: none !important; border: none !important; box-shadow: none !important; border-radius: 0 !important; font-size: 2rem; padding: 0;
}
.message-avatar svg { width: 1.2rem; height: 1.2rem; color: white; }
.message.user .message-avatar { background: var(--primary-blue); }
.message.agent .message-avatar { background: var(--pace-secondary-color); }
.message-content {
  position: relative; padding: 0.75rem 1rem; border-radius: 1rem; box-shadow: var(--pace-shadow-sm); transition: all 0.2s ease; line-height: 1.5; font-size: 0.9rem;
}
.message.user .message-content {
  background: var(--primary-blue); color: white; border: none; border-bottom-right-radius: 0.3rem;
}
.message.agent .message-content {
  background: var(--pace-card-background); color: var(--pace-text-color); border: 1px solid var(--pace-border-color); border-bottom-left-radius: 0.3rem;
}
.message-content:hover { transform: translateY(-1px); box-shadow: var(--pace-shadow-md); }

/* AI response formatting */
.ai-heading { font-weight: 600; margin: 0.75rem 0 0.4rem 0; color: var(--primary-blue); line-height: 1.3; }
.ai-heading:first-child { margin-top: 0; }
.message-content h1.ai-heading { font-size: 1.1rem; }
.message-content h2.ai-heading { font-size: 1rem; }
.message-content h3.ai-heading { font-size: 0.95rem; }
.ai-paragraph { margin: 0.5rem 0; line-height: 1.5; color: var(--pace-text-color); font-size: 0.9rem; }
.ai-paragraph:first-child { margin-top: 0; }
.ai-paragraph:last-child { margin-bottom: 0; }
.ai-list-item { margin: 0.4rem 0; line-height: 1.5; color: var(--pace-text-color); font-size: 0.9rem; }
.ai-list-item.numbered { font-weight: 500; color: var(--primary-blue); }
.ai-list-item.bullet { padding-left: 0.4rem; }
.ai-link { color: var(--primary-blue); text-decoration: underline; transition: color 0.2s ease; }
.ai-link:hover { color: var(--primary-dark); }
.message-content strong { font-weight: 600; color: var(--primary-dark); }
.message-content em { font-style: italic; color: var(--pace-text-light); }

/* Typing indicator */
.message.typing .message-content { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem; }
.typing-dot { width: 0.5rem; height: 0.5rem; background: var(--pace-text-light); border-radius: 50%; animation: typing 1.4s infinite ease-in-out; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-0.5rem); } }

/* Sidebar */
.chat-sidebar {
  width: 350px; min-width: 350px; background: linear-gradient(180deg, #fafbfc 0%, #f8fafc 100%);
  border-left: 1px solid #e2e8f0; display: flex; flex-direction: column; transition: transform 0.3s ease, opacity 0.3s ease; position: relative; box-shadow: -2px 0 8px rgba(0, 0, 0, 0.04);
}
.chat-sidebar.collapsed { transform: translateX(100%); opacity: 0; pointer-events: none; }
.sidebar-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: space-between; background: linear-gradient(180deg, white 0%, #fafbfc 100%); position: sticky; top: 0; z-index: 10; }
.sidebar-title { font-weight: 600; color: var(--pace-text-color); font-size: var(--pace-font-size-sm); display: flex; align-items: center; gap: 0.5rem; }
.sidebar-title::before { content: ''; width: 3px; height: 16px; background: linear-gradient(180deg, var(--pace-primary-color) 0%, var(--pace-accent-color) 100%); border-radius: 2px; }
.sidebar-toggle { background: none; border: none; cursor: pointer; padding: 0.75rem; border-radius: var(--pace-border-radius); color: var(--pace-text-light); transition: all var(--pace-transition); display: flex; align-items: center; justify-content: center; position: relative; }
.sidebar-toggle:hover { background: rgba(59, 130, 246, 0.08); color: var(--pace-accent-color); transform: scale(1.05); }
.sidebar-toggle:active { transform: scale(0.95); }
.sidebar-content { flex: 1; padding: 1.5rem 1rem; overflow-y: auto; }
.sidebar-content::-webkit-scrollbar { width: 6px; }
.sidebar-content::-webkit-scrollbar-track { background: transparent; }
.sidebar-content::-webkit-scrollbar-thumb { background: var(--pace-text-light); border-radius: 3px; }
.sidebar-content::-webkit-scrollbar-thumb:hover { background: var(--pace-text-color-muted); }

/* Chat suggestions in sidebar */
.chat-suggestions { margin: var(--pace-spacing-xl) 0; padding: var(--pace-spacing-lg); background: rgba(235, 145, 16, 0.03); border-radius: var(--pace-border-radius-lg); border: 1px solid rgba(235, 145, 16, 0.1); }
.chat-suggestions-header { font-size: var(--pace-font-size-sm); color: var(--pace-primary-color); margin-bottom: var(--pace-spacing-md); font-weight: 600; text-align: center; }
.chat-suggestions-grid { display: grid; grid-template-columns: 1fr; gap: var(--pace-spacing-sm); }
.chat-suggestion-btn { width: 100%; text-align: left; padding: var(--pace-spacing-md); background: var(--pace-card-background); border: 1px solid var(--pace-border-color); border-radius: var(--pace-border-radius); cursor: pointer; color: var(--pace-text-color); transition: all var(--pace-transition); font-size: var(--pace-font-size-sm); line-height: 1.4; font-family: inherit; position: relative; overflow: hidden; }
.chat-suggestion-btn:hover { background: #eff6ff; border-color: var(--pace-accent-color); transform: translateY(-1px); box-shadow: var(--pace-shadow-sm); }
.chat-suggestion-btn::before { content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 100%; background: var(--pace-primary-color); transform: scaleY(0); transition: transform var(--pace-transition); }
.chat-suggestion-btn:hover::before { transform: scaleY(1); }

/* AI generated (purple) variant */
.chat-suggestion-btn.ai-generated { border-color: #8b5cf6 !important; background-color: rgba(139, 92, 246, 0.05) !important; }
.chat-suggestion-btn.ai-generated::before { background: #8b5cf6 !important; }
.chat-suggestions-header.ai-generated { color: #8b5cf6; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; gap: 0.5rem; }
.chat-suggestion-loading { padding: 0.75rem; font-size: 0.8rem; color: var(--pace-text-light); text-align: center; font-style: italic; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.chat-suggestion-loading span { animation: pulse 1.5s infinite; }
.suggestion-spinner { width: 20px; height: 20px; border: 2px solid rgba(139, 92, 246, 0.3); border-radius: 50%; border-top-color: #8b5cf6; animation: spin 1s linear infinite; margin-bottom: 0.25rem; }
@keyframes spin { to { transform: rotate(360deg);} }

/* Mobile message stacking for better readability */
@media (max-width: 600px) {
  .message, .message.user { display: flex !important; flex-direction: column !important; align-items: stretch !important; max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; gap: 0.25rem !important; }
  .message-avatar { margin: 0 auto 0.25rem auto !important; width: 1.5rem !important; height: 1.5rem !important; display: block !important; position: static !important; order: 0 !important; }
  .message-content { width: 100% !important; max-width: 100vw !important; border-radius: 0.75rem !important; font-size: 0.95rem !important; padding: 0.75rem 1rem !important; margin: 0 !important; order: 1 !important; }
  /* Hide sidebar entirely on mobile */
  .chat-sidebar { display: none !important; }
  .chat-main { margin-right: 0 !important; }
  /* Reduce chat header height */
  .chat-header { padding: var(--pace-spacing-sm) !important; max-height: 10svh; min-height: 56px; }
}

/* ================================================
   Theme Toggle Button - Following PacePublicShare Patterns
   ================================================ */
.theme-toggle {
  background: none;
  border: 1px solid var(--pace-border-color);
  border-radius: var(--pace-border-radius);
  padding: 0.5rem;
  cursor: pointer;
  color: var(--pace-text-color);
  transition: all var(--pace-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  position: relative;
  overflow: hidden;
}

.theme-toggle:hover {
  background: var(--pace-accent-color);
  color: white;
  border-color: var(--pace-accent-color);
  transform: translateY(-1px);
  box-shadow: var(--pace-shadow-sm);
}

.theme-toggle:active {
  transform: translateY(0);
}

.theme-toggle svg,
.globe-languages-btn svg {
  width: 24px;
  height: 24px;
  stroke: #031036;
  fill: none;
  opacity: 0.85;
  vertical-align: middle;
}

/* Theme toggle icon animation */
.theme-toggle .sun-icon {
  opacity: 1;
  transform: rotate(0deg);
}

.theme-toggle .moon-icon {
  opacity: 0;
  transform: rotate(180deg);
  position: absolute;
}

body[data-theme="dark"] .theme-toggle .sun-icon {
  opacity: 0;
  transform: rotate(180deg);
}

body[data-theme="dark"] .theme-toggle .moon-icon {
  opacity: 1;
  transform: rotate(0deg);
  /* Dark stroke on light header background in dark mode */
  color: #111827; /* ensures SVG stroke='currentColor' renders dark */
}

/* Theme toggle positioning in header */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--pace-spacing-sm);
}

/* Dark mode specific adjustments for better visibility */
body[data-theme="dark"] .chat-sidebar {
  background: linear-gradient(180deg, var(--pace-card-background) 0%, var(--pace-background-color) 100%);
  border-left-color: var(--pace-border-color);
}

body[data-theme="dark"] .sidebar-header {
  background: linear-gradient(180deg, #1F2937 0%, #111827 100%);
  border-bottom-color: var(--pace-border-color);
}

body[data-theme="dark"] .chat-suggestion-btn:hover {
  background: rgba(96, 165, 250, 0.1);
}

body[data-theme="dark"] .sidebar-content::-webkit-scrollbar-thumb {
  background: #4B5563;
}

body[data-theme="dark"] .sidebar-content::-webkit-scrollbar-thumb:hover {
  background: #6B7280;
}

/* Dark mode header text adjustments for light background */
body[data-theme="dark"] .header-container .title,
body[data-theme="dark"] .header-container h1.title {
  color: #1F2937; /* Dark text on light header background */
}

body[data-theme="dark"] .header-container .subtitle,
body[data-theme="dark"] .pace-text {
  color: #4B5563; /* Slightly muted dark text */
}

/* AI-generated suggestions section */
.ai-suggestions-section {
  margin-bottom: 2rem;
}
.ai-suggestions-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: #8b5cf6;
  margin-bottom: 1.2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ai-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.ai-suggestion-card {
  background: #f6f3ff;
  border: 2px solid #a78bfa;
  border-radius: 1rem;
  padding: 1.1rem 1.2rem;
  display: flex;
  align-items: center;
  font-size: 1.08rem;
  color: #222;
  box-shadow: 0 2px 8px #a78bfa22;
  transition: box-shadow 0.2s;
}
.ai-suggestion-card:hover {
  box-shadow: 0 4px 16px #a78bfa33;
}
.ai-suggestion-icon {
  font-size: 1.25rem;
  margin-right: 0.7rem;
  color: #8b5cf6;
}
.ai-suggestion-text {
  flex: 1;
}

.ai-paragraph,
.message-content p,
.message-content ul,
.message-content ol,
.message-content li {
  margin: 0.75rem 0 !important;
  line-height: 1.5;
}
.message-content ul,
.message-content ol {
  padding-left: 1.5rem; /* proper indentation */
}

