/* KOL Platform — Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg:        #0d0f14;
  --bg2:       #13161e;
  --bg3:       #1a1e2a;
  --border:    #252a38;
  --border2:   #2e3547;
  --accent:    #3d7eff;
  --accent2:   #5b93ff;
  --accent-dim:#1e3a7a;
  --green:     #22c55e;
  --yellow:    #f59e0b;
  --red:       #ef4444;
  --purple:    #a855f7;
  --text:      #e2e8f0;
  --text2:     #94a3b8;
  --text3:     #64748b;
  --sidebar-w: 220px;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ── Layout ── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-mark {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--accent2);
  letter-spacing: -0.5px;
}
.sidebar-logo .logo-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section {
  padding: 16px 16px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text3);
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: all 0.15s;
  position: relative;
}
.nav-item:hover {
  color: var(--text);
  background: var(--bg3);
}
.nav-item.active {
  color: var(--accent2);
  background: var(--accent-dim);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-icon { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.user-info .user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-info .user-role { font-size: 11px; color: var(--text3); }

.sidebar-actions {
  display: flex;
  gap: 6px;
}
.btn-icon {
  flex: 1;
  padding: 6px 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.btn-icon:hover { background: var(--border); color: var(--text); }

/* ── Main content ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.page-header {
  padding: 28px 32px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.page-title {
  font-family: 'Syne', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}
.page-subtitle { font-size: 13px; color: var(--text3); margin-top: 3px; }

.page-body {
  padding: 24px 32px 32px;
  flex: 1;
}

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--border2); }
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--stat-color, var(--accent));
  opacity: 0.7;
}
.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--text3);
  margin-top: 6px;
}
.stat-icon {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 20px;
  opacity: 0.3;
}
.stat-card.warn { --stat-color: var(--yellow); }
.stat-card.danger { --stat-color: var(--red); }
.stat-card.success { --stat-color: var(--green); }
.stat-card.purple { --stat-color: var(--purple); }

/* ── Charts row ── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .charts-row { grid-template-columns: 1fr; } }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text3);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-blue   { background: rgba(61,126,255,0.15); color: var(--accent2); }
.badge-green  { background: rgba(34,197,94,0.15);  color: var(--green); }
.badge-yellow { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge-red    { background: rgba(239,68,68,0.15);  color: var(--red); }
.badge-purple { background: rgba(168,85,247,0.15); color: var(--purple); }
.badge-gray   { background: rgba(100,116,139,0.15);color: var(--text3); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border2); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Form elements ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  transition: border-color 0.15s;
  outline: none;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text3); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── Toggle ── */
.toggle {
  display: flex; align-items: center; gap: 8px;
}
.toggle input[type=checkbox] {
  width: 36px; height: 20px;
  appearance: none;
  background: var(--border);
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle input[type=checkbox]:checked { background: var(--accent); }
.toggle input[type=checkbox]::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: left 0.2s;
}
.toggle input[type=checkbox]:checked::after { left: 19px; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform 0.2s;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text3); font-size: 18px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--accent); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  position: relative;
}
.login-page::before {
  content: '';
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 30% 40%, rgba(61,126,255,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 70%, rgba(168,85,247,0.06) 0%, transparent 50%);
  pointer-events: none;
}
.login-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 40px 40px 36px;
  width: 380px;
  max-width: 95vw;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}
.login-logo {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent2);
  margin-bottom: 4px;
}
.login-tagline {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 28px;
}
.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--red);
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── Misc ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text3);
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state .msg  { font-size: 14px; }

.loading-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Rank medal ── */
.rank-1 { color: #f59e0b; }
.rank-2 { color: #94a3b8; }
.rank-3 { color: #cd7c3a; }
