/* ══════════════════════════════════════════════
   RadioWave Admin — Design System
══════════════════════════════════════════════ */
:root {
  --bg:       #07090f;
  --bg2:      #0d111c;
  --bg3:      #121828;
  --surface:  #19202e;
  --surface2: #1f2840;
  --border:   rgba(255,255,255,0.07);
  --border2:  rgba(255,255,255,0.12);
  --accent:   #e63946;
  --accent2:  #ff5a65;
  --green:    #2ec4b6;
  --yellow:   #f4c430;
  --red:      #e63946;
  --blue:     #4da6ff;
  --text:     #e8eeff;
  --text2:    #8994b5;
  --text3:    #4d5a7a;
  --sidebar-w: 220px;
  --r:        10px;
  --r-lg:     16px;
  --font-d:   'Syne', sans-serif;
  --font-b:   'Instrument Sans', sans-serif;
  --font-m:   'Space Mono', monospace;
  --shadow:   0 4px 24px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }

body {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── LOGIN ─────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 50% 40% at 20% 20%, rgba(230,57,70,.08) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 80% 80%, rgba(77,166,255,.05) 0%, transparent 60%);
}
.login-wrap { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-logo { margin-bottom: 20px; display: flex; justify-content: center; }
.login-title { font-family: var(--font-d); font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.login-sub { color: var(--text2); font-size: 14px; margin: 6px 0 28px; }
.login-form { text-align: left; display: flex; flex-direction: column; gap: 16px; }
.login-hint { margin-top: 16px; font-size: 12px; color: var(--text3); }

/* ── LAYOUT ─────────────────────────────── */
.admin-body { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  padding: 0;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sidebar-logo-text {
  font-family: var(--font-d);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 4px 10px; overflow-y: auto; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: var(--r);
  transition: all 0.18s;
}
.sidebar-link:hover { background: var(--surface); color: var(--text); }
.sidebar-link.active { background: rgba(230,57,70,.15); color: var(--accent); }
.nav-icon { font-size: 16px; flex-shrink: 0; }

.sidebar-section {
  font-family: var(--font-m);
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--text3);
  padding: 12px 12px 4px;
  text-transform: uppercase;
}
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 6px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.user-info .name { font-size: 13px; font-weight: 600; }
.user-info .role { font-size: 11px; color: var(--text3); }

.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 56px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-family: var(--font-d);
  font-size: 17px;
  font-weight: 700;
  flex: 1;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.page-content { padding: 28px; flex: 1; max-width: 1400px; }

/* ── CARDS & STATS ─────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-label { font-size: 12px; color: var(--text2); margin-bottom: 2px; }
.stat-value { font-family: var(--font-d); font-size: 26px; font-weight: 800; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-family: var(--font-d);
  font-size: 16px;
  font-weight: 700;
}
.card-body { padding: 22px; }
.card-body-flush { padding: 0; }

/* ── TABLE ─────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text3);
  text-transform: uppercase;
  background: var(--bg3);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.02); }

.td-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-img {
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.logo-abbr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--c) 18%, var(--bg3));
  color: var(--c);
  font-family: var(--font-d);
  font-weight: 800;
  flex-shrink: 0;
}
.td-name { font-weight: 600; }
.td-sub  { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* ── BADGES ─────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 100px;
  white-space: nowrap;
}
.badge-green  { background: rgba(46,196,182,.15); color: var(--green); border: 1px solid rgba(46,196,182,.3); }
.badge-red    { background: rgba(230,57,70,.15);  color: var(--red);   border: 1px solid rgba(230,57,70,.3); }
.badge-yellow { background: rgba(244,196,48,.15); color: var(--yellow);border: 1px solid rgba(244,196,48,.3); }
.badge-blue   { background: rgba(77,166,255,.12); color: var(--blue);  border: 1px solid rgba(77,166,255,.25);}
.badge-gray   { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }

/* ── FORMS ─────────────────────────────── */
.form-grid { display: grid; gap: 18px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0.3px;
}
.form-input, .form-select, .form-textarea {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 14px;
  padding: 9px 13px;
  border-radius: var(--r);
  outline: none;
  transition: border-color .2s;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(230,57,70,.12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-input[type=color] {
  padding: 4px 6px; height: 40px; cursor: pointer; width: 60px;
}
.form-hint { font-size: 12px; color: var(--text3); margin-top: 2px; }
.input-row { display: flex; gap: 8px; align-items: flex-end; }
.input-row .form-input { flex: 1; }

.logo-preview-wrap { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
#logoPreview {
  width: 60px; height: 60px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg3);
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--text3);
  overflow: hidden;
}
#logoPreview img { width: 100%; height: 100%; object-fit: cover; }

/* ── BUTTONS ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-b);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--r);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: all .18s;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); transform: translateY(-1px); }
.btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-secondary:hover { background: var(--bg3); border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text2); border-color: var(--border2); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-danger { background: rgba(230,57,70,.1); color: var(--red); border-color: rgba(230,57,70,.3); }
.btn-danger:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-xs { padding: 3px 9px; font-size: 12px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }
.w-full { width: 100%; justify-content: center; }

/* ── ALERTS ─────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--r);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: rgba(46,196,182,.12); color: var(--green); border: 1px solid rgba(46,196,182,.3); }
.alert-error   { background: rgba(230,57,70,.12);  color: var(--red);   border: 1px solid rgba(230,57,70,.3); }
.alert-warning { background: rgba(244,196,48,.12); color: var(--yellow);border: 1px solid rgba(244,196,48,.3); }
.alert-info    { background: rgba(77,166,255,.10); color: var(--blue);  border: 1px solid rgba(77,166,255,.25);}

/* ── TOGGLE SWITCH ─────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle {
  position: relative;
  width: 38px; height: 22px;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface2);
  border-radius: 100px;
  transition: background .2s;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text2);
  transition: transform .2s, background .2s;
}
.toggle input:checked + .toggle-slider { background: rgba(46,196,182,.3); }
.toggle input:checked + .toggle-slider::after { transform: translateX(16px); background: var(--green); }

/* ── PAGINATION ─────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; margin-top: 20px; }
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px; height: 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text2);
  font-size: 13px;
  text-decoration: none;
  transition: all .15s;
  padding: 0 8px;
}
.page-link:hover, .page-link.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── SEARCH BAR ─────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  max-width: 340px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
}
.search-input-wrap .form-input { padding-left: 36px; }

/* ── COLOR DOT ─────────────────────────────── */
.color-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── PLAYER TYPE TAG ─────────────────────────────── */
.player-tag {
  font-size: 10px;
  font-family: var(--font-m);
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg3);
  color: var(--text3);
  border: 1px solid var(--border);
}

/* ── CHART AREA ─────────────────────────────── */
.chart-wrap { height: 200px; position: relative; }

/* ── MODAL ─────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.95);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.modal-title { font-family: var(--font-d); font-size: 18px; font-weight: 700; }

/* ── MISC ─────────────────────────────── */
.text-muted { color: var(--text3); font-size: 13px; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--text3); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── TOAST ─────────────────────────────── */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 100px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 999;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── RESPONSIVE ─────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}
