/* ── Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: radial-gradient(ellipse at top left, #1a1a2e 0%, #0a0a0f 60%);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── BG Glows ─────────────────────────────────────────────── */
.glow {
  position: fixed;
  width: 320px; height: 320px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}
.glow-red   { background: #ff3c6f; }
.glow-blue  { background: #4dabf7; }
.glow-purple{ background: #9b59b6; width:200px; height:200px; opacity:0.12; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: 64px;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo-icon {
  background: linear-gradient(135deg,#ff3c6f,#ff6a3c);
  color: #fff; font-size: 11px; font-weight: 800;
  padding: 4px 8px; border-radius: 6px;
  box-shadow: 0 0 14px rgba(255,60,111,0.5);
}
.logo-text { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; }

.search-box {
  flex: 1; max-width: 480px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; padding: 8px 14px;
  transition: border-color 0.2s;
}
.search-box:focus-within { border-color: rgba(255,60,111,0.5); }
.search-icon { color: #555; font-size: 13px; }
.search-box input {
  background: transparent; border: none; outline: none;
  color: #ccc; font-size: 13px; width: 100%;
  font-family: 'Inter', sans-serif;
}
.search-box input::placeholder { color: #444; }

.btn-analyze {
  background: linear-gradient(135deg, #ff3c6f, #ff6a3c);
  color: #fff; font-weight: 700; font-size: 13px;
  padding: 9px 22px; border: none; border-radius: 12px;
  cursor: pointer; flex-shrink: 0;
  box-shadow: 0 0 20px rgba(255,60,111,0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-analyze:hover {
  transform: scale(1.05);
  box-shadow: 0 0 32px rgba(255,60,111,0.65);
}

.dev-credit { display: none; }
.dev-name { color: #ff4d6d; font-weight: 700; }

/* Corner ANALYZE button */
.corner-analyze {
  position: fixed; top: 14px; right: 24px; z-index: 200;
}

.traffic-est-note { font-size: 10px; color: #444; margin-bottom: 10px; font-style: italic; }
  position: fixed; bottom: 12px; right: 16px;
  font-size: 14px; color: #666; z-index: 999;
}
.made-by-line span { color: #ff4d6d; font-weight: 700; }

/* ── Status Bar ───────────────────────────────────────────── */
.status-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 24px; font-size: 11px; color: #666;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.status-bar.hidden { display: none; }
.spinner {
  width: 12px; height: 12px;
  border: 2px solid #ff3c6f; border-top-color: transparent;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Main Grid ────────────────────────────────────────────── */
.main-grid {
  display: grid;
  grid-template-columns: 300px 1fr 250px;
  gap: 16px;
  padding: 16px;
  height: calc(100vh - 64px);
  overflow: hidden;
  position: relative; z-index: 1;
}

.col-left, .col-mid, .col-right {
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
}
.col-left::-webkit-scrollbar,
.col-mid::-webkit-scrollbar,
.col-right::-webkit-scrollbar { display: none; }

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 0 24px rgba(0,0,0,0.4), 0 0 0 0 rgba(255,60,111,0);
  transition: box-shadow 0.3s, transform 0.3s;
}
.card:hover {
  box-shadow: 0 0 36px rgba(0,150,255,0.12), 0 8px 32px rgba(0,0,0,0.5);
  transform: translateY(-2px);
}

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-title { font-size: 14px; font-weight: 700; letter-spacing: -0.2px; }
.card-menu { color: #555; font-size: 18px; cursor: pointer; }

/* ── Channel Profile ──────────────────────────────────────── */
.channel-profile { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(255,60,111,0.4);
  box-shadow: 0 0 16px rgba(255,60,111,0.3);
}
.channel-name { font-size: 15px; font-weight: 700; line-height: 1.3; }

.divider { height: 1px; background: rgba(255,255,255,0.06); margin: 10px 0; }

.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.stat-label { font-size: 10px; color: #666; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 800; }

.sparkline-canvas { width: 100% !important; height: 40px !important; display: block; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tab-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  color: #888; font-size: 11px; font-weight: 600;
  padding: 5px 12px; border-radius: 8px; cursor: pointer;
  transition: all 0.2s; font-family: 'Inter', sans-serif;
}
.tab-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.active-tab {
  background: linear-gradient(135deg,#ff3c6f,#ff6a3c) !important;
  color: #fff !important; border-color: transparent !important;
  box-shadow: 0 0 12px rgba(255,60,111,0.4);
}

/* ── Video List ───────────────────────────────────────────── */
.video-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 360px; }
.video-list::-webkit-scrollbar { display: none; }
.empty-msg { color: #444; font-size: 12px; text-align: center; padding: 32px 0; }

.video-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  cursor: pointer; transition: all 0.25s;
  text-decoration: none; color: inherit;
}
.video-row:hover {
  background: rgba(255,255,255,0.07);
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.video-thumb {
  position: relative; flex-shrink: 0;
  width: 80px; height: 48px; border-radius: 8px;
  overflow: hidden; background: #111;
}
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play-icon {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  font-size: 16px; color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.25);
  opacity: 0; transition: opacity 0.2s;
}
.video-row:hover .play-icon { opacity: 1; }
.live-badge-overlay {
  position: absolute; top: 4px; left: 4px;
  background: #ff3c6f; color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 2px 5px; border-radius: 4px;
  animation: pulse-red 1.5s infinite;
}
.was-live-badge {
  position: absolute; top: 4px; left: 4px;
  background: rgba(0,0,0,0.7); color: #aaa;
  font-size: 9px; font-weight: 600;
  padding: 2px 5px; border-radius: 4px;
}
@keyframes pulse-red {
  0%,100% { opacity: 1; } 50% { opacity: 0.6; }
}
.video-info { flex: 1; min-width: 0; }
.video-title { font-size: 11px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-date { font-size: 10px; color: #555; margin-top: 2px; }
.video-views { font-size: 11px; color: #4dabf7; font-weight: 600; }
.video-stats { text-align: right; flex-shrink: 0; }
.video-likes { font-size: 11px; font-weight: 700; color: #ff4d6d; }
.video-cmts  { font-size: 10px; color: #555; }

/* ── Range Buttons ────────────────────────────────────────── */
.range-row { display: flex; gap: 8px; margin-bottom: 14px; }
.range-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  color: #888; font-size: 11px; font-weight: 600;
  padding: 5px 14px; border-radius: 8px; cursor: pointer;
  transition: all 0.2s; font-family: 'Inter', sans-serif;
}
.range-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.active-range {
  background: linear-gradient(135deg,#ff3c6f,#ff6a3c) !important;
  color: #fff !important; border-color: transparent !important;
  box-shadow: 0 0 12px rgba(255,60,111,0.35);
}

/* ── Legend ───────────────────────────────────────────────── */
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #aaa; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ── Metrics ──────────────────────────────────────────────── */
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metric-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px; padding: 14px;
  transition: all 0.25s;
}
.metric-card:hover { background: rgba(255,255,255,0.08); transform: translateY(-2px); }
.metric-header { display: flex; justify-content: space-between; align-items: center; }
.metric-title { font-size: 13px; font-weight: 700; }
.metric-sub { font-size: 10px; color: #555; margin: 2px 0 6px; }
.metric-val { font-size: 15px; font-weight: 800; }

/* ── Traffic ──────────────────────────────────────────────── */
.traffic-unavailable { display: flex; align-items: flex-start; gap: 12px; }
.traffic-icon { font-size: 22px; flex-shrink: 0; margin-top: 2px; }
.traffic-na-title { font-size: 13px; font-weight: 600; color: #aaa; margin-bottom: 4px; }
.traffic-na-sub { font-size: 11px; color: #555; line-height: 1.5; }
.traffic-row { display: flex; align-items: center; gap: 24px; }
.traffic-legend { display: flex; flex-direction: column; gap: 8px; }
.tl-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.tl-pct { color: #aaa; font-size: 12px; font-weight: 700; margin-left: 4px; }

/* ── Key Stats ────────────────────────────────────────────── */
.keystats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.keystat-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px; padding: 14px;
  transition: all 0.25s;
}
.keystat-card:hover {
  background: rgba(255,255,255,0.08);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.ks-title { font-size: 13px; font-weight: 700; }
.ks-sub   { font-size: 10px; color: #555; margin: 2px 0; }
.ks-val   { font-size: 20px; font-weight: 800; margin-top: 8px; }

.ks-inline-row { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; }
.ks-inline-label { color: #ccc; font-weight: 600; }
.fw { font-weight: 800; }

/* ── Colors ───────────────────────────────────────────────── */
.red    { color: #ff4d6d; }
.blue   { color: #4dabf7; }
.green  { color: #51cf66; }
.orange { color: #ff9f43; }

/* ── API Input ────────────────────────────────────────────── */
.api-input {
  width: 100%; background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; padding: 8px 12px;
  color: #ccc; font-size: 12px; outline: none;
  font-family: 'Inter', sans-serif; transition: border-color 0.2s;
}
.api-input:focus { border-color: rgba(255,60,111,0.5); }
.btn-save {
  margin-top: 8px; width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: #ccc; font-size: 12px; font-weight: 600;
  padding: 7px; border-radius: 10px; cursor: pointer;
  font-family: 'Inter', sans-serif; transition: all 0.2s;
}
.btn-save:hover { background: rgba(255,255,255,0.12); color: #fff; }
.api-hint { font-size: 10px; color: #444; margin-top: 8px; }
.api-hint a { color: #ff4d6d; text-decoration: none; }
.api-hint a:hover { text-decoration: underline; }

/* ── Gradient border glow on focused card ─────────────────── */
@keyframes glow-pulse {
  0%,100% { box-shadow: 0 0 20px rgba(255,60,111,0.15); }
  50%      { box-shadow: 0 0 40px rgba(77,171,247,0.2); }
}
.card.active-card { animation: glow-pulse 3s ease-in-out infinite; }
