/* ============================================================
   YT Niche Manager — Design tokens
   Ý tưởng: phòng điều khiển tín hiệu — dò "sóng viral" giữa nhiễu.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #10131a;
  --surface: #1a1e28;
  --surface-2: #232838;
  --surface-hover: #2a3040;
  --border: #2a2f3d;
  --accent: #f2a93b;
  --accent-dim: #a97a34;
  --accent-2: #5eead4;
  --text: #e7e9ee;
  --text-muted: #8890a3;
  --danger: #f26d6d;
  --success: #4ade80;
  --radius: 10px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent); color: #10131a; }

/* ---------- Layout: sidebar + main ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 24px 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.2px;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13.5px;
  margin-bottom: 2px;
  cursor: pointer;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--surface-2); color: var(--accent); }
.nav-item .icon { width: 18px; text-align: center; opacity: 0.9; }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.sidebar-footer b { color: var(--text); }
.sidebar-footer a { color: var(--text-muted); }

.main {
  flex: 1;
  padding: 28px 36px;
  max-width: 1100px;
}

.page-header {
  margin-bottom: 20px;
}
.page-header h2 { font-size: 20px; }
.page-header p { color: var(--text-muted); margin: 4px 0 0 0; font-size: 13px; }

/* ---------- Auth pages ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(242,169,59,0.08), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(94,234,212,0.06), transparent 40%),
    var(--bg);
}
.auth-box {
  width: 360px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.auth-box .brand { padding: 0 0 20px 0; justify-content: center; }
.auth-box h2 { text-align: center; margin-bottom: 4px; }
.auth-box .subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.auth-box p { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 14px; }

/* ---------- Form elements ---------- */
input, select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-muted); }

.field-block { display: block; width: 100%; margin-bottom: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #1a1206;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  font-family: var(--font-body);
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.98); }
.btn.block { width: 100%; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.success { background: var(--success); color: #06280f; }
.btn.danger { background: var(--danger); color: #2a0808; }

.msg { color: var(--danger); font-size: 13px; min-height: 18px; }
.msg.ok { color: var(--success); }

/* ---------- Search bar ---------- */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  background: var(--surface);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.search-bar input[type="text"] { flex: 1; min-width: 220px; }

/* ---------- Video / channel cards ---------- */
.video-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: border-color 0.15s;
}
.video-card input.video-select {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.video-card:hover { border-color: var(--accent-dim); }
.video-card img {
  width: 168px; height: 94px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-2);
  flex-shrink: 0;
}
.video-info { flex: 1; min-width: 0; }
.video-info h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.video-meta { color: var(--text-muted); font-size: 12.5px; }
.video-actions { margin-top: 10px; display: flex; gap: 14px; align-items: center; font-size: 13px; }

.tag {
  display: inline-block;
  background: rgba(94,234,212,0.12);
  color: var(--accent-2);
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  margin-right: 6px;
}
.downloaded-badge {
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  display: flex; align-items: center; gap: 6px;
}

/* ---------- Thanh tiến độ tải (kiểu Chrome) ---------- */
.progress-wrap {
  margin-top: 8px;
  display: none;
}
.progress-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s ease;
}
.progress-text {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 3px;
}

/* ---------- Signature element: Signal meter ---------- */
/* Thanh đo tín hiệu viral - lấy cảm hứng từ vạch sóng radio/wifi.
   Số vạch sáng (amber) tỉ lệ với độ "nóng" của video. */
.signal-meter {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  margin-right: 6px;
  vertical-align: middle;
}
.signal-meter .bar {
  width: 3px;
  background: var(--border);
  border-radius: 1px;
}
.signal-meter .bar:nth-child(1) { height: 30%; }
.signal-meter .bar:nth-child(2) { height: 55%; }
.signal-meter .bar:nth-child(3) { height: 75%; }
.signal-meter .bar:nth-child(4) { height: 100%; }
.signal-meter .bar.lit { background: var(--accent); box-shadow: 0 0 4px var(--accent); }

.metric-row { display: flex; align-items: center; gap: 14px; margin-top: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.metric-row b { color: var(--text); font-weight: 500; }

/* ---------- Empty states ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 32px; margin-bottom: 10px; opacity: 0.6; }

/* ---------- Misc ---------- */
.topbar-actions { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
