/**
 * Rumi Stylesheet
 * Glassmorphism Design System - Desktop First
 * Responsive: Desktop → Tablet → Mobile
 */

/* ========================================
   0. CSS CUSTOM PROPERTIES (Design Tokens)
   ======================================== */

:root {
  /* Color Palette - Light Theme (Default) */
  --color-primary: #a855f7;
  --color-primary-hover: #9333ea;
  --color-primary-glow: rgba(168, 85, 247, 0.4);
  
  --color-accent: #ec4899;
  --color-accent-hover: #db2777;
  --color-accent-glow: rgba(236, 72, 153, 0.4);
  
  --color-secondary: #3b82f6;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  
  /* Background */
  --bg-primary: #faf5ff;
  --bg-gradient-start: #f3e8ff;
  --bg-gradient-mid: #fce7f3;
  --bg-gradient-end: #dbeafe;
  
  /* Glass System */
  --glass-bg: rgba(255, 255, 255, 0.25);
  --glass-bg-hover: rgba(255, 255, 255, 0.35);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-border-strong: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --glass-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.15);
  --glass-blur: 12px;
  
  /* Text Colors */
  --text-primary: #1e1b4b;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-on-primary: #ffffff;
  
  /* Typography */
  --font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  
  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  
  /* Border Radius */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;
  
  /* Layout - Desktop Base */
  --sidebar-width: 280px;
  --header-height: 70px;
  --input-height: 70px;
  --container-max: 1400px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-glow-primary: 0 0 20px var(--color-primary-glow);
  --shadow-glow-accent: 0 0 20px var(--color-accent-glow);
  
  /* Mobile safe area (default 0 for desktop) */
  --safe-area-bottom: 0px;
  --safe-area-top: 0px;
}

/* Dark Theme */
[data-theme="dark"] {
  --color-primary: #c084fc;
  --color-primary-hover: #a855f7;
  --color-primary-glow: rgba(192, 132, 252, 0.5);
  
  --color-accent: #f472b6;
  --color-accent-hover: #ec4899;
  --color-accent-glow: rgba(244, 114, 182, 0.5);
  
  --bg-primary: #0f0a1e;
  --bg-gradient-start: #1e1b4b;
  --bg-gradient-mid: #2e1065;
  --bg-gradient-end: #1e3a8a;
  
  --glass-bg: rgba(30, 30, 60, 0.35);
  --glass-bg-hover: rgba(40, 40, 80, 0.45);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-border-strong: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --glass-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.5);
  
  --text-primary: #faf5ff;
  --text-secondary: #a5b4fc;
  --text-muted: #818cf8;
  --text-on-primary: #1e1b4b;
}

/* ========================================
   1. BASE STYLES & RESET
   ======================================== */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated Gradient Background */
.app-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(-45deg, 
    var(--bg-gradient-start),
    var(--bg-gradient-mid),
    var(--bg-gradient-end),
    var(--bg-gradient-start)
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .app-background { animation: none; }
}

/* ========================================
   2. GLASSMORPHISM UTILITIES
   ======================================== */

.glass {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-hover:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--glass-shadow-hover);
}

@supports not (backdrop-filter: blur(10px)) {
  .glass { background: rgba(255, 255, 255, 0.9); border: 1px solid rgba(0, 0, 0, 0.1); }
  [data-theme="dark"] .glass { background: rgba(30, 30, 60, 0.95); border: 1px solid rgba(255, 255, 255, 0.1); }
}

.glass-card {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-base);
}

.glass-button {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border-strong);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-6);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 56px;
}

.glass-button:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--glass-shadow-hover);
}

.glass-button:active {
  transform: translateY(0) scale(0.98);
}

.glass-input {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 2px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-full);
  padding: var(--space-4) var(--space-6);
  font-size: var(--font-size-base);
  width: 100%;
  outline: none;
  transition: all var(--transition-fast);
}

.glass-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-glow);
}

/* ========================================
   3. BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-lg);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 56px;
  min-width: 56px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: var(--text-on-primary);
  box-shadow: 0 4px 15px var(--color-primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--color-primary-glow);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-accent {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-hover));
  color: var(--text-on-primary);
  box-shadow: 0 4px 15px var(--color-accent-glow);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--color-accent-glow);
}

.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--color-error);
  color: white;
}

.btn-small {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  min-height: 36px;
}

.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* ========================================
   4. TYPOGRAPHY
   ======================================== */

.text-gradient {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title-lg {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  line-height: 1.2;
}

.title-md {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  line-height: 1.3;
}

.text-lg {
  font-size: var(--font-size-lg);
  font-weight: 600;
}

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

/* ========================================
   5. LAYOUT UTILITIES
   ======================================== */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-6);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.text-center { text-align: center; }
.w-full { width: 100%; }
.h-full { height: 100%; }

/* ========================================
   6. ANIMATIONS
   ======================================== */

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px var(--color-primary-glow); }
  50% { box-shadow: 0 0 20px var(--color-primary-glow), 0 0 40px var(--color-accent-glow); }
}

@keyframes typing {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-8px); opacity: 1; }
}

.animate-fade-in { animation: fadeInUp 0.3s ease-out forwards; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-bounce { animation: bounce 1s ease-in-out infinite; }

/* ========================================
   7. THEME TOGGLE
   ======================================== */

.theme-toggle {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 1000;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border-strong);
  box-shadow: var(--glass-shadow);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
  transition: transform var(--transition-base);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--glass-shadow-hover);
}

.theme-toggle:hover svg {
  transform: rotate(20deg);
}

/* ========================================
   8. LOGIN PAGE
   ======================================== */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.login-container {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  text-align: center;
  padding: var(--space-10) var(--space-8);
}

.login-logo {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  animation: bounce 2s ease-in-out infinite;
}

.login-title {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  margin-bottom: var(--space-2);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.login-input {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 2px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-full);
  padding: var(--space-4) var(--space-6);
  font-size: var(--font-size-xl);
  text-align: center;
  letter-spacing: 0.1em;
  width: 100%;
  outline: none;
  transition: all var(--transition-fast);
}

.login-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-glow);
}

.login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-xl);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 64px;
  width: 100%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: var(--text-on-primary);
  box-shadow: 0 4px 15px var(--color-primary-glow);
}

.login-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--color-primary-glow);
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-error);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
}

.logout {
  color: white;
  text-decoration: none;
  padding: var(--space-2) var(--space-4);
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.logout:hover {
  background: rgba(255,255,255,0.2);
}

/* ========================================
   9. APP LAYOUT - DESKTOP FIRST
   ======================================== */

/* Desktop: Sidebar + Content Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation - Desktop */
.sidebar-nav {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border-right: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  z-index: 100;
}

.sidebar-nav .sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--glass-border);
}

.sidebar-nav .sidebar-header .logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-glow-primary);
}

.sidebar-nav .sidebar-header .title {
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.sidebar-nav .sidebar-header .status {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.sidebar-nav .nav-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: var(--font-size-base);
  font-weight: 600;
  text-align: left;
  width: 100%;
}

.sidebar-nav .nav-item:hover {
  background: var(--glass-bg-hover);
  color: var(--text-primary);
}

.sidebar-nav .nav-item.active {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: var(--text-on-primary);
  box-shadow: var(--shadow-glow-primary);
}

.sidebar-nav .nav-item .nav-icon {
  width: 24px;
  height: 24px;
}

.sidebar-nav .nav-item .nav-label {
  font-size: var(--font-size-base);
  font-weight: 600;
}

/* Main Content Area - Desktop */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Chat Interface - Desktop */
.chat-interface {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.chat-header {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.message {
  max-width: 60%;
  animation: fadeInUp 0.3s ease-out;
}

.message.user {
  align-self: flex-end;
}

.message.bot {
  align-self: flex-start;
}

.message-bubble {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
  line-height: 1.5;
  word-wrap: break-word;
}

.message.user .message-bubble {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: var(--text-on-primary);
  border-bottom-right-radius: var(--space-1);
  box-shadow: var(--shadow-glow-primary);
}

.message.bot .message-bubble {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  color: var(--text-primary);
  border-bottom-left-radius: var(--space-1);
}

.message-time {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
  text-align: right;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: var(--space-1);
  width: fit-content;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  animation: typing 1.4s ease-in-out infinite;
}

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

/* Input Area - Desktop (inline, not fixed) */
.input-area-container {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--glass-border);
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
}

.input-area {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  max-width: 800px;
  margin: 0 auto;
}

.input-area input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: var(--font-size-base);
  color: var(--text-primary);
  padding: var(--space-2) 0;
}

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

.input-area button {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.input-area button:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow-primary);
}

.input-area button:active {
  transform: scale(0.95);
}

.input-area button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.quick-actions::-webkit-scrollbar {
  display: none;
}

.quick-action-btn {
  white-space: nowrap;
  font-size: var(--font-size-sm);
  padding: var(--space-2) var(--space-4);
  min-height: 40px;
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border-strong);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-weight: 600;
}

.quick-action-btn:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--glass-shadow-hover);
}

/* Mode Selection Panels */
.selection-panel {
  flex: 1;
  padding: var(--space-8);
  overflow-y: auto;
}

.selection-panel h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin-bottom: var(--space-6);
  text-align: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Character/Skill Grid - Desktop: 4-6 columns */
.character-grid,
.skill-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-4);
}

.character-card,
.skill-card {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  text-align: center;
  cursor: pointer;
  padding: var(--space-6) var(--space-4);
  transition: all var(--transition-base);
}

.character-card:hover,
.skill-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--glass-shadow-hover), var(--shadow-glow-primary);
}

.character-card img,
.character-emoji {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  object-fit: cover;
  margin: 0 auto var(--space-3);
  font-size: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-card h3,
.skill-card h3 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.character-card p,
.skill-card p {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.back-btn {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border-strong);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-6);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 56px;
  margin: var(--space-6) auto;
}

.back-btn:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--glass-shadow-hover);
}

/* ========================================
   10. ADMIN INTERFACE (Legacy - now uses .admin-layout)
   ======================================== */

/* Legacy compatibility - admin pages now use .admin-layout */
.admin-interface {
  min-height: 100vh;
  background: var(--bg-primary);
}

.admin-tab h2 {
  margin-bottom: var(--space-4);
  color: var(--text-primary);
  font-size: var(--font-size-2xl);
}

/* Admin Cards */
.prompt-section,
.settings-section {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
}

.prompt-section h3,
.settings-section h3 {
  margin-bottom: var(--space-4);
  color: var(--text-primary);
  font-size: var(--font-size-xl);
}

.settings-section input,
.settings-section select,
.settings-section textarea {
  display: block;
  width: 100%;
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  font-family: inherit;
}

.settings-section input:focus,
.settings-section select:focus,
.settings-section textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.settings-section label {
  display: block;
  margin-bottom: var(--space-1);
  font-weight: 600;
  color: var(--text-secondary);
}

.help-text {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-4);
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table th,
.data-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

.data-table th {
  background: var(--glass-bg);
  font-weight: 700;
  color: var(--text-primary);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: var(--space-4);
}

.modal-content {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-6);
}

.modal-content h3 {
  margin-bottom: var(--space-4);
}

.modal-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
  justify-content: flex-end;
}

/* Form Elements */
.prompt-editor {
  width: 100%;
  padding: var(--space-4);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  font-family: monospace;
  font-size: var(--font-size-sm);
  resize: vertical;
  min-height: 200px;
  color: var(--text-primary);
}

.prompt-editor:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Notepad Browser - Desktop */
.notepad-browser {
  display: grid;
  grid-template-columns: 200px 250px 1fr;
  gap: var(--space-4);
}

.folder-list,
.file-list {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  max-height: 60vh;
  overflow-y: auto;
}

.folder-list button,
.file-item {
  display: block;
  width: 100%;
  padding: var(--space-3);
  margin-bottom: var(--space-1);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
}

.folder-list button:hover,
.folder-list button.active,
.file-item:hover {
  background: var(--glass-bg-hover);
}

.file-item small {
  display: block;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}

/* Logs & Alerts */
.logs-container,
.alerts-container {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  max-height: 60vh;
  overflow-y: auto;
}

.log-entry,
.alert-entry {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--glass-border);
}

.log-entry:last-child,
.alert-entry:last-child {
  border-bottom: none;
}

.log-entry.user {
  background: rgba(168, 85, 247, 0.05);
}

.alert-entry {
  background: rgba(245, 158, 11, 0.1);
}

.log-time, .alert-time {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.log-from {
  font-weight: 700;
}

.log-text, .alert-message {
  display: block;
  margin-top: var(--space-1);
}

.alert-badge {
  background: var(--color-warning);
  color: white;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 700;
}

.add-prompt {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.add-prompt input {
  flex: 1;
}

.prompt-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.prompt-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--glass-bg);
  border-radius: var(--radius-md);
}

.file-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.version-item {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2);
}

/* ========================================
   11.5 ADMIN LAYOUT - DESKTOP FIRST
   ======================================== */

/* Admin Layout Wrapper */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Admin Sidebar - Desktop */
.admin-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(135deg, #2c3e50, #34495e);
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  z-index: 100;
  overflow-y: auto;
}

.admin-sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-brand {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: white;
}

.admin-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  width: 100%;
  font-family: inherit;
}

.admin-nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.admin-nav-item.active {
  background: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-glow-primary);
}

.admin-nav-item svg {
  flex-shrink: 0;
}

.admin-sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Admin Main Content */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--space-6);
  min-height: 100vh;
}

/* Admin Tab Content */
.admin-tab {
  max-width: 1200px;
  margin: 0 auto;
}

.admin-tab h2 {
  margin-bottom: var(--space-6);
  color: var(--text-primary);
  font-size: var(--font-size-2xl);
}

/* Table Wrapper for Scrolling */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: var(--space-6);
}

/* Prompt Item Actions */
.prompt-item-actions {
  display: flex;
  gap: var(--space-2);
}

/* Form Row for Settings */
.form-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.form-row label {
  min-width: 150px;
}

.form-row input,
.form-row select {
  flex: 1;
  min-width: 200px;
}

/* File Editor */
.file-editor {
  background: linear-gradient(135deg, var(--glass-bg) 0%, rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.file-editor textarea {
  width: 100%;
  margin: var(--space-4) 0;
  padding: var(--space-4);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  font-family: monospace;
  font-size: var(--font-size-sm);
  resize: vertical;
  min-height: 300px;
  color: var(--text-primary);
}

.file-editor textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.file-editor h3 {
  margin: 0;
}

.file-editor h4 {
  margin: 0 0 var(--space-3);
}

/* Version Item in File Editor */
.file-editor .version-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: var(--glass-bg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}

.file-editor .versions {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--glass-border);
}

/* ========================================
   11. RESPONSIVE - LARGE TABLET (max-width: 1199px)
   ======================================== */

@media (max-width: 1199px) {
  :root {
    --sidebar-width: 240px;
  }
  
  .container {
    max-width: 100%;
    padding: var(--space-5);
  }
  
  .character-grid,
  .skill-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .notepad-browser {
    grid-template-columns: 180px 200px 1fr;
  }
}

/* ========================================
   12. RESPONSIVE - TABLET (max-width: 991px)
   ======================================== */

@media (max-width: 991px) {
  :root {
    --sidebar-width: 200px;
  }
  
  .character-grid,
  .skill-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .message {
    max-width: 70%;
  }
  
  .admin-content {
    padding: var(--space-5);
  }
  
  .notepad-browser {
    grid-template-columns: 160px 180px 1fr;
  }
}

/* ========================================
   13. RESPONSIVE - MOBILE (max-width: 767px)
   Mobile: Sidebar becomes bottom nav, input becomes fixed
   ======================================== */

@media (max-width: 767px) {
  /* Switch to mobile layout */
  .app-layout {
    flex-direction: column;
  }
  
  /* Sidebar becomes bottom nav */
  .sidebar-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: auto;
    flex-direction: row;
    padding: var(--space-2) var(--space-4);
    border-right: none;
    border-top: 1px solid var(--glass-border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  
  .sidebar-nav .sidebar-header {
    display: none;
  }
  
  .sidebar-nav .nav-items {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    gap: 0;
  }
  
  .sidebar-nav .nav-item {
    flex-direction: column;
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-xs);
  }
  
  .sidebar-nav .nav-item .nav-label {
    font-size: var(--font-size-xs);
  }
  
  /* Main content fills screen, leaves room for bottom nav */
  .main-content {
    margin-left: 0;
    padding-bottom: 80px;
  }
  
  /* Input area becomes fixed at bottom */
  .chat-interface {
    padding-bottom: calc(80px + var(--safe-area-bottom));
  }
  
  .input-area-container {
    position: fixed;
    bottom: calc(80px + var(--safe-area-bottom));
    left: 0;
    right: 0;
    z-index: 50;
  }
  
  /* Character/skill grids: 2 columns */
  .character-grid,
  .skill-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }
  
  .character-card,
  .skill-card {
    padding: var(--space-4);
  }
  
  /* Messages: 85% width */
  .message {
    max-width: 85%;
  }
  
  /* Admin: Sidebar becomes bottom nav on mobile */
  .admin-sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: auto;
    flex-direction: row;
    padding: var(--space-2) var(--space-3);
    padding-bottom: calc(var(--space-3) + var(--safe-area-bottom));
    border-right: none;
    border-top: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  
  .admin-sidebar-header {
    display: none;
  }
  
  .admin-sidebar-nav {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    gap: 0;
    padding-left: 0;
  }
  
  .admin-nav-item {
    flex-direction: column;
    padding: var(--space-2);
    font-size: var(--font-size-xs);
    gap: var(--space-1);
  }
  
  .admin-nav-item span {
    font-size: var(--font-size-xs);
  }
  
  .admin-sidebar-footer {
    display: none;
  }
  
  .admin-main {
    margin-left: 0;
    padding: var(--space-4);
    padding-bottom: calc(80px + var(--safe-area-bottom));
  }
  
  .admin-tab h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-4);
  }
  
  /* Notepad: single column */
  .notepad-browser {
    grid-template-columns: 1fr;
  }
  
  .folder-list,
  .file-list {
    max-height: 40vh;
  }
  
  .file-editor {
    padding: var(--space-4);
  }
  
  .file-editor textarea {
    min-height: 200px;
  }
  
  /* Form row: stack on mobile */
  .form-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .form-row label {
    min-width: auto;
  }
  
  .form-row input,
  .form-row select {
    min-width: auto;
    width: 100%;
  }
  
  /* Table wrapper */
  .table-wrapper {
    margin: 0 calc(-1 * var(--space-4));
    padding: 0 var(--space-2);
  }
  
  /* Modal: full width on mobile */
  .modal {
    padding: var(--space-2);
  }
  
  .modal-content {
    padding: var(--space-4);
    max-height: 85vh;
  }
}

/* ========================================
   14. RESPONSIVE - SMALL MOBILE (max-width: 479px)
   ======================================== */

@media (max-width: 479px) {
  .container {
    padding: var(--space-3);
  }
  
  .character-grid,
  .skill-grid {
    grid-template-columns: 1fr;
  }
  
  .selection-panel {
    padding: var(--space-4);
  }
  
  .quick-actions {
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  
  .quick-action-btn {
    flex: 1;
    min-width: calc(50% - var(--space-2));
  }
  
  .input-area {
    padding: var(--space-2);
  }
  
  .input-area input {
    font-size: var(--font-size-sm);
  }
  
  .admin-nav button {
    font-size: var(--font-size-xs);
    padding: var(--space-1) var(--space-2);
  }
  
  .data-table th,
  .data-table td {
    padding: var(--space-2);
    font-size: var(--font-size-sm);
  }
}

/* ========================================
   15. MOBILE SAFE AREA (iPhone notch/home indicator)
   Only applies on touch devices
   ======================================== */

@supports (-webkit-touch-callout: none) {
  :root {
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-top: env(safe-area-inset-top, 0px);
  }
  
  .chat-interface {
    min-height: -webkit-fill-available;
  }
  
  .sidebar-nav {
    padding-bottom: calc(var(--space-3) + var(--safe-area-bottom));
  }
  
  .input-area-container {
    bottom: calc(80px + var(--safe-area-bottom));
  }
}

/* Safe area utility classes */
.safe-top { padding-top: var(--safe-area-top); }
.safe-bottom { padding-bottom: var(--safe-area-bottom); }

/* ========================================
   16. UTILITY CLASSES
   ======================================== */

.hidden { display: none !important; }
[x-cloak] { display: none !important; }
.invisible { visibility: hidden; }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }

.p-4 { padding: var(--space-4); }

.rounded-lg { border-radius: var(--radius-lg); }

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--glass-border-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Selection color */
::selection {
  background: var(--color-primary-glow);
  color: var(--text-primary);
}