/* ============================
   AI Hub 2026 - Premium Design System
   ============================ */

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #0f0f23;
  --bg-tertiary: #161630;
  --bg-card: #1a1a3e;
  --bg-hover: #22224a;
  --bg-input: #12122a;
  --bg-message-user: linear-gradient(135deg, #6366f1, #8b5cf6);
  --bg-message-ai: #1e1e42;
  --bg-sidebar: #0c0c1e;
  --border-color: rgba(99, 102, 241, 0.15);
  --border-active: rgba(99, 102, 241, 0.4);
  --text-primary: #f0f0ff;
  --text-secondary: #a0a0cc;
  --text-muted: #6b6b99;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --gradient-gold: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --font-ar: 'Tajawal', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --sidebar-width: 300px;
  --header-height: 60px;
}

[data-theme="light"] {
  --bg-primary: #f5f5ff;
  --bg-secondary: #ebebfa;
  --bg-tertiary: #e0e0f5;
  --bg-card: #ffffff;
  --bg-hover: #f0f0ff;
  --bg-input: #ffffff;
  --bg-message-user: linear-gradient(135deg, #6366f1, #8b5cf6);
  --bg-message-ai: #f0f0ff;
  --bg-sidebar: #f8f8ff;
  --border-color: rgba(99, 102, 241, 0.15);
  --border-active: rgba(99, 102, 241, 0.4);
  --text-primary: #1a1a3e;
  --text-secondary: #4a4a7a;
  --text-muted: #8888aa;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }

body {
  font-family: var(--font-ar);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Layout */
.app-layout { display: flex; height: 100vh; position: relative; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  flex-shrink: 0;
}

.sidebar.collapsed {
  transform: translateX(100%);
  position: absolute;
  right: 0; top: 0; bottom: 0;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo { display: flex; align-items: center; gap: 10px; flex: 1; }

.sidebar-logo .logo-icon {
  width: 40px; height: 40px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.sidebar-logo h1 {
  font-size: 16px; font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.sidebar-logo span {
  font-size: 10px; color: var(--text-muted);
  display: block;
  -webkit-text-fill-color: var(--text-muted);
}

.btn-new-chat {
  padding: 12px; margin: 12px 16px;
  width: calc(100% - 32px);
  background: var(--gradient-primary);
  color: white; border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ar);
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.btn-new-chat:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(99, 102, 241, 0.4); }

.sidebar-nav { padding: 8px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-md);
  cursor: pointer; color: var(--text-secondary);
  font-size: 14px; font-weight: 500;
  transition: all 0.2s; border: none;
  background: none; width: 100%;
  font-family: var(--font-ar); text-align: right;
}
.nav-item:hover, .nav-item.active { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }
.nav-item i { width: 20px; text-align: center; font-size: 15px; }
.nav-item .badge {
  margin-right: auto;
  background: var(--gradient-primary); color: white;
  font-size: 10px; padding: 2px 8px;
  border-radius: var(--radius-full); font-weight: 700;
}

.sidebar-divider { height: 1px; background: var(--border-color); margin: 8px 16px; }

.chat-history-section { flex: 1; overflow-y: auto; padding: 8px; }
.chat-history-title {
  font-size: 11px; color: var(--text-muted);
  padding: 8px 12px 4px;
  text-transform: uppercase; letter-spacing: 1px; font-weight: 700;
}

.chat-history-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-secondary);
  font-size: 13px; transition: all 0.2s;
}
.chat-history-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.chat-history-item .delete-chat {
  opacity: 0; margin-right: auto; color: var(--text-muted);
  cursor: pointer; padding: 4px; border: none;
  background: none; font-size: 12px;
}
.chat-history-item:hover .delete-chat { opacity: 1; }

.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid var(--border-color);
  display: flex; align-items: center; gap: 8px;
}

.theme-toggle {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-secondary);
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  font-size: 16px; transition: all 0.2s;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--accent); border-color: var(--accent); }

/* Main Content */
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }

/* Header */
.main-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.btn-toggle-sidebar {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-secondary);
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  font-size: 14px; transition: all 0.2s;
}
.btn-toggle-sidebar:hover { color: var(--accent); border-color: var(--accent); }

.model-selector-wrapper { flex: 1; max-width: 400px; }

.model-selector {
  width: 100%; padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-primary);
  font-family: var(--font-ar);
  font-size: 13px; font-weight: 600;
  cursor: pointer; display: flex;
  align-items: center; gap: 8px;
  transition: all 0.2s; position: relative;
}
.model-selector:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.model-selector .model-name { flex: 1; text-align: right; }
.model-selector .model-badge {
  font-size: 9px; padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary); color: white; font-weight: 700;
}

.header-actions { display: flex; align-items: center; gap: 8px; margin-right: auto; }

.header-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-secondary);
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  font-size: 14px; transition: all 0.2s;
}
.header-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Model Dropdown */
.model-dropdown {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000; display: none;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}
.model-dropdown.show { display: flex; }

.model-dropdown-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%; max-width: 700px; max-height: 80vh;
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.model-search { padding: 16px; border-bottom: 1px solid var(--border-color); }
.model-search input {
  width: 100%; padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input); color: var(--text-primary);
  font-family: var(--font-ar); font-size: 14px;
  outline: none; transition: border-color 0.2s;
}
.model-search input:focus { border-color: var(--accent); }

.model-categories { display: flex; gap: 6px; padding: 0 16px 12px; flex-wrap: wrap; }
.model-cat-btn {
  padding: 6px 14px; border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: transparent; color: var(--text-secondary);
  font-family: var(--font-ar); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.model-cat-btn.active, .model-cat-btn:hover {
  background: var(--accent); color: white; border-color: var(--accent);
}

.model-list { overflow-y: auto; padding: 8px; flex: 1; }

.model-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-md);
  cursor: pointer; transition: all 0.2s;
  border: 1px solid transparent;
}
.model-item:hover { background: var(--bg-hover); border-color: var(--border-color); }
.model-item.selected { background: var(--accent-glow); border-color: var(--accent); }

.model-item .model-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; flex-shrink: 0;
}

.model-item .model-info { flex: 1; min-width: 0; }
.model-item .model-info h4 { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.model-item .model-info p {
  font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.model-item .model-provider {
  font-size: 11px; color: var(--text-muted);
  padding: 3px 8px; border-radius: var(--radius-full);
  background: var(--bg-card); border: 1px solid var(--border-color);
  white-space: nowrap;
}

.model-item .model-badge-tag {
  font-size: 9px; padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 800; color: white; white-space: nowrap;
}

/* Chat Area */
.chat-area {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column;
}

.chat-welcome {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; gap: 20px;
  padding: 40px 20px; max-width: 700px; margin: 0 auto;
}

.welcome-icon {
  width: 80px; height: 80px;
  background: var(--gradient-primary);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  box-shadow: 0 0 60px rgba(99, 102, 241, 0.3);
  animation: float 3s ease-in-out infinite;
}

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

.welcome-title {
  font-size: 28px; font-weight: 900;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.4;
}

.welcome-subtitle { font-size: 15px; color: var(--text-secondary); line-height: 1.7; max-width: 500px; }

.welcome-stats { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.stat-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-number {
  font-size: 28px; font-weight: 900;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label { font-size: 12px; color: var(--text-muted); }

.quick-actions {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px; width: 100%; max-width: 600px; margin-top: 8px;
}

.quick-action {
  padding: 14px 16px; border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card); cursor: pointer;
  transition: all 0.2s; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.quick-action:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.quick-action .qa-icon { font-size: 24px; }
.quick-action .qa-text { font-size: 12px; color: var(--text-secondary); font-weight: 600; }

/* Messages */
.messages-container {
  display: flex; flex-direction: column; gap: 16px;
  max-width: 850px; margin: 0 auto; width: 100%; padding-bottom: 20px;
}

.message { display: flex; gap: 12px; animation: msgIn 0.3s ease-out; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.message.user { flex-direction: row-reverse; }

.message-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.message.user .message-avatar { background: var(--gradient-primary); color: white; }
.message.ai .message-avatar { background: var(--bg-card); border: 1px solid var(--border-color); }

.message-bubble {
  max-width: 80%; padding: 12px 18px;
  border-radius: var(--radius-lg);
  line-height: 1.8; font-size: 14px; position: relative;
  word-wrap: break-word; overflow-wrap: break-word;
}
.message.user .message-bubble { background: var(--bg-message-user); color: white; }
.message.ai .message-bubble { background: var(--bg-message-ai); border: 1px solid var(--border-color); }

.message-bubble pre {
  background: #0d0d1a; border-radius: var(--radius-sm);
  padding: 12px; overflow-x: auto; margin: 8px 0;
  font-family: var(--font-mono); font-size: 13px;
  line-height: 1.5; border: 1px solid var(--border-color);
  direction: ltr; text-align: left;
}
.message-bubble code { font-family: var(--font-mono); font-size: 13px; }
.message-bubble p { margin-bottom: 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { padding-right: 20px; margin: 8px 0; }
.message-bubble li { margin-bottom: 4px; }

.message-actions {
  display: flex; gap: 4px; margin-top: 6px;
  opacity: 0; transition: opacity 0.2s;
}
.message:hover .message-actions { opacity: 1; }

.msg-action-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm); border: none;
  background: var(--bg-card); color: var(--text-muted);
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  font-size: 12px; transition: all 0.2s;
}
.msg-action-btn:hover { color: var(--accent); background: var(--bg-hover); }

.typing-indicator { display: flex; gap: 4px; padding: 8px 0; }
.typing-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); animation: typingBounce 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-8px); } }

/* Input Area */
.input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary); flex-shrink: 0;
}

.input-container { max-width: 850px; margin: 0 auto; position: relative; }

.input-wrapper {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-wrapper:focus-within { border-color: var(--accent); box-shadow: var(--shadow-glow); }

.input-wrapper textarea {
  flex: 1; border: none;
  background: transparent; color: var(--text-primary);
  font-family: var(--font-ar); font-size: 14px;
  line-height: 1.6; resize: none; outline: none;
  max-height: 150px; min-height: 24px;
}
.input-wrapper textarea::placeholder { color: var(--text-muted); }

.btn-send {
  width: 40px; height: 40px;
  border-radius: var(--radius-md); border: none;
  background: var(--gradient-primary); color: white;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  font-size: 16px; transition: all 0.2s; flex-shrink: 0;
}
.btn-send:hover { transform: scale(1.05); box-shadow: 0 0 20px rgba(99, 102, 241, 0.4); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-stop { background: var(--gradient-gold) !important; }

.input-hint { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 8px; }

/* Image Generation */
.image-gen-container { flex: 1; overflow-y: auto; padding: 24px; }
.image-gen-content { max-width: 1000px; margin: 0 auto; }

.image-gen-header { text-align: center; margin-bottom: 32px; }
.image-gen-header h2 {
  font-size: 24px; font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.image-gen-header p { color: var(--text-secondary); font-size: 14px; }

.image-gen-form {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 24px; margin-bottom: 24px;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 700;
  color: var(--text-secondary); margin-bottom: 8px;
}

.form-group textarea,
.form-group input,
.form-group select {
  width: 100%; padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input); color: var(--text-primary);
  font-family: var(--font-ar); font-size: 14px;
  outline: none; transition: border-color 0.2s;
}
.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus { border-color: var(--accent); }

.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.btn-generate {
  width: 100%; padding: 14px;
  background: var(--gradient-primary);
  color: white; border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ar); font-size: 16px; font-weight: 700;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center; gap: 8px;
  transition: all 0.3s;
}
.btn-generate:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4); }
.btn-generate:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.image-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}

.image-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: all 0.3s;
}
.image-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.image-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.image-card-info { padding: 12px 16px; }
.image-card-info p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.image-card-info .model-tag { font-size: 10px; color: var(--accent); margin-top: 6px; display: block; }

/* Prompt Library */
.prompts-container { flex: 1; overflow-y: auto; padding: 24px; }
.prompts-content { max-width: 1000px; margin: 0 auto; }
.prompts-header { text-align: center; margin-bottom: 24px; }
.prompts-header h2 {
  font-size: 24px; font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.prompts-filter {
  display: flex; gap: 8px; justify-content: center;
  flex-wrap: wrap; margin-bottom: 24px;
}

.filter-btn {
  padding: 8px 18px; border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: transparent; color: var(--text-secondary);
  font-family: var(--font-ar); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.filter-btn.active, .filter-btn:hover {
  background: var(--accent); color: white; border-color: var(--accent);
}

.prompts-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;
}

.prompt-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px; cursor: pointer;
  transition: all 0.3s; position: relative; overflow: hidden;
}
.prompt-card::before {
  content: ''; position: absolute;
  top: 0; right: 0; left: 0; height: 3px;
  background: var(--card-color, var(--gradient-primary));
}
.prompt-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.prompt-card .card-icon { font-size: 32px; margin-bottom: 12px; }
.prompt-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; color: var(--text-primary); }
.prompt-card .card-subtitle { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.prompt-card p {
  font-size: 13px; color: var(--text-secondary); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

.prompt-card .use-btn {
  margin-top: 12px; padding: 6px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent);
  background: transparent; color: var(--accent);
  font-family: var(--font-ar); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.prompt-card .use-btn:hover { background: var(--accent); color: white; }

/* Pricing */
.pricing-container { flex: 1; overflow-y: auto; padding: 24px; }
.pricing-content { max-width: 1100px; margin: 0 auto; text-align: center; }
.pricing-header { margin-bottom: 40px; }
.pricing-header h2 {
  font-size: 32px; font-weight: 900;
  background: var(--gradient-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}
.pricing-header p { color: var(--text-secondary); font-size: 16px; }

.pricing-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px; max-width: 1000px; margin: 0 auto;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px 24px; position: relative; transition: all 0.3s;
}
.pricing-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.2);
  transform: scale(1.02);
}

.pricing-card .popular-badge {
  position: absolute; top: -12px; left: 50%;
  transform: translateX(-50%);
  background: var(--gradient-primary);
  color: white; padding: 4px 20px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700;
}

.pricing-card h3 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.pricing-card .price {
  font-size: 42px; font-weight: 900;
  background: var(--gradient-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}
.pricing-card .period { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }

.pricing-features { text-align: right; margin-bottom: 24px; }
.pricing-features li {
  list-style: none; padding: 8px 0;
  font-size: 14px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 10px;
}
.pricing-features li i { color: var(--accent); font-size: 14px; width: 20px; }
.pricing-features li i.fa-xmark { color: var(--text-muted); }

.btn-pricing {
  width: 100%; padding: 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--accent);
  background: transparent; color: var(--accent);
  font-family: var(--font-ar);
  font-size: 16px; font-weight: 700;
  cursor: pointer; transition: all 0.3s;
}
.btn-pricing.primary { background: var(--gradient-primary); color: white; border: none; }
.btn-pricing:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3); }

/* Spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white; border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast-container {
  position: fixed; top: 20px; left: 50%;
  transform: translateX(-50%); z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}

.toast {
  padding: 12px 24px; border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-ar); font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease-out;
  display: flex; align-items: center; gap: 10px;
  transition: all 0.3s;
}
.toast.success { border-color: #10b981; }
.toast.error { border-color: #ef4444; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Sidebar overlay */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 199; display: none;
}
.sidebar-overlay.show { display: block; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; top: 0; right: 0; bottom: 0;
    z-index: 200; box-shadow: var(--shadow-lg);
  }
  .sidebar.collapsed { transform: translateX(100%); }
  .model-selector-wrapper { max-width: 200px; }
  .welcome-title { font-size: 22px; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .pricing-cards { grid-template-columns: 1fr; }
  .pricing-card.featured { transform: none; }
  .image-gallery { grid-template-columns: 1fr; }
  .message-bubble { max-width: 90%; }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 480px) {
  .welcome-stats { gap: 16px; }
  .stat-number { font-size: 22px; }
  .quick-actions { grid-template-columns: 1fr; }
  .model-dropdown-content { width: 95%; }
}

/* Markdown improvements */
.message-bubble h1, .message-bubble h2, .message-bubble h3 { margin: 12px 0 6px; font-weight: 700; }
.message-bubble h1 { font-size: 1.3em; }
.message-bubble h2 { font-size: 1.15em; }
.message-bubble h3 { font-size: 1.05em; }

.message-bubble blockquote {
  border-right: 3px solid var(--accent);
  padding-right: 12px; margin: 8px 0;
  color: var(--text-secondary); font-style: italic;
}

.message-bubble strong { color: var(--accent-hover); }
.message-bubble a { color: var(--accent); text-decoration: underline; }

.message-bubble table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.message-bubble th, .message-bubble td {
  border: 1px solid var(--border-color);
  padding: 8px 12px; text-align: right; font-size: 13px;
}
.message-bubble th { background: var(--bg-card); font-weight: 700; }

/* Copy button on code blocks */
.code-block-wrapper { position: relative; }
.code-copy-btn {
  position: absolute; top: 8px; left: 8px;
  padding: 4px 10px; border-radius: var(--radius-sm);
  background: rgba(99,102,241,0.2); color: var(--accent);
  border: none; font-size: 11px; cursor: pointer;
  font-family: var(--font-ar); transition: all 0.2s;
  z-index: 5;
}
.code-copy-btn:hover { background: var(--accent); color: white; }
