/* ===== MODERN AI COACHING BOT STYLES ===== */

/* ===== AUTHENTICATION MODAL STYLES ===== */
.auth-modal {
  max-width: 450px;
  min-height: auto;
}

.auth-modal .modal-header {
  text-align: center;
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--glass-border);
}

.auth-modal .modal-header h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.auth-modal .modal-header i {
  color: var(--primary);
  font-size: 1.3rem;
}

.auth-form {
  padding: var(--space-xl) 0;
}

.auth-description {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--space-xl);
  line-height: 1.6;
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: var(--space-sm);
  font-size: 0.9rem;
}

.password-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  padding-right: 3rem;
  background: var(--bg-tertiary);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: var(--bg-secondary);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.password-toggle {
  position: absolute;
  right: var(--space-md);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: color 0.2s ease;
  z-index: 1;
}

.password-toggle:hover {
  color: var(--text-secondary);
}

.auth-error {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  border-radius: var(--radius-md);
  color: var(--error);
  font-size: 0.9rem;
  margin-bottom: var(--space-lg);
  animation: slideIn 0.3s ease;
}

.auth-error i {
  flex-shrink: 0;
}

.auth-actions {
  display: flex;
  justify-content: center;
  margin-top: var(--space-xl);
}

.auth-actions .btn {
  min-width: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  position: relative;
}

.auth-actions .btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.auth-actions .btn .btn-text {
  transition: opacity 0.2s ease;
}

.auth-actions .btn:disabled .btn-text {
  opacity: 0.8;
}

#loginSpinner {
  position: absolute;
  right: var(--space-md);
}

/* Shake animation for modal when clicking outside */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.modal-container.shake {
  animation: shake 0.5s ease-in-out;
}

/* Slide in animation for error messages */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Override modal overlay for auth (prevent closing) */
.modal-overlay#authModal {
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
}

.modal-overlay#authModal .modal-container {
  animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* ===== END AUTHENTICATION MODAL STYLES ===== */

/* CSS Custom Properties for Modern Design System */
:root {
  /* Color Palette - Modern Dark Theme */
  --bg-primary: #0a0a0f;
  --bg-secondary: #151520;
  --bg-tertiary: #1e1e2e;
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-gradient-alt: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  
  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #b8bcc8;
  --text-muted: #6c7293;
  --text-accent: #667eea;
  
  /* Brand Colors */
  --primary: #667eea;
  --primary-hover: #5a6fd8;
  --secondary: #f093fb;
  --accent: #64ffda;
  --success: #00e676;
  --warning: #ff9800;
  --error: #f44336;
  
  /* Glass Morphism */
  --glass-bg: rgba(255, 255, 255, 0.02);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --glass-backdrop: blur(10px);
  
  /* Modern Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.25);
  
  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  
  /* Layout */
  --sidebar-width: 380px;
  --header-height: 70px;
  --border-width: 1px;
  
  /* Transitions */
  --transition-fast: 0.15s ease-out;
  --transition-normal: 0.25s ease-out;
  --transition-slow: 0.4s ease-out;
}

/* ===== RESET & BASE STYLES ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  /* Prevent text scaling issues on mobile devices with large display settings */
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  
  /* Animated background gradient */
  background: radial-gradient(ellipse at top, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  min-height: 100vh;
  min-height: 100dvh; /* Use dynamic viewport height for better mobile support */
  
  /* Prevent zoom issues on mobile devices */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* ===== LAYOUT ===== */
.app-container {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh; /* Use dynamic viewport height for better mobile support */
  position: relative;
}

/* ===== MODERN HEADER ===== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-backdrop);
  border-bottom: var(--border-width) solid var(--glass-border);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--bg-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-switcher {
  display: flex;
  gap: var(--space-sm);
}

.page-switch-btn {
  padding: var(--space-sm) var(--space-lg);
  background: var(--glass-bg);
  border: var(--border-width) solid var(--glass-border);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-normal);
  font-size: 0.9rem;
  font-weight: 500;
  backdrop-filter: var(--glass-backdrop);
}

.page-switch-btn:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.page-switch-btn.active {
  background: var(--bg-gradient);
  color: white;
  border-color: transparent;
}

/* Coaching Type Dropdown Styles */
.coaching-type-selector {
  position: relative;
  display: inline-block;
}

.coaching-type-dropdown {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: var(--space-sm) var(--space-xl) var(--space-sm) var(--space-lg);
  background: var(--glass-bg);
  border: var(--border-width) solid var(--glass-border);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-normal);
  font-size: 0.9rem;
  font-weight: 500;
  backdrop-filter: var(--glass-backdrop);
  min-width: 140px;
  padding-right: 40px; /* Space for dropdown icon */
}

.coaching-type-dropdown:hover {
  background: var(--glass-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.coaching-type-dropdown:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.coaching-type-dropdown option {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: var(--space-sm);
}

.dropdown-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 0.8rem;
  transition: all var(--transition-normal);
}

.coaching-type-selector:hover .dropdown-icon {
  color: var(--text-primary);
}

/* ===== MODERN SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-backdrop);
  border-right: var(--border-width) solid var(--glass-border);
  padding: var(--space-xl);
  overflow-y: auto;
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  z-index: 100;
  
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: var(--radius-full);
}

.sidebar-header {
  margin-bottom: var(--space-xl);
  text-align: center;
}

.sidebar-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--bg-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--space-sm);
}

.version-badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  background: var(--glass-bg);
  border: var(--border-width) solid var(--glass-border);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-muted);
  backdrop-filter: var(--glass-backdrop);
}

/* Profile Section Styles */
.profile-section {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* PDF Upload Section */
.pdf-upload-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.pdf-upload-section h3 {
    margin: 0 0 1rem 0;
    color: #E1E5E9;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pdf-upload-section h3 i {
    color: #FF6B6B;
}

.pdf-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.pdf-input {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #E1E5E9;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.pdf-input:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.pdf-input:focus {
    outline: none;
    border-color: #4ECDC4;
    background: rgba(255, 255, 255, 0.08);
}

.pdf-input::file-selector-button {
    background: #4ECDC4;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    margin-right: 1rem;
    transition: background-color 0.2s ease;
}

.pdf-input::file-selector-button:hover {
    background: #45b7b8;
}

.upload-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #4ECDC4;
    font-size: 0.9rem;
    padding: 0.5rem;
    background: rgba(78, 205, 196, 0.1);
    border-radius: 6px;
}

.upload-status.success {
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.upload-status.error {
    color: #FF6B6B;
    background: rgba(255, 107, 107, 0.1);
}

.pdf-upload-info {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    line-height: 1.4;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #E1E5E9;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== PROFILE SECTIONS ===== */
.profile-section {
  background: var(--glass-bg);
  border: var(--border-width) solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  backdrop-filter: var(--glass-backdrop);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.profile-section:hover {
  background: var(--glass-hover);
  box-shadow: var(--shadow-md);
}

.profile-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.profile-section h2::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
}

/* ===== SESSION CONTROLS ===== */
.session-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.session-info {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  font-size: 0.85rem;
  color: var(--text-muted);
  border: var(--border-width) solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.session-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.session-item small {
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.75rem;
}

.id-container {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-xs);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--glass-border);
}

.session-id-text {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  flex: 1;
  word-break: break-all;
  user-select: all;
}

.copy-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-xs);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
}

.copy-btn:hover {
  background: var(--bg-tertiary);
  color: var(--primary);
  transform: scale(1.05);
}

.copy-btn:active {
  transform: scale(0.95);
}

.copy-btn.copied {
  color: var(--success);
}

.copy-btn.copied i::before {
  content: "\f00c"; /* fa-check */
}

/* ===== MODERN TOGGLE SWITCH ===== */
.rating-toggle-container {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: var(--border-width) solid var(--glass-border);
}

.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  transition: all var(--transition-normal);
  border: 2px solid var(--glass-border);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 2px;
  top: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--bg-gradient);
  border-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
  background: white;
}

.toggle-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ===== ATTRIBUTE RATINGS ===== */
.attribute-ratings {
  margin-top: var(--space-md);
}

.rating-controls {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  align-items: center;
}

.rating-input {
  width: 80px;
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border: var(--border-width) solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.rating-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ratings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  max-height: calc(100vh - 400px);
  overflow-y: auto;
  padding-right: var(--space-sm);
}

.attribute-card {
  background: var(--bg-tertiary);
  border: var(--border-width) solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.attribute-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--bg-gradient);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.attribute-card:hover {
  background: rgba(255, 255, 255, 0.02);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.attribute-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.rating-sliders {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.rating-slider {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.rating-slider label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.rating-slider input[type="range"] {
  width: 100%;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: all var(--transition-fast);
}

.rating-slider input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--bg-gradient);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.rating-slider input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.rating-value {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  text-align: right;
  font-family: var(--font-mono);
}

/* ===== CHAT CONTAINER ===== */
.chat-container {
  flex: 1;
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100dvh - var(--header-height)); /* Use dynamic viewport height */
  background: var(--bg-primary);
}

.chat-messages {
  flex: 1;
  padding: var(--space-xl);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  /* Remove conflicting max-height - let flexbox handle it */
  min-height: 0; /* Important for flexbox scrolling */
  /* Improve scrolling behavior */
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: var(--radius-full);
}

/* ===== MESSAGE STYLES ===== */
.message {
  max-width: 75%;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  position: relative;
  animation: messageSlideIn 0.3s ease-out;
  box-shadow: var(--shadow-sm);
  border: var(--border-width) solid var(--glass-border);
}

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

.user-message {
  align-self: flex-end;
  background: var(--bg-gradient);
  color: white;
  margin-left: auto;
  border-color: transparent;
}

.user-message::before {
  content: '';
  position: absolute;
  right: -8px;
  top: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid var(--primary);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.bot-message {
  align-self: flex-start;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-backdrop);
  border-color: var(--glass-border);
}

.bot-message::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 20px;
  width: 0;
  height: 0;
  border-right: 8px solid var(--glass-bg);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.message-content {
  line-height: 1.7;
  word-wrap: break-word;
}

.message-content h1,
.message-content h2,
.message-content h3 {
  margin: var(--space-md) 0;
  color: var(--text-primary);
}

.message-content p {
  margin: var(--space-sm) 0;
}

.message-content ul {
  margin: var(--space-sm) 0;
  padding-left: var(--space-lg);
}

.message-content li {
  margin: var(--space-xs) 0;
}

.message-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-sm);
  opacity: 0.7;
}

/* ===== COACH BADGES ===== */
.coach-badges {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.coach-badge {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--glass-bg);
  border: var(--border-width) solid var(--glass-border);
  color: var(--text-secondary);
  backdrop-filter: var(--glass-backdrop);
}

.behavioral-coach { border-color: #e3f2fd; color: #2196f3; }
.beliefs-coach { border-color: #f3e5f5; color: #9c27b0; }
.decision-coach { border-color: #e8f5e8; color: #4caf50; }
.wellness-coach { border-color: #fff3e0; color: #ff9800; }

/* ===== LOADING ANIMATION ===== */
.message.loading .message-content {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-muted);
  font-style: italic;
}

.loading-dots {
  display: flex;
  gap: var(--space-xs);
}

.loading-dot {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: loadingBounce 1.4s infinite ease-in-out;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes loadingBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.3;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== TYPING ANIMATION ===== */
.typing-cursor::after {
  content: '|';
  color: var(--primary);
  animation: typingBlink 1s infinite;
  font-weight: 100;
  font-size: 1.1em;
}

@keyframes typingBlink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

/* ===== CHAT INPUT ===== */
.chat-input-container {
  padding: var(--space-xl);
  background: var(--glass-bg);
  border-top: var(--border-width) solid var(--glass-border);
  backdrop-filter: var(--glass-backdrop);
  display: flex;
  gap: var(--space-md);
  align-items: flex-end;
  flex-shrink: 0; /* Prevent input area from shrinking */
}

#messageInput {
  flex: 1;
  padding: var(--space-lg);
  background: var(--bg-tertiary);
  border: var(--border-width) solid var(--glass-border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  resize: none;
  min-height: 60px;
  max-height: 120px;
  transition: all var(--transition-fast);
  line-height: 1.5;
  /* Prevent zoom on focus for iOS devices */
  -webkit-appearance: none;
  appearance: none;
  -webkit-border-radius: var(--radius-lg);
}

#messageInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: var(--bg-secondary);
}

#messageInput::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 50px;
  height: 50px;
  background: var(--bg-gradient);
  border: none;
  border-radius: var(--radius-full);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.send-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-md);
}

.send-btn:active {
  transform: translateY(0) scale(0.95);
}

/* ===== EXAMPLE PROMPTS ===== */
.example-prompts {
  background: var(--glass-bg);
  border-top: var(--border-width) solid var(--glass-border);
  padding: var(--space-xl);
  backdrop-filter: var(--glass-backdrop);
  flex-shrink: 0; /* Prevent prompts area from shrinking */
}

.example-prompts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.example-prompts-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toggle-prompts-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.toggle-prompts-btn h3 {
  margin: 0;
}

.toggle-prompts-btn:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
}

.prompts-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}

.prompts-content.expanded {
  max-height: 800px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.prompts-content::-webkit-scrollbar {
  width: 4px;
}

.prompts-content::-webkit-scrollbar-track {
  background: transparent;
}

.prompts-content::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: var(--radius-full);
}

.prompts-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.prompt-btn {
  background: var(--bg-tertiary);
  border: var(--border-width) solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.5;
}

.prompt-btn:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

/* ===== MODERN BUTTONS ===== */
.btn {
  padding: var(--space-sm) var(--space-lg);
  border: var(--border-width) solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-normal);
  font-size: 0.9rem;
  font-weight: 500;
  backdrop-filter: var(--glass-backdrop);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}

.btn:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  background: var(--bg-gradient);
  color: white;
  border-color: transparent;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  filter: brightness(1.1);
}

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

/* ===== CONVERSATION RATING ===== */
.conversation-rating {
  background: var(--glass-bg);
  border-top: var(--border-width) solid var(--glass-border);
  padding: var(--space-xl);
  backdrop-filter: var(--glass-backdrop);
  animation: slideInUp 0.3s ease-out;
  flex-shrink: 0; /* Prevent rating area from shrinking */
}

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

.rating-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  max-width: 600px;
  margin: 0 auto;
}

.rating-buttons {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
}

.rating-button {
  width: 40px;
  height: 40px;
  border: 2px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  transition: all var(--transition-normal);
  backdrop-filter: var(--glass-backdrop);
}

.rating-button:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.1);
}

.rating-button.selected {
  background: var(--bg-gradient);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-md);
}

.rating-comment {
  width: 100%;
  max-width: 500px;
}

.rating-comment textarea {
  width: 100%;
  min-height: 80px;
  padding: var(--space-lg);
  background: var(--bg-tertiary);
  border: var(--border-width) solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  resize: vertical;
  transition: all var(--transition-fast);
}

.rating-comment textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.comment-counter {
  text-align: right;
  margin-top: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.rating-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
}

/* ===== NOTIFICATIONS ===== */
.notification {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  padding: var(--space-lg) var(--space-xl);
  border-radius: var(--radius-md);
  color: white;
  font-weight: 500;
  z-index: 10000;
  animation: slideInRight 0.3s ease-out;
  backdrop-filter: var(--glass-backdrop);
  box-shadow: var(--shadow-xl);
  border: var(--border-width) solid var(--glass-border);
}

.notification.success {
  background: linear-gradient(135deg, var(--success) 0%, #66bb6a 100%);
}

.notification.error {
  background: linear-gradient(135deg, var(--error) 0%, #ef5350 100%);
}

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

/* ===== UTILITY CLASSES ===== */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== V2 SPECIFIC STYLES ===== */

/* V2 Architecture Info Section */
.v2-architecture-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.architecture-component {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  backdrop-filter: var(--glass-backdrop);
}

.architecture-component h4 {
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0 0 var(--space-xs) 0;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.architecture-component p {
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin: 0;
}

.parallel-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: var(--space-sm);
}

/* V2 Processing Status */
.v2-processing-status {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  backdrop-filter: var(--glass-backdrop);
  animation: slideDown 0.3s ease-out;
}

.v2-processing-status.hidden {
  display: none;
}

.processing-components {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
}

.component-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  flex: 1;
}

.component-status i {
  font-size: 1.25rem;
  color: var(--text-secondary);
}

.component-status span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: var(--space-xs);
  transition: all 0.3s ease;
}

.status-indicator.waiting {
  background: var(--text-muted);
}

.status-indicator.processing {
  background: var(--warning);
  animation: pulse 1s infinite;
}

.status-indicator.complete {
  background: var(--success);
}

/* Agent Display */
.agent-display {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.selected-agent {
  background: var(--glass-bg);
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
}

.selected-agent .agent-name {
  display: block;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: var(--space-xs);
}

.selected-agent .agent-confidence {
  display: block;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.agent-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xs);
}

.agent-option {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  transition: all 0.2s ease;
  cursor: default;
}

.agent-option i {
  font-size: 0.875rem;
  width: 16px;
  text-align: center;
}

.agent-option.inactive {
  background: var(--glass-bg);
  color: var(--text-muted);
  opacity: 0.5;
}

.agent-option.active {
  background: var(--primary);
  color: var(--text-primary);
  transform: scale(1.02);
  box-shadow: var(--shadow-sm);
}

/* V2 Indicator */
.v2-indicator {
  position: fixed;
  bottom: var(--space-md);
  right: var(--space-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--text-primary);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: slideInRight 0.5s ease-out;
}

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* V2 Responsive Design */
@media (max-width: 768px) {
  .processing-components {
    flex-direction: column;
    gap: var(--space-sm);
  }
  
  .agent-list {
    grid-template-columns: 1fr;
  }
  
  .v2-indicator {
    bottom: var(--space-sm);
    right: var(--space-sm);
    font-size: 0.625rem;
    padding: var(--space-xs) var(--space-sm);
  }
}

/* ===== MOBILE-SPECIFIC UTILITIES ===== */
.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

.mobile-priority {
  order: 0;
}

.mobile-first-section {
  /* This section appears first in HTML and stays first on mobile */
  position: relative;
}

/* Desktop: disable collapsible functionality */
@media (min-width: 769px) {
  .toggle-icon {
    display: none;
  }
  
  .collapsible-header {
    cursor: default;
    pointer-events: none;
  }
  
  .collapsible-content {
    max-height: none !important;
    overflow: visible !important;
  }
}

/* Touch-friendly interactions and large display settings handling */
@media (hover: none) and (pointer: coarse) {
  /* Prevent text scaling on large display settings */
  * {
    -webkit-text-size-adjust: 100% !important;
    -moz-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
  }
  
  .btn,
  .page-switch-btn,
  .rating-button,
  .prompt-btn,
  .copy-btn,
  .send-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  .assessment-slider::-webkit-slider-thumb {
    width: 32px;
    height: 32px;
  }
  
  .assessment-slider::-moz-range-thumb {
    width: 32px;
    height: 32px;
  }
  
  .option-marker {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* ===== RESPONSIVE DESIGN ===== */

/* Support for dynamic viewport units on all browsers */
:root {
  --vh: 1vh; /* Fallback, will be overridden by JavaScript */
}

@supports (height: 100dvh) {
  :root {
    --vh-fallback: 100dvh;
  }
}

@supports not (height: 100dvh) {
  :root {
    --vh-fallback: 100vh;
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 320px;
  }
}

@media (max-width: 768px) {
  /* Mobile-specific display utilities */
  .desktop-only {
    display: none !important;
  }
  
  .mobile-only {
    display: block !important;
  }
  
  /* Layout adjustments */
  .app-container {
    flex-direction: column;
    gap: 0;
    min-height: 100vh;
    min-height: 100dvh; /* Use dynamic viewport height */
  }
  
  .sidebar {
    display: none;
  }
  
  .chat-container {
    margin-left: 0;
    margin-bottom: 0;
    width: 100%;
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height)); /* Use dynamic viewport height */
    height: calc(var(--vh, 1vh) * 100 - var(--header-height)); /* JavaScript fallback */
    max-height: calc(100vh - var(--header-height));
    max-height: calc(100dvh - var(--header-height)); /* Use dynamic viewport height */
    max-height: calc(var(--vh, 1vh) * 100 - var(--header-height)); /* JavaScript fallback */
    margin-top: var(--header-height);
    display: flex;
    flex-direction: column;
  }
  
  .app-header {
    padding: 0 var(--space-md);
    height: calc(var(--header-height) * 0.8);
  }
  
  .app-logo {
    font-size: 1.2rem;
  }
  
  .app-logo span {
    display: inline;
    font-size: 1rem;
  }
  
  .mobile-assessment-btn {
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-gradient);
    border: none;
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
  }
  
  .mobile-assessment-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
  }
  
  .mobile-assessment-btn i {
    font-size: 0.9rem;
  }
  
  .page-switcher {
    gap: var(--space-xs);
  }
  
  .page-switch-btn {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.8rem;
  }
  
  .message {
    max-width: 95%;
    padding: var(--space-md);
  }
  
  .prompts-list {
    grid-template-columns: 1fr;
  }
  
  .prompts-content.expanded {
    max-height: 400px;
  }
  
  .rating-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .rating-input {
    width: 100%;
  }
  
  /* Mobile-specific attribute ratings - make it compact */
  .sidebar .profile-section h2 {
    font-size: 0.9rem;
    margin-bottom: var(--space-sm);
  }
  
  .assessment-controls {
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
  }
  
  .assessment-controls .btn {
    justify-content: center;
    width: 100%;
    padding: var(--space-sm);
    font-size: 0.85rem;
    font-weight: 500;
  }
  
  .pdf-upload-section h3 {
    font-size: 0.8rem;
    margin-bottom: var(--space-xs);
  }
  
  .pdf-upload-controls {
    flex-direction: column;
    gap: var(--space-xs);
  }
  
  .pdf-input {
    font-size: 0.8rem;
    padding: var(--space-xs);
  }
  
  #uploadPdfBtn {
    padding: var(--space-sm);
    font-size: 0.8rem;
  }
  
  .pdf-upload-info small {
    font-size: 0.75rem;
  }
  
  /* Collapsible sections on mobile */
  .collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
  }
  
  .toggle-icon {
    transition: transform 0.3s ease;
    font-size: 0.8rem !important;
  }
  
  .collapsible-header.collapsed .toggle-icon {
    transform: rotate(180deg);
  }
  
  .collapsible-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  
  .collapsible-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
  }
  
  /* Start collapsed on mobile */
  .collapsible-content {
    max-height: 0;
  }
  
  .collapsible-header {
    margin-bottom: 0;
  }
  
  .collapsible-header .toggle-icon {
    transform: rotate(180deg);
  }
  
  /* Mobile chat adjustments */
  .chat-messages {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* Important for flexbox scrolling */
    /* Remove conflicting height constraints - let flexbox handle it */
  }
  
  .chat-input-container {
    padding: var(--space-md);
    flex-shrink: 0;
  }
  
  #messageInput {
    min-height: 50px;
    max-height: 100px;
    /* Ensure font size is at least 16px on iOS to prevent zoom */
    font-size: max(16px, 1rem);
  }
  
  .example-prompts {
    padding: var(--space-md);
    padding-top: var(--space-sm);
    padding-bottom: var(--space-md);
    margin: 0;
    flex-shrink: 0;
  }
  
}

@media (max-width: 480px) {
  :root {
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.25rem;
    --header-height: 50px;
  }
  
  .app-header {
    height: var(--header-height);
    padding: 0 var(--space-sm);
  }
  
  .app-logo {
    font-size: 1rem;
  }
  
  .app-logo i {
    font-size: 1.2rem;
  }
  
  .ratings-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
  }
  
  .chat-input-container {
    padding: var(--space-sm);
    gap: var(--space-sm);
  }
  
  .example-prompts {
    padding: var(--space-sm);
  }
  
  .sidebar {
    padding: var(--space-sm);
  }
  
  .sidebar .sidebar-header h1 {
    font-size: 1.2rem;
  }
  
  .profile-section {
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
  }
  
  .chat-messages {
    padding: var(--space-sm);
    /* Remove conflicting max-height - let flexbox handle it */
    min-height: 0; /* Important for flexbox scrolling */
  }
  
  .message {
    padding: var(--space-sm);
  }
  
  .rating-buttons {
    gap: var(--space-xs);
  }
  
  .rating-button {
    width: 35px;
    height: 35px;
    font-size: 0.85rem;
  }
  
  /* Very small screen modal adjustments */
  .modal-overlay {
    padding: var(--space-xs);
    padding-top: var(--space-md);
  }
  
  .modal-header {
    padding: var(--space-sm);
  }
  
  .modal-header h2 {
    font-size: 1.1rem;
  }
  
  .modal-body,
  .modal-content {
    padding: var(--space-sm);
  }
  
  .question-text {
    padding: var(--space-sm);
  }
  
  .question-text p {
    font-size: 0.9rem;
  }
  
  .assessment-slider::-webkit-slider-thumb {
    width: 32px;
    height: 32px;
  }
  
  .assessment-slider::-moz-range-thumb {
    width: 32px;
    height: 32px;
  }
  
  .modal-footer {
    padding: var(--space-sm);
    flex-direction: column;
    gap: var(--space-sm);
  }
  
  .assessment-actions {
    width: 100%;
    justify-content: space-between;
  }
  
  .assessment-actions .btn {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
  }
}

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

/* ===== ATTRIBUTE ASSESSMENT MODAL ===== */

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  animation: fadeIn 0.3s ease-out;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom);
}

.modal-overlay.hidden {
  display: none;
}

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

/* Modal Container */
.modal-container {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-backdrop);
  border: var(--border-width) solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
  max-height: calc(var(--vh, 1vh) * 100 - 2 * var(--space-xl));
  overflow: hidden;
  animation: slideInUp 0.4s ease-out;
  display: flex;
  flex-direction: column;
}

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xl);
  border-bottom: var(--border-width) solid var(--glass-border);
  background: var(--bg-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  background: var(--bg-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-size: 1.2rem;
}

.modal-close-btn:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
}

/* Modal Content */
.modal-content {
  padding: var(--space-xl);
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
  -webkit-overflow-scrolling: touch;
}

.modal-content::-webkit-scrollbar {
  width: 4px;
}

.modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: var(--radius-full);
}

/* Assessment Progress */
.assessment-progress {
  margin-bottom: var(--space-xl);
}

.progress-bar {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  height: 8px;
  margin-bottom: var(--space-md);
  overflow: hidden;
  border: var(--border-width) solid var(--glass-border);
}

.progress-fill {
  height: 100%;
  background: var(--bg-gradient);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width var(--transition-slow);
}

.progress-text {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Assessment Question */
.assessment-question {
  margin-bottom: var(--space-lg);
}

.question-text {
  background: var(--bg-tertiary);
  border: var(--border-width) solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  text-align: center;
}

.question-text p {
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0;
  font-weight: 500;
}

/* Slider Container */
.slider-container {
  margin-top: var(--space-lg);
}

.slider-wrapper {
  position: relative;
  margin-bottom: var(--space-md);
}

.assessment-slider {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  z-index: 2;
}

.assessment-slider::-webkit-slider-thumb {
  appearance: none;
  width: 24px;
  height: 24px;
  background: var(--bg-gradient);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
  border: 3px solid white;
}

.assessment-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: var(--shadow-lg);
}

.assessment-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: var(--bg-gradient);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  border: 3px solid white;
  transition: all var(--transition-fast);
}

.assessment-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: var(--shadow-lg);
}

.slider-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  transform: translateY(-50%);
  z-index: 1;
}

.slider-marks {
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 0;
}

.slider-mark {
  width: 2px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  opacity: 0.3;
}

/* Slider Scale */
.slider-scale {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-sm);
  margin-bottom: var(--space-xs);
  padding: 0 4px;
}

.scale-mark {
  width: 2px;
  height: 8px;
  background: var(--text-muted);
  opacity: 0.4;
  border-radius: 1px;
}

.scale-mark:first-child,
.scale-mark:last-child {
  background: var(--primary);
  opacity: 0.6;
  height: 10px;
}

.scale-mark:nth-child(5) {
  background: var(--primary);
  opacity: 0.8;
  height: 12px;
  width: 3px;
}

/* Option Markers */
.option-markers {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  gap: 2px;
}

.option-marker {
  flex: 1;
  text-align: center;
  padding: var(--space-xs) 2px;
  min-width: 0;
  max-width: 80px;
}

.marker-label {
  font-size: 0.65rem;
  line-height: 1.1;
  color: var(--text-muted);
  font-weight: 400;
  display: block;
  word-wrap: break-word;
  hyphens: auto;
}

/* Current Value Display */
.current-value-display {
  text-align: center;
  padding: var(--space-md);
  background: var(--glass-bg);
  border: var(--border-width) solid var(--glass-border);
  border-radius: var(--radius-md);
  backdrop-filter: var(--glass-backdrop);
  margin-top: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.value-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.slider-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
}

.option-label {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: var(--border-width) solid var(--glass-border);
  border-radius: var(--radius-sm);
  margin-top: var(--space-xs);
}

.option-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xl);
  border-top: var(--border-width) solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-backdrop);
  position: sticky;
  bottom: 0;
  z-index: 1;
  padding-bottom: max(var(--space-xl), env(safe-area-inset-bottom));
}

.assessment-actions {
  display: flex;
  gap: var(--space-md);
}

/* Assessment Controls Styling */
.assessment-controls {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
}

.assessment-controls .btn {
  white-space: nowrap;
}

/* Enhanced button styling for assessment */
.assessment-controls .btn-primary {
  position: relative;
  overflow: hidden;
}

.assessment-controls .btn-primary::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;
}

.assessment-controls .btn-primary:hover::before {
  left: 100%;
}

/* Reversed Slider Styles */
.slider-reversed .slider-scale {
  flex-direction: row-reverse;
}

.markers-reversed {
  flex-direction: row-reverse;
}

.markers-reversed .option-marker {
  order: -1;
}

/* ===== SCOREBOARD STYLES ===== */
.scoreboard-container {
  margin-top: var(--space-lg);
  width: 100%;
  display: block;
  clear: both;
}

.scoreboard-header {
  margin-bottom: var(--space-lg);
  text-align: center;
}

.scoreboard-header h3 {
  color: var(--text-primary);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.scoreboard-header h3 i {
  color: var(--accent);
}

.scoreboard-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

.scoreboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.score-card {
  background: var(--glass-bg);
  border: var(--border-width) solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  backdrop-filter: var(--glass-backdrop);
  transition: all 0.2s ease;
}

.score-card:hover {
  border-color: var(--primary);
}

.score-card-header {
  margin-bottom: var(--space-sm);
}

.attribute-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  display: block;
  line-height: 1.3;
  text-align: center;
}

.score-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin-bottom: var(--space-xs);
  gap: 2px;
}

.score-value {
  font-size: 1.5rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--primary);
}

.score-max {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-muted);
}

.score-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.4s ease;
}


.last-updated {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
}

.last-updated i {
  opacity: 0.7;
}

/* Mobile responsiveness for scoreboard */
@media (max-width: 768px) {
  .scoreboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xs);
  }
  
  .score-card {
    padding: var(--space-xs);
  }
  
  .score-value {
    font-size: 1.2rem;
  }
  
  .attribute-name {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .scoreboard-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== RESPONSIVE MODAL DESIGN ===== */
@media (max-width: 768px) {
  .modal-overlay {
    padding: var(--space-sm);
    align-items: flex-start;
    padding-top: var(--space-lg);
    padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom));
  }

  .modal-container {
    max-width: 100vw;
    max-height: calc(100dvh - 2 * var(--space-lg));
    max-height: calc(var(--vh, 1vh) * 100 - 2 * var(--space-lg));
    margin: 0;
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: var(--space-md);
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }

  .modal-header h2 {
    font-size: 1.2rem;
    margin: 0;
  }

  .modal-close {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    padding: var(--space-xs);
  }

  .modal-body,
  .modal-content {
    padding: var(--space-md);
    flex: 1;
    overflow-y: auto;
  }

  .assessment-progress {
    margin-bottom: var(--space-md);
  }

  .progress-text {
    font-size: 0.8rem;
  }

  .assessment-content,
  .assessment-question {
    margin-bottom: var(--space-md);
  }

  .question-text {
    padding: var(--space-md);
    margin-bottom: var(--space-md);
  }

  .question-text p {
    font-size: 1rem;
    line-height: 1.4;
  }

  /* Mobile slider improvements */
  .slider-container {
    margin-top: var(--space-md);
  }

  .assessment-slider {
    height: 12px;
    margin: var(--space-md) 0;
  }

  .assessment-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
    border: 4px solid white;
  }

  .assessment-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border: 4px solid white;
  }

  .slider-scale {
    padding: 0 2px;
    margin: var(--space-sm) 0;
  }

  /* Mobile option markers - keep same layout as desktop */
  .option-markers {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    gap: 2px;
    flex-wrap: wrap;
  }

  .option-marker {
    flex: 1;
    text-align: center;
    padding: var(--space-xs) 2px;
    min-width: 0;
    max-width: none;
  }

  .marker-label {
    font-size: 0.6rem;
    line-height: 1.1;
    color: var(--text-muted);
    font-weight: 400;
    display: block;
    word-wrap: break-word;
    hyphens: auto;
  }

  /* Current value display mobile */
  .current-value-display {
    margin-top: var(--space-md);
    padding: var(--space-md);
  }

  .slider-value {
    font-size: 1.4rem;
  }

  .option-name {
    font-size: 0.9rem;
  }

  /* Modal footer mobile */
  .modal-footer {
    padding: var(--space-md);
    flex-direction: row;
    justify-content: space-between;
    gap: var(--space-md);
    border-top: var(--border-width) solid var(--glass-border);
    background: var(--glass-bg);
  }

  .assessment-actions {
    display: flex;
    gap: var(--space-sm);
  }

  .assessment-actions .btn {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.9rem;
    min-width: 100px;
  }

  /* Mobile assessment controls in sidebar */
  .assessment-controls {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
  }

  .assessment-controls .btn {
    justify-content: center;
    padding: var(--space-md);
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .modal-container {
    margin: var(--space-sm);
    max-height: calc(100dvh - 2 * var(--space-sm));
    max-height: calc(var(--vh, 1vh) * 100 - 2 * var(--space-sm));
  }

  .modal-header {
    padding: var(--space-md);
  }

  .modal-content {
    padding: var(--space-md);
  }

  .question-header h3 {
    font-size: 1.1rem;
  }

  .question-text {
    padding: var(--space-md);
  }

  .modal-footer {
    padding: var(--space-md);
    padding-bottom: max(var(--space-md), env(safe-area-inset-bottom));
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .sidebar,
  .chat-input-container,
  .example-prompts,
  .conversation-rating,
  .app-header,
  .modal-overlay {
    display: none !important;
  }

  .chat-container {
    margin: 0;
    margin-top: 0;
  }

  .message {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ===== CONVERSATION STYLE SELECTOR ===== */
.conversation-style-selector {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.style-dropdown {
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.style-dropdown:hover {
  background: var(--bg-glass-hover);
  border-color: var(--primary);
}

.style-dropdown:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.style-dropdown option {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: var(--space-sm);
}

.style-description {
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}

.style-description small {
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
}