/* =====================================================
   AI Chat SaaS Platform - Core Styles
   ===================================================== */

/* ---- Root Variables ---- */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --dark: #0f172a;
  --light: #f8fafc;
  --border: #e2e8f0;
  --text: #334155;
  --text-muted: #64748b;
  --bg: #ffffff;
  --bg-card: #f8fafc;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, Inconsolata, "Fira Code", monospace;
}

/* ---- Reset & Base ---- */
* { box-sizing: border-box; }
html, body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Landing Page ---- */
.landing-page {
  padding-top: 76px;
}

.hero-section {
  min-height: 70vh;
  background: linear-gradient(135deg, var(--dark) 0%, #1e293b 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-section .container {
  position: relative;
  z-index: 1;
}

.hero-section h1 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hero-section .lead {
  font-size: 1.125rem;
  opacity: 0.8;
}

.hero-section .badge {
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-weight: 500;
  font-size: 0.75rem;
  background: rgba(255,255,255,0.15) !important;
  border: 1px solid rgba(255,255,255,0.2);
}

/* ---- Auth Pages ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  padding: 2rem 1rem;
}

.auth-card {
  border-radius: var(--radius-lg);
  background: white;
  width: 100%;
  max-width: 420px;
}

.auth-card .bi {
  line-height: 1;
}

.auth-card .form-control {
  border-radius: var(--radius);
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  font-size: 0.9375rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-card .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-card .form-label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}

.auth-card .btn {
  border-radius: var(--radius);
  padding: 0.625rem 1rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.auth-card .btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.auth-card a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-card a:hover {
  text-decoration: underline;
}

/* ---- Dashboard ---- */
.dashboard-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}

/* Sidebar */
.dashboard-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, width 0.3s ease;
  position: relative;
  z-index: 100;
}

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

.sidebar-header .btn-new-chat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.15s;
  cursor: pointer;
}

.sidebar-header .btn-new-chat:hover {
  background: var(--bg-card);
  border-color: var(--text-muted);
}

.sidebar-toggle {
  padding: 0.5rem;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-toggle:hover {
  background: var(--border);
}

.conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.conversation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 0.125rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.conversation-item:hover {
  background: rgba(37, 99, 235, 0.05);
}

.conversation-item.active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  font-weight: 500;
}

.conversation-item .title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 0.5rem;
}

.conversation-item .delete-btn {
  opacity: 0;
  padding: 0.25rem;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.conversation-item:hover .delete-btn {
  opacity: 1;
}

.conversation-item .delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: background 0.15s;
}

.sidebar-user:hover {
  background: rgba(37, 99, 235, 0.05);
  color: var(--text);
}

/* Main Content Area */
.dashboard-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* Header */
.dashboard-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-brand {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
}

.header-brand:hover {
  color: var(--primary);
}

.model-selector {
  position: relative;
}

.model-selector-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: white;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  max-width: 220px;
}

.model-selector-btn:hover {
  border-color: var(--text-muted);
  background: var(--bg-card);
}

.model-selector-btn .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.model-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
}

.model-dropdown.show {
  display: block;
}

.model-dropdown .provider-header {
  padding: 0.5rem 1rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.model-dropdown .model-option {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.model-dropdown .model-option:last-child {
  border-bottom: none;
}

.model-dropdown .model-option:hover,
.model-dropdown .model-option.selected {
  background: var(--bg-card);
}

.model-dropdown .model-name {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text);
}

.model-dropdown .model-id {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.model-dropdown .model-tag {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--light);
  color: var(--text-muted);
  align-self: flex-start;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 1.125rem;
}

.header-btn:hover {
  background: var(--bg-card);
  color: var(--text);
}

/* Messages Area */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
}

.messages-container {
  max-width: 768px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 1rem;
  background: linear-gradient(135deg, var(--border), var(--bg-card));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

/* Message Bubbles */
.message {
  display: flex;
  gap: 1rem;
  animation: messageAppear 0.3s ease-out;
}

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

.message.user {
  justify-content: flex-end;
}

.message .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  background: var(--bg-card);
  color: var(--text-muted);
}

.message.user .avatar {
  order: 2;
  background: var(--primary);
  color: white;
}

.message .bubble {
  max-width: 80%;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  line-height: 1.6;
  font-size: 0.9375rem;
}

.message.user .bubble {
  background: var(--primary);
  color: white;
  border-radius: 1rem 1rem 0.25rem 1rem;
  max-width: 80%;
}

.message.assistant .bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem 1rem 1rem 0.25rem;
  width: 100%;
  max-width: 100%;
}

.message .model-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
  opacity: 0.7;
}

.message .bubble-content {
  word-wrap: break-word;
}

.message .bubble-content p:last-child {
  margin-bottom: 0;
}

/* Streaming cursor */
.streaming-cursor::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--text-muted);
  margin-left: 3px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

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

/* Markdown in messages */
.message .bubble-content h1,
.message .bubble-content h2,
.message .bubble-content h3,
.message .bubble-content h4 {
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.message .bubble-content h1 { font-size: 1.25rem; }
.message .bubble-content h2 { font-size: 1.125rem; }
.message .bubble-content h3 { font-size: 1rem; }

.message .bubble-content ul,
.message .bubble-content ol {
  margin-bottom: 0.75rem;
  padding-left: 1.25rem;
}

.message .bubble-content li {
  margin-bottom: 0.25rem;
}

.message .bubble-content a {
  color: var(--primary);
  text-decoration: none;
}

.message .bubble-content a:hover {
  text-decoration: underline;
}

.message .bubble-content blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 1rem;
  margin: 0.75rem 0;
  color: var(--text-muted);
  font-style: italic;
}

.message .bubble-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-card);
  padding: 0.15rem 0.375rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  color: var(--text);
}

/* Code blocks */
.message .bubble-content pre {
  position: relative;
  background: var(--dark);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0.75rem 0;
  overflow-x: auto;
  max-width: 100%;
}

.message .bubble-content pre code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #e5e7eb;
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
}

.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.375rem;
  background: rgba(255,255,255,0.1);
  color: #a1a1aa;
  font-size: 0.75rem;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0;
}

pre:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  background: rgba(255,255,255,0.2);
  color: white;
}

.code-copy-btn.copied {
  opacity: 1;
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

/* Input Area */
.input-area {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 1rem 1.25rem;
}

.input-wrapper {
  max-width: 768px;
  margin: 0 auto;
}

.input-box {
  display: flex;
  align-items: end;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: white;
  padding: 0.75rem 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-box.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: rgba(37, 99, 235, 0.03);
}

/* File upload badge */
.file-badge-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  padding: 0.25rem 0;
}

.input-box textarea {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
  outline: none;
  max-height: 200px;
  padding: 0;
}

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

.input-box .input-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.input-box .btn-action {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 1rem;
}

.input-box .btn-action:hover {
  background: var(--bg-card);
  color: var(--text);
}

.input-box .btn-send {
  background: var(--primary);
  color: white;
}

.input-box .btn-send:hover {
  background: var(--primary-dark);
}

.input-box .btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.input-box .btn-stop {
  background: var(--danger);
  color: white;
  display: none;
}

.input-box .btn-stop:hover {
  background: #dc2626;
}

.input-box .btn-stop.visible {
  display: flex;
}

.input-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Settings Panel */
.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  max-width: 100vw;
  height: 100vh;
  background: white;
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-panel.open {
  transform: translateX(0);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.settings-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.settings-group input,
.settings-group textarea,
.settings-group select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: var(--font-sans);
  outline: none;
}

.settings-group input:focus,
.settings-group textarea:focus,
.settings-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.settings-group textarea {
  resize: none;
  min-height: 100px;
}

.settings-group .range-value {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

.settings-group .range-value .value {
  font-family: var(--font-mono);
  background: var(--bg-card);
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.settings-group input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  padding: 0;
  border: none;
}

.settings-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  transition: transform 0.1s;
}

.settings-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 90;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}

.overlay.visible {
  opacity: 1;
}

.overlay.show {
  display: block;
}

/* Mobile Sidebar */
@media (max-width: 991px) {
  .dashboard-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    width: 280px;
  }

  .dashboard-sidebar.show {
    transform: translateX(0);
  }
}

/* Mobile responsive */
@media (max-width: 640px) {
  .hero-section h1 {
    font-size: 2rem;
  }

  .message .bubble {
    max-width: 90%;
    font-size: 0.875rem;
  }

  .message .avatar {
    width: 28px;
    height: 28px;
    font-size: 0.625rem;
  }

  .model-dropdown {
    width: 90vw;
    right: -50px;
  }

  .settings-panel {
    width: 100vw;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Alerts */
.alert {
  border-radius: var(--radius);
  border: none;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

/* Error message in chat */
.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* Loading indicator */
.loading-dots {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
  padding: 0.5rem 0;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Dark theme support */
.dark-theme {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --light: #1e293b;
}

.dark-theme .auth-page {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.dark-theme .auth-card {
  background: #1e293b;
  border: 1px solid #334155;
}

.dark-theme .form-control {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

.dark-theme .form-control:focus {
  background: #1e293b;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
  color: #f1f5f9;
}

.dark-theme .input-box {
  background: #1e293b;
  border-color: #334155;
}

.dark-theme .input-box textarea {
  color: #f1f5f9;
}

.dark-theme .settings-panel {
  background: #0f172a;
  border-color: #334155;
}

.dark-theme .model-dropdown {
  background: #0f172a;
  border-color: #334155;
}

.dark-theme .model-dropdown .model-option:hover,
.dark-theme .model-dropdown .model-option.selected {
  background: #1e293b;
}

.dark-theme .message.assistant .bubble {
  background: #1e293b;
  border-color: #334155;
}

.dark-theme .code-copy-btn {
  color: #94a3b8;
}

.dark-theme .error-message {
  background: #450a0a;
  border-color: #7f1d1d;
  color: #fca5a5;
}

.dark-theme .dashboard-header {
  background: #0f172a;
  border-color: #334155;
}

.dark-theme .input-area {
  background: #0f172a;
  border-color: #334155;
}

.dark-theme .dashboard-sidebar {
  background: #1e293b;
  border-color: #334155;
}

.dark-theme .sidebar-header {
  border-color: #334155;
}

.dark-theme .sidebar-footer {
  border-color: #334155;
}

.dark-theme .sidebar-user {
  border-color: #334155;
  color: #94a3b8;
}

.dark-theme .settings-group input,
.dark-theme .settings-group textarea,
.dark-theme .settings-group select {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

.dark-theme .settings-group .range-value .value {
  background: #1e293b;
  color: #94a3b8;
}

.dark-theme .settings-group input[type="range"] {
  background: #334155;
}

/* Admin Panel */
.admin-page {
  min-height: 100vh;
  background: var(--light);
}

.admin-sidebar {
  width: 240px;
  background: var(--dark);
  color: white;
  min-height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.admin-sidebar .brand {
  padding: 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-weight: 700;
  font-size: 1.125rem;
}

.admin-sidebar .nav-item {
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: all 0.15s;
  font-size: 0.9375rem;
}

.admin-sidebar .nav-item:hover,
.admin-sidebar .nav-item.active {
  color: white;
  background: rgba(255,255,255,0.1);
  border-left: 3px solid var(--primary);
}

.admin-sidebar .nav-item .icon {
  font-size: 1.25rem;
  line-height: 1;
}

.admin-main {
  margin-left: 240px;
  min-height: 100vh;
  padding: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--border);
  transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card .icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-card .label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Table styles */
.table-container {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table-container th {
  background: var(--bg-card);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.table-container td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.table-container tbody tr:hover {
  background: var(--bg-card);
}

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

/* Widget page */
.widget-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  background: var(--bg);
}

.code-block {
  background: var(--dark);
  color: #e5e7eb;
  padding: 1rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Responsive admin */
@media (max-width: 991px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.show {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
}
