/* ═══════════════════════════════════════════════════
   CSGO Market Tool — Dashboard Styles
   ═══════════════════════════════════════════════════ */

:root {
  --bg: #0f1117;
  --bg-card: #1a1d26;
  --bg-sidebar: #141720;
  --bg-input: #1e2230;
  --border: #2a2e3a;
  --text: #e1e4ea;
  --text-dim: #8b8f9a;
  --primary: #5b7cfa;
  --primary-hover: #4a6ae8;
  --green: #22c55e;
  --red: #ef4444;
  --gold: #f59e0b;
  --blue: #3b82f6;
  --purple: #a855f7;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --transition: 0.2s ease;
}

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

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* ═══════ Utilities ═══════ */
.hidden { display: none !important; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  vertical-align: middle;
}
.badge.red { background: var(--red); }

/* ═══════ Buttons ═══════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  color: #fff;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #374151; }
.btn-secondary:hover { background: #4b5563; }
.btn-danger { background: var(--red); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.btn-outline:hover { border-color: var(--text-dim); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }

/* ═══════ Form ═══════ */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 4px;
  font-weight: 500;
}
input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border var(--transition);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,124,250,0.15);
}
.form-select-sm {
  width: auto;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
}
.error-msg {
  background: rgba(239,68,68,0.1);
  border: 1px solid var(--red);
  color: var(--red);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* ═══════ Login Page ═══════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: linear-gradient(135deg, #0f1117 0%, #1a1d2e 50%, #0f1117 100%);
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.login-logo {
  text-align: center;
  margin-bottom: 1rem;
}
.login-logo i { font-size: 2.5rem; color: var(--primary); }
.login-card h1 {
  text-align: center;
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}
.login-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

/* ═══════ Dashboard Layout ═══════ */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar.collapsed { transform: translateX(-100%); }
.sidebar-header {
  padding: 1.2rem 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
}
.sidebar-header i { font-size: 1.3rem; }
.sidebar-menu {
  list-style: none;
  flex: 1;
  padding: 0.5rem 0;
  overflow-y: auto;
}
.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--text-dim);
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: all var(--transition);
}
.sidebar-menu li a:hover {
  color: var(--text);
  background: rgba(91,124,250,0.05);
  text-decoration: none;
}
.sidebar-menu li a.active {
  color: var(--primary);
  background: rgba(91,124,250,0.08);
  border-left-color: var(--primary);
}
.sidebar-menu li a i { font-size: 1.1rem; width: 20px; text-align: center; }
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

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

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  display: none;
}
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-user { font-size: 0.85rem; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.health-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
}
.health-dot.green { background: var(--green); }
.health-dot.red { background: var(--red); }

/* Pages */
.page { display: none; padding: 1.5rem; flex: 1; }
.page.active { display: block; }
.page h2 { margin-bottom: 1.25rem; font-size: 1.3rem; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: rgba(91,124,250,0.12);
  color: var(--primary);
  flex-shrink: 0;
}
.stat-icon.green { background: rgba(34,197,94,0.12); color: var(--green); }
.stat-icon.blue { background: rgba(59,130,246,0.12); color: var(--blue); }
.stat-icon.gold { background: rgba(245,158,11,0.12); color: var(--gold); }
.stat-icon.purple { background: rgba(168,85,247,0.12); color: var(--purple); }
.stat-icon.red { background: rgba(239,68,68,0.12); color: var(--red); }
.stat-body { display: flex; flex-direction: column; }
.stat-val { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }

/* Actions Row */
.actions-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card h3 { margin-bottom: 1rem; font-size: 1rem; }
.card h4 { margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--text-dim); }

/* Tables */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
thead th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(42,46,58,0.5);
  vertical-align: middle;
}
tbody tr:hover { background: rgba(91,124,250,0.03); }
.cell-green { color: var(--green); }
.cell-red { color: var(--red); }
.cell-gold { color: var(--gold); }
.cell-dim { color: var(--text-dim); }

/* Settings */
.settings-sections { display: flex; flex-direction: column; gap: 1.5rem; }
.secret-code {
  display: block;
  background: var(--bg-input);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: monospace;
  letter-spacing: 2px;
  word-break: break-all;
  margin-top: 4px;
}
.qr-container { text-align: center; margin: 1rem 0; }
.qr-container img { border-radius: 8px; background: #fff; padding: 8px; }
.backup-codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  margin-top: 0.5rem;
}
.backup-codes .code {
  font-family: monospace;
  background: var(--bg-input);
  padding: 6px 10px;
  border-radius: 4px;
  text-align: center;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

/* Modal */
.modal { position: fixed; inset: 0; z-index: 999; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal-content {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 1.3rem; cursor: pointer; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.5rem; }

/* Toasts */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
}
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.info { background: var(--primary); }
.toast.warning { background: #d97706; }
.toast.exiting { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(30px); } }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

/* Text color helpers */
.text-green { color: #22c55e !important; }
.text-red { color: #ef4444 !important; }
.text-muted { color: #888; font-size: 0.9rem; }

/* Price links */
.price-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}
.price-link:hover {
  text-decoration: underline;
}
.steam-link:hover { color: #66c0f4; }
.cs-link:hover { color: #4caf50; }

/* Autocomplete */
.autocomplete-results {
  position: absolute;
  z-index: 1000;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 250px;
  overflow-y: auto;
  width: 100%;
  margin-top: 2px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  transition: background 0.15s;
}
.autocomplete-item:hover {
  background: rgba(91,124,250,0.15);
}
.form-group { position: relative; }

/* Compare page */
.compare-settings {
  padding: 16px;
}
.compare-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}
.compare-settings-col h4 {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #aaa;
  font-weight: 600;
}
.form-row {
  display: flex;
  gap: 10px;
}
.form-row .form-group {
  flex: 1;
}
.compare-pagination {
  padding: 12px 0;
  text-align: center;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
@media (max-width: 768px) {
  .compare-settings-grid {
    grid-template-columns: 1fr;
  }
}

/* Signal badges */
.signal-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: default;
}
.signal-strong-buy { background: rgba(76,175,80,0.15); color: #4caf50; }
.signal-good { background: rgba(33,150,243,0.15); color: #2196f3; }
.signal-neutral { background: rgba(158,158,158,0.12); color: #9e9e9e; }
.signal-avoid { background: rgba(244,67,54,0.15); color: #f44336; }
.signal-boosted { background: rgba(255,152,0,0.18); color: #ff9800; }
.signal-inflated { background: rgba(255,87,34,0.18); color: #ff5722; }
.signal-pending { background: rgba(158,158,158,0.18); color: #9e9e9e; }

/* Score bar */
.score-cell {
  position: relative;
  width: 60px;
  height: 20px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.score-bar {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  border-radius: 4px;
  opacity: 0.35;
  transition: width 0.3s;
}
.score-num {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.75rem;
  font-weight: 700;
  color: #eee;
}
