/* RomandemAI - Enhanced Unified Design System v3.0 */
/* Complete consistency across all pages with clean, modern design */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Enhanced CosmoG Mode System - Base Variables */
  --bg: #ffffff;
  --panel: #f8f9fa;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bubble-ai: #f3f4f6;
  --bubble-user: #dbeafe;
  --accent: #10b981;
  --shadow: 0 4px 16px rgba(0,0,0,.08);
  --radius: 12px;
  --trans: 200ms cubic-bezier(.2,.8,.2,1);
  
  /* Enhanced layout constants */
  --sidebar-width: 280px;
  --header-height: 56px;
  --chat-max-width: 800px;
  --content-max-width: 1000px;
  --message-spacing: 24px;
  --section-spacing: 32px;
  --border-radius: var(--radius);
  --border-radius-lg: 16px;
  --transition-speed: var(--trans);
  
  /* Enhanced shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.15);
  
  /* Glass effect */
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(0, 0, 0, 0.08);
  
  /* Status colors */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
}

/* ===== COSMOG MODE SYSTEM ===== */
/* 🧠 Presence Mode (Default) */
:root[data-mode="default"] {
  --bg: #ffffff;
  --panel: #f8f9fa;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bubble-ai: #f3f4f6;
  --bubble-user: #dbeafe;
  --accent: #10b981;
  --shadow: 0 4px 16px rgba(0,0,0,.08);
}

/* 🔥 Banter Mode (Dark) */
:root[data-mode="mandem"] {
  --bg: #0f1419;
  --panel: #1a1f2e;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #334155;
  --bubble-ai: #1e293b;
  --bubble-user: #1e40af;
  --accent: #06b6d4;
  --shadow: 0 8px 24px rgba(0,0,0,.4);
  --glass-bg: rgba(26, 31, 46, 0.95);
  --glass-border: rgba(255, 255, 255, 0.1);
}

/* 💫 Soul Mode (Warm) */
:root[data-mode="soul"] {
  --bg: #fefbf3;
  --panel: #ffffff;
  --text: #292524;
  --muted: #78716c;
  --border: #e7e5e4;
  --bubble-ai: #fef3c7;
  --bubble-user: #ecfdf5;
  --accent: #d97706;
  --shadow: 0 6px 20px rgba(217, 119, 6, 0.15);
  --glass-bg: rgba(254, 251, 243, 0.95);
  --glass-border: rgba(41, 37, 36, 0.08);
}

/* Base styles */
html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Layout System */
.app-container {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  body {
    padding-top: 60px;
  }
}

/* ===== ENHANCED SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition-speed) ease;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--header-height);
}

.sidebar-header a {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  transition: opacity var(--transition-speed);
}

.sidebar-header a:hover {
  opacity: 0.8;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 80%, black) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.brand-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

/* Enhanced New Chat Button */
.new-chat-btn {
  margin: 16px 20px;
  padding: 14px 20px;
  background: var(--accent);
  border: none;
  border-radius: var(--border-radius);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-speed);
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.new-chat-btn:hover {
  background: color-mix(in srgb, var(--accent) 90%, black);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.new-chat-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Enhanced Navigation */
.sidebar-nav-section {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-speed);
  min-height: 44px;
}

.nav-link:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
  transform: translateX(2px);
}

.nav-link.active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-link:hover svg,
.nav-link.active svg {
  opacity: 1;
}

/* Enhanced Chat History */
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  min-height: 200px;
}

.conversation-list {
  list-style: none;
  padding: 0 12px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-item {
  padding: 12px 16px;
  margin: 0;
  border-radius: var(--border-radius);
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  transition: all var(--transition-speed);
  min-height: 44px;
  display: flex;
  align-items: center;
  line-height: 1.4;
}

.chat-item:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
  transform: translateX(2px);
}

.chat-item.active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
  font-weight: 500;
}

/* Enhanced Sidebar Footer */
.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-btn {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-speed);
  min-height: 44px;
}

.settings-btn:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.settings-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ===== ENHANCED MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-height: 100vh;
}

@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
    width: 100%;
  }
}

/* Enhanced Mobile Header */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 60px;
  backdrop-filter: blur(10px);
}

.mobile-menu-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  transition: all var(--transition-speed);
}

.mobile-menu-btn:hover {
  background: var(--bg);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
}

.brand-orb {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 80%, black) 100%);
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}

/* ===== ENHANCED PAGE CONTENT ===== */
.page-content,
.content-view,
.disclaimer-page,
.privacy-page,
.contact-page,
.about-page {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .page-content,
  .content-view,
  .disclaimer-page,
  .privacy-page,
  .contact-page,
  .about-page {
    padding: 24px 20px;
    padding-bottom: 120px;
  }
}

/* Enhanced Page Headers */
.page-header,
.view-header {
  max-width: var(--content-max-width);
  margin: 0 auto 48px;
  text-align: center;
}

.page-header h1,
.view-header h1 {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
  line-height: 1.2;
}

.page-header p,
.view-header p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto;
}

/* Enhanced Content Sections */
.content-section {
  max-width: var(--content-max-width);
  margin: 0 auto var(--section-spacing);
  padding: 32px;
  background: var(--panel);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-speed);
}

.content-section:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.content-section h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-section h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 24px 0 16px;
  color: var(--text);
}

.content-section h4 {
  font-size: 18px;
  font-weight: 600;
  margin: 20px 0 12px;
  color: var(--text);
}

.content-section p {
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 16px;
  color: var(--text);
}

.content-section ul,
.content-section ol {
  margin: 20px 0;
  padding-left: 24px;
}

.content-section li {
  margin-bottom: 8px;
  line-height: 1.6;
  color: var(--text);
}

.content-section a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-speed);
}

.content-section a:hover {
  text-decoration: underline;
  color: color-mix(in srgb, var(--accent) 80%, black);
}

/* ===== ENHANCED CHAT INTERFACE ===== */
.chat-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.chat-header {
  height: var(--header-height);
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  flex-shrink: 0;
}

.chat-title h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.chat-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.reset-btn,
.how-works-btn {
  padding: 8px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-speed);
  font-weight: 500;
}

.reset-btn:hover,
.how-works-btn:hover {
  background: var(--panel);
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Enhanced Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  scroll-behavior: smooth;
}

.chat-message {
  padding: var(--message-spacing) 0;
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.user,
.chat-message.ai {
  display: flex;
  gap: 16px;
  max-width: var(--chat-max-width);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
  width: 100%;
  position: relative;
}

.chat-message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.chat-message.user .message-avatar {
  background: var(--panel);
  color: var(--text);
  border: 2px solid var(--border);
}

.chat-message.ai .message-avatar {
  background: var(--accent);
  color: white;
}

.message-content {
  flex: 1;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  word-wrap: break-word;
}

.chat-message.user .message-content {
  background: var(--panel);
  padding: 16px 20px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* AI bubble styling to match modern chat apps */
.chat-message.ai .message-content {
  background: var(--bubble-ai);
  padding: 16px 20px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* Message content rich text (markdown) */
.message-content p { margin: 0 0 8px; }
.message-content ul, .message-content ol { margin: 8px 0 8px 20px; }
.message-content li { margin: 4px 0; }
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 { margin: 8px 0; line-height: 1.3; }
.message-content a { color: var(--accent); text-decoration: underline; }
.message-content code {
  background: color-mix(in srgb, var(--panel) 85%, black);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
}
.message-content pre {
  background: color-mix(in srgb, var(--panel) 85%, black);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  box-shadow: var(--shadow-sm);
}
.message-content pre code {
  background: transparent;
  border: 0;
  padding: 0;
  white-space: pre;
  display: block;
}

/* AI label subtle styling */
.ai-label {
  color: var(--muted);
  font-size: 12px;
  margin-left: 56px;
  margin-top: 6px;
}

/* Typing indicator */
.typing-indicator { display: inline-flex; align-items: center; gap: 6px; }
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.6;
  animation: typingBlink 1s infinite ease-in-out;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBlink {
  0%, 80%, 100% { opacity: 0.2; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* Copy button for messages */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-speed);
  box-shadow: var(--shadow-sm);
}
.copy-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* Enhanced Welcome Message */
.welcome-message {
  max-width: var(--chat-max-width);
  margin: 80px auto;
  padding: 0 24px;
  text-align: center;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: bold;
  box-shadow: var(--shadow-lg);
}

.welcome-message h2 {
  font-size: 32px;
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 700;
}

.welcome-message p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 32px;
}

.welcome-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 40px;
}

.feature-hint {
  padding: 16px 20px;
  background: var(--panel);
  border-radius: var(--border-radius);
  font-size: 14px;
  color: var(--muted);
  border: 1px solid var(--border);
  transition: all var(--transition-speed);
  box-shadow: var(--shadow-sm);
}

.feature-hint:hover {
  background: var(--bg);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Enhanced Chat Input */
.chat-input-container {
  border-top: 1px solid var(--border);
  background: var(--panel);
  padding: 20px 0;
  flex-shrink: 0;
}

.input-wrapper {
  max-width: var(--chat-max-width);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.chat-input {
  flex: 1;
  min-height: 48px;
  max-height: 200px;
  padding: 12px 56px 12px 20px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--border-radius);
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: all var(--transition-speed);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.chat-input::placeholder {
  color: var(--muted);
}

.send-btn {
  position: absolute;
  right: 32px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--accent);
  border: none;
  border-radius: var(--border-radius);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
  box-shadow: var(--shadow-sm);
}

.send-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 90%, black);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

/* ===== ENHANCED FOOTER ===== */
.eu-footer {
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  margin-top: auto;
}

.footer-content {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
  margin-bottom: 20px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-speed);
  padding: 8px 12px;
  border-radius: var(--border-radius);
}

.footer-links a:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.footer-signature {
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
}

/* ===== MOBILE RESPONSIVE ENHANCEMENTS ===== */
@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }
  
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100vh;
    z-index: 999;
    width: 300px;
    transition: left 0.3s ease;
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .chat-messages {
    padding: 20px 16px;
  }
  
  .chat-message.user,
  .chat-message.ai {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  .chat-input-container {
    padding: 16px;
  }
  
  .input-wrapper {
    padding: 0;
  }
  
  .welcome-message {
    margin: 40px auto;
    padding: 0 16px;
  }
  
  .welcome-features {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 16px;
  }
  
  .content-section {
    padding: 24px 20px;
    margin-bottom: 24px;
  }
}

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 998;
}

@media (max-width: 768px) {
  .sidebar-overlay.visible {
    display: block;
  }
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.hidden { display: none !important; }
.visible { display: block !important; }

/* ===== ENHANCED ANIMATIONS ===== */
@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-slide-in-left {
  animation: slideInFromLeft 0.4s ease-out;
}

.animate-slide-in-right {
  animation: slideInFromRight 0.4s ease-out;
}

.animate-fade-in-scale {
  animation: fadeInScale 0.3s ease-out;
}

/* ===== ENHANCED SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ===== FOCUS STYLES ===== */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--border-radius);
}

/* ===== SETTINGS PANEL ===== */
.settings-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--border);
  z-index: 1001;
  transition: right var(--transition-speed) ease;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.settings-panel.open {
  right: 0;
}

.settings-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.settings-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.settings-close {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
}

.settings-close:hover {
  background: var(--bg);
  color: var(--text);
}

.settings-content {
  padding: 24px;
}

.settings-group {
  margin-bottom: 32px;
}

.settings-group h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.setting-item {
  margin-bottom: 20px;
}

.setting-item label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.setting-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.setting-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.setting-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toggle-info {
  flex: 1;
}

.toggle-info label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
  cursor: pointer;
}

.toggle-description {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.toggle-switch {
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: all var(--transition-speed);
  flex-shrink: 0;
}

.toggle-switch.active {
  background: var(--accent);
}

.toggle-slider {
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: all var(--transition-speed);
  box-shadow: var(--shadow-sm);
}

.toggle-switch.active .toggle-slider {
  transform: translateX(20px);
}

.setting-btn {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.setting-btn:hover {
  background: var(--panel);
  border-color: var(--accent);
  color: var(--accent);
}

.setting-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-speed);
}

.setting-link:hover {
  text-decoration: underline;
  color: color-mix(in srgb, var(--accent) 80%, black);
}

.version-info {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* Mobile Settings Panel */
@media (max-width: 768px) {
  .settings-panel {
    width: 100vw;
    right: -100vw;
  }
  
  .settings-content {
    padding: 20px 16px;
    padding-bottom: 100px;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .sidebar,
  .mobile-header,
  .chat-header,
  .chat-input-container,
  .sidebar-overlay,
  .settings-panel {
    display: none;
  }
  
  .main-content {
    width: 100%;
    height: auto;
    overflow: visible;
    margin-left: 0;
  }
  
  .chat-messages {
    padding: 0;
    overflow: visible;
  }
  
  body {
    background: white;
    color: black;
  }
}
