/* === Neo Dashboard CSS === */

/* Theme Variables */
[data-theme="dark"] {
  --bg: #1e2030;
  --bg-card: #282a3a;
  --bg-card-hover: #2f3148;
  --bg-input: #333550;
  --border: #3b3e56;
  --text: #d8dce8;
  --text-muted: #8b90a8;
  --text-heading: #edf0f8;
  --accent: #7c7ff2;
  --accent-hover: #9b9ef8;
  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;
  --nav-bg: #232538;
  --header-bg: #1a1c2e;
  --shadow: 0 2px 8px rgba(0,0,0,0.2);
}

[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fc;
  --bg-input: #f0f2f5;
  --border: #e2e5ea;
  --text: #1a1d2e;
  --text-muted: #6b7280;
  --text-heading: #111827;
  --accent: #4f46e5;
  --accent-hover: #6366f1;
  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;
  --nav-bg: #ffffff;
  --header-bg: #ffffff;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 0.75rem; }
.header-right { display: flex; align-items: center; gap: 0.5rem; }
.logo { font-size: 1.4rem; font-weight: 700; color: var(--accent); }
.logo-large { font-size: 2.5rem; font-weight: 700; color: var(--accent); }
.version { font-size: 0.75rem; color: var(--text-muted); }

/* Navigation */
.nav { display: flex; gap: 0.25rem; }
.nav-link {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--bg-card); }
.nav-link.active { color: var(--accent); background: var(--bg-card); }

/* Main */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.card-title { font-size: 1rem; font-weight: 600; color: var(--text-heading); }

/* Grid */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Stats */
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text-heading); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }
.stat-good { color: var(--success); }
.stat-warn { color: var(--warning); }
.stat-bad { color: var(--error); }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
}
.table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.table tr:hover { background: var(--bg-card-hover); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { background: var(--bg-card-hover); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.4rem;
  border-radius: 4px;
}
.btn-icon:hover { color: var(--text); background: var(--bg-card); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

/* Toggle Switch */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 24px; transition: 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background: var(--text);
  border-radius: 50%; transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-error { background: rgba(239,68,68,0.15); color: var(--error); border: 1px solid rgba(239,68,68,0.3); }
.alert-success { background: rgba(34,197,94,0.15); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }

/* Status Badge */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-error { background: rgba(239,68,68,0.15); color: var(--error); }
.badge-info { background: rgba(99,102,241,0.15); color: var(--accent); }

/* Channel Badge */
.badge-channel {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 8px;
  font-weight: 600;
}
.badge-telegram { background: rgba(0,136,204,0.15); color: #0088cc; }
.badge-web { background: rgba(99,102,241,0.15); color: var(--accent); }
.badge-email { background: rgba(245,158,11,0.15); color: var(--warning); }

/* Login */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-subtitle { color: var(--text-muted); margin-top: 0.5rem; }

/* Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px - 3rem);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}
.chat-message {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
}
.chat-message.user {
  background: rgba(99,102,241,0.1);
  margin-left: 3rem;
}
.chat-message.assistant {
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-right: 3rem;
}
.chat-sender {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.chat-content { line-height: 1.6; }
.chat-content p { margin-bottom: 0.5rem; }
.chat-content p:last-child { margin-bottom: 0; }
.chat-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}
.chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  resize: none;
}
.chat-input:focus { outline: none; border-color: var(--accent); }
.chat-status { font-size: 0.8rem; color: var(--text-muted); padding: 0.5rem 0; }
.chat-typing { color: var(--accent); font-style: italic; }

/* Logs */
.log-entry { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.8rem; padding: 0.3rem 0; border-bottom: 1px solid var(--border); }
.log-time { color: var(--text-muted); }
.log-source { color: var(--accent); font-weight: 600; }
.log-level-error { color: var(--error); }
.log-level-warn { color: var(--warning); }
.log-level-info { color: var(--text-muted); }

/* Page Title */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.page-title { font-size: 1.4rem; font-weight: 700; color: var(--text-heading); }

/* Utility */
.mb-1 { margin-bottom: 1rem; }
.mt-1 { margin-top: 1rem; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 1rem; }

/* Settings Row */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-info { flex: 1; }
.setting-name { font-weight: 600; }
.setting-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.2rem; }
