/* ==================== ZYHN AI - Dark Premium Theme ==================== */

/* CSS Variables - Premium Dark */
:root {
  /* Core Backgrounds - Deep Black */
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #111111;
  --bg-elevated: #161616;
  --bg-card: #1a1a1a;
  --bg-hover: #222222;
  
  /* Surfaces */
  --surface: #1c1c1c;
  --surface-hover: #252525;
  --surface-active: #2a2a2a;
  
  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --text-disabled: #444444;
  
  /* Accent - Electric Blue */
  --accent: #0ea5e9;
  --accent-hover: #38bdf8;
  --accent-light: rgba(14, 165, 233, 0.15);
  --accent-glow: rgba(14, 165, 233, 0.4);
  
  /* Gradients */
  --gradient: linear-gradient(135deg, #0ea5e9 0%, #22d3ee 50%, #6366f1 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(14, 165, 233, 0.2) 0%, rgba(34, 211, 238, 0.2) 100%);
  --gradient-text: linear-gradient(135deg, #fff 0%, #0ea5e9 100%);
  
  /* Status Colors */
  --success: #22c55e;
  --success-light: rgba(34, 197, 94, 0.15);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  --error: #ef4444;
  --error-light: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --info-light: rgba(59, 130, 246, 0.15);
  
  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(168, 85, 247, 0.3);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 40px rgba(168, 85, 247, 0.25);
  --shadow-glow-sm: 0 0 20px rgba(168, 85, 247, 0.15);
  
  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;
  
  /* Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
}

/* ==================== RESET & BASE ==================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { 
    opacity: 0; 
    transform: translateY(20px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

@keyframes fadeInLeft {
  from { 
    opacity: 0; 
    transform: translateX(-20px); 
  }
  to { 
    opacity: 1; 
    transform: translateX(0); 
  }
}

@keyframes scaleIn {
  from { 
    opacity: 0; 
    transform: scale(0.95); 
  }
  to { 
    opacity: 1; 
    transform: scale(1); 
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes glow {
  0%, 100% { 
    box-shadow: 0 0 20px var(--accent-glow), 0 0 40px rgba(59, 130, 246, 0.1);
  }
  50% { 
    box-shadow: 0 0 30px var(--accent-glow), 0 0 60px rgba(59, 130, 246, 0.2);
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==================== APP LAYOUT ==================== */
.app {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  height: 100vh;
  background: var(--bg-primary);
}

@media (max-width: 1280px) {
  .app { 
    grid-template-columns: 260px 1fr; 
  }
  .sidebar-right { 
    display: none; 
  }
}

@media (max-width: 768px) {
  .app { 
    grid-template-columns: 1fr; 
  }
  .sidebar-left {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: left var(--transition-base);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-left.open { 
    left: 0; 
  }
  .mobile-toggle { 
    display: flex !important; 
  }
  .overlay {
    display: block !important;
  }
}

/* ==================== LEFT SIDEBAR ==================== */
.sidebar-left {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  margin-bottom: var(--space-6);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  overflow: hidden;
  animation: glow 3s ease-in-out infinite;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-section {
  margin-bottom: var(--space-4);
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 10px var(--space-3);
  margin-bottom: 2px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--gradient);
  border-radius: 0 4px 4px 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav-btn:hover .nav-icon,
.nav-btn.active .nav-icon {
  color: var(--accent);
}

.nav-badge {
  margin-left: auto;
  padding: 2px 8px;
  background: var(--gradient);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.user-profile:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.user-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== MAIN CONTENT ==================== */
.main {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  min-width: 0;
  position: relative;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.mobile-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 18px;
  transition: all var(--transition-fast);
}

.mobile-toggle:hover {
  background: var(--bg-hover);
}

.breadcrumb {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 16px;
}

.icon-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ==================== VIEW CONTAINER ==================== */
.content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.view {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  animation: fadeInUp 0.3s ease;
}

.view.active {
  display: flex;
  flex-direction: column;
}

/* ==================== HOME VIEW ==================== */
.home {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-5);
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.hero {
  text-align: center;
  margin-bottom: var(--space-10);
  animation: fadeInUp 0.5s ease;
}

.hero-logo {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-xl);
  display: grid;
  place-items: center;
  overflow: hidden;
  margin: 0 auto var(--space-6);
  animation: glow 3s ease-in-out infinite, float 6s ease-in-out infinite;
}

.hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -1.5px;
  margin-bottom: var(--space-3);
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 500px;
  line-height: 1.6;
}

/* Quick Actions Grid */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  width: 100%;
  margin-bottom: var(--space-8);
}

@media (max-width: 600px) {
  .quick-actions { 
    grid-template-columns: 1fr; 
  }
  .hero h1 { 
    font-size: 36px; 
  }
}

.action-card {
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.action-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient);
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.action-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--shadow-glow-sm);
}

.action-card:hover::before {
  transform: scaleX(1);
}

.action-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  display: grid;
  place-items: center;
  margin-bottom: var(--space-3);
  border: 1px solid var(--border);
  color: var(--accent);
  transition: all var(--transition-fast);
  overflow: hidden;
}

.action-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.action-card:hover .action-icon {
  background: var(--accent-light);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow-sm);
  transform: scale(1.05);
}

.action-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: var(--space-1);
  color: var(--text-primary);
}

.action-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Input Container */
.input-container {
  width: 100%;
  max-width: 720px;
}

.input-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-3);
  transition: all var(--transition-fast);
}

.input-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light), var(--shadow-glow-sm);
}

.input-box:focus-within .action-icon,
.input-box:focus-within .tool-btn {
  color: var(--accent);
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
}

.chat-input {
  flex: 1;
  min-height: 24px;
  max-height: 200px;
  padding: 10px var(--space-2);
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.6;
  resize: none;
  outline: none;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.input-tools {
  display: flex;
  gap: 4px;
  padding: 4px;
}

.tool-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 16px;
}

.tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.send-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--gradient);
  color: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow-sm);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 4px 0;
  border-top: 1px solid var(--border);
  margin-top: var(--space-2);
  gap: var(--space-2);
  flex-wrap: wrap;
}

.model-select, .mode-select {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.model-select:hover, .mode-select:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.mode-select.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

.input-hint {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.mode-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.mode-group {
  display: flex;
  gap: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.mode-group .mode-select {
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.mode-group .mode-select:last-child {
  border-right: none;
}

.mode-group .mode-select:hover {
  background: var(--bg-hover);
}

.mode-group .mode-select.active {
  background: var(--accent-light);
  color: var(--accent);
}

.mode-select {
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-select {
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-select svg,
.mode-select svg {
  flex-shrink: 0;
}

/* ==================== CHAT VIEW ==================== */
.chat-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  height: 100%;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
}

.chat-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.chat-actions {
  display: flex;
  gap: var(--space-2);
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
}

.message {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5);
  margin-bottom: var(--space-2);
  border-radius: var(--radius-lg);
  animation: fadeInUp 0.3s ease;
}

.message.user {
  background: transparent;
}

.message.assistant {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--gradient);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.message.user .message-avatar {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.message-content {
  flex: 1;
  min-width: 0;
  line-height: 1.7;
  color: var(--text-primary);
}

.message-content p {
  margin-bottom: var(--space-3);
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
  margin: var(--space-3) 0;
}

.message-content code {
  font-family: var(--font-mono);
  font-size: 13px;
}

.message-content :not(pre) > code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent);
}

.message-content h1, .message-content h2, .message-content h3 {
  margin: var(--space-4) 0 var(--space-2);
  color: var(--text-primary);
}

.message-content ul, .message-content ol {
  margin: var(--space-2) 0 var(--space-3) var(--space-5);
}

.message-content li {
  margin-bottom: var(--space-1);
}

.message-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-3);
  margin: var(--space-3) 0;
  color: var(--text-secondary);
}

.message-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-3) 0;
}

.message-content th, .message-content td {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  text-align: left;
}

.message-content th {
  background: var(--bg-tertiary);
  font-weight: 600;
}

.message-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.message:hover .message-actions {
  opacity: 1;
}

.msg-btn {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.msg-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Thinking Indicator */
.thinking {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  color: var(--text-secondary);
}

.thinking-dots {
  display: flex;
  gap: 4px;
}

.thinking-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.4s infinite ease-in-out both;
}

.thinking-dot:nth-child(1) { animation-delay: -0.32s; }
.thinking-dot:nth-child(2) { animation-delay: -0.16s; }

/* Chat Input Area */
.chat-input-container {
  padding: var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
}

/* ==================== HISTORY VIEW ==================== */
.history-page, .settings-page, .about-page, .pricing-page, .api-page, .features-page, .vscode-page {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-5);
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.search-box {
  position: relative;
  width: 100%;
  max-width: 320px;
}

.search-input {
  width: 100%;
  padding: 10px var(--space-3) 10px 38px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.history-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.history-item:hover {
  border-color: var(--border-accent);
  background: var(--bg-tertiary);
}

.history-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--gradient);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}

.history-content {
  flex: 1;
  min-width: 0;
}

.history-title {
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.history-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: var(--space-3);
}

.history-actions {
  display: flex;
  gap: var(--space-2);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.history-item:hover .history-actions {
  opacity: 1;
}

/* ==================== RIGHT SIDEBAR ==================== */
.sidebar-right {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: var(--space-4);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--text-primary);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--space-4);
  right: var(--space-4);
  height: 2px;
  background: var(--gradient);
}

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
  display: none;
}

.tab-content.active {
  display: block;
}

/* File Items */
.file-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.file-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.file-item:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.file-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--accent-light);
  display: grid;
  place-items: center;
  font-size: 16px;
  color: var(--accent);
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==================== MODALS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: var(--space-5);
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.modal-lg {
  max-width: 700px;
}

.modal-header {
  padding: var(--space-6) var(--space-6) 0;
}

.modal-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: var(--space-2);
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  padding: 0 var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ==================== FORM ELEMENTS ==================== */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 15px;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-error {
  color: var(--error);
  font-size: 13px;
  margin-top: var(--space-2);
}

.form-hint {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: var(--space-1);
}

/* Checkbox & Radio */
.checkbox, .radio {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  padding: var(--space-2) 0;
}

.checkbox input, .radio input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox span, .radio span {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ==================== BUTTONS ==================== */
.btn {
  padding: 12px var(--space-5);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: inherit;
}

.btn-primary {
  background: var(--gradient);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-sm);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.btn-danger {
  background: var(--error-light);
  color: var(--error);
  border: 1px solid var(--error);
}

.btn-danger:hover {
  background: var(--error);
  color: white;
}

.btn-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success);
}

.btn-success:hover {
  background: var(--success);
  color: white;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==================== TOASTS ==================== */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toast {
  padding: 14px var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  animation: slideIn 0.3s ease;
  max-width: 420px;
}

.toast.success { 
  border-color: var(--success); 
  background: var(--success-light);
}

.toast.error { 
  border-color: var(--error); 
  background: var(--error-light);
}

.toast.warning { 
  border-color: var(--warning); 
  background: var(--warning-light);
}

.toast.info { 
  border-color: var(--info); 
  background: var(--info-light);
}

/* ==================== EMPTY STATES ==================== */
.empty {
  text-align: center;
  padding: var(--space-12) var(--space-5);
}

.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-xl);
  background: var(--bg-tertiary);
  display: grid;
  place-items: center;
  font-size: 32px;
  margin: 0 auto var(--space-4);
  border: 1px solid var(--border);
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.empty-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

/* ==================== CARDS ==================== */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--transition-fast);
}

.card:hover {
  border-color: var(--border-strong);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.card-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==================== PRICING PAGE ==================== */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-6);
}

@media (max-width: 900px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

.pricing-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  text-align: center;
  position: relative;
  transition: all var(--transition-base);
}

.pricing-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-accent);
}

.pricing-card.featured {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(168, 85, 247, 0.05) 100%);
}

.pricing-card.featured::before {
  content: 'POPULAR';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gradient);
  color: white;
  padding: 4px 16px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.pricing-tier {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-2);
}

.pricing-price {
  font-size: 48px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.pricing-price span {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
}

.pricing-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
}

.pricing-features {
  list-style: none;
  text-align: left;
  margin-bottom: var(--space-6);
}

.pricing-features li {
  padding: var(--space-2) 0;
  padding-left: 24px;
  position: relative;
  color: var(--text-secondary);
  font-size: 14px;
}

.pricing-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}

/* ==================== FEATURES PAGE ==================== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-6);
}

@media (max-width: 768px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
}

.feature-item {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.feature-item:hover {
  border-color: var(--border-accent);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--gradient-subtle);
  display: grid;
  place-items: center;
  font-size: 24px;
  flex-shrink: 0;
  border: 1px solid var(--border-accent);
}

.feature-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-1);
  color: var(--text-primary);
}

.feature-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==================== API PAGE ==================== */
.api-section {
  margin-bottom: var(--space-6);
}

.api-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: var(--text-primary);
}

.code-block {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-x: auto;
  color: var(--text-secondary);
  line-height: 1.6;
}

.code-block .comment {
  color: var(--text-muted);
}

.code-block .string {
  color: #a5d6ff;
}

.code-block .keyword {
  color: #ff7b72;
}

.code-block .function {
  color: #d2a8ff;
}

/* ==================== SETTINGS PAGE ==================== */
.settings-section {
  margin-bottom: var(--space-8);
}

.settings-section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-label {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.settings-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 48px;
  height: 26px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent-light);
  border-color: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: var(--accent);
}

/* ==================== LOGIN VIEW ==================== */
.login-view {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 9999;
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
}

.login-view.active {
  display: flex !important; /* Show when active */
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  text-align: center;
}

.login-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  animation: glow 3s ease-in-out infinite;
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-box h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.login-form {
  text-align: left;
}

.login-info {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

/* Hide sidebar when in login mode */
.app.login-mode .sidebar-left,
.app.login-mode .sidebar-right,
.app.login-mode .main {
  display: none;
}

/* ==================== UTILITIES ==================== */
.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;
}

.hidden {
  display: none !important;
}

.text-gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-center { text-align: center; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }

.w-full { width: 100%; }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}
