/* ═══════════════════════════════════════════
   Spot'em — main.css
   Core variables, reset, layout, nav, shared
═══════════════════════════════════════════ */

:root {
  --bg0: #08091a;
  --bg1: #0d0f2b;
  --bg2: #131535;
  --bg3: #1a1d45;
  --bg4: #21255a;
  --accent: #7b5ea7;
  --accent2: #9b6fd4;
  --glow: #b48ef0;
  --blue: #2563eb;
  --blue2: #3b82f6;
  --red: #ef4444;
  --green: #22c55e;
  --amber: #f59e0b;
  --pink: #ec4899;
  --text: #e8e6f0;
  --text2: #9490b0;
  --text3: #5a5578;
  --border: rgba(123,94,167,0.15);
  --border2: rgba(123,94,167,0.32);
  --card: rgba(13,15,43,0.9);
  --radius: 8px;
  --radius-lg: 12px;
  --nav-h: 54px;
  --font-main: 'Barlow', sans-serif;
  --font-mono: 'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-main);
  background: var(--bg0);
  color: var(--text);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; font-family: var(--font-main); }
input, textarea, select { font-family: var(--font-main); }
img { display: block; }

/* Scrollbars */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }

/* ── LOADING ── */
#loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg0);
  display: flex; align-items: center; justify-content: center;
}
.loading-inner { text-align: center; }
.loading-logo {
  font-size: 42px; font-weight: 900; letter-spacing: -2px;
  color: var(--text); margin-bottom: 24px;
}
.loading-logo span { color: var(--glow); }
.loading-bar {
  width: 200px; height: 3px; background: var(--bg3);
  border-radius: 2px; overflow: hidden; margin: 0 auto;
}
.loading-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--glow));
  border-radius: 2px; animation: loadfill 1.2s ease-out forwards;
}
@keyframes loadfill { from { width: 0 } to { width: 100% } }

/* ── NAV ── */
nav#main-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h);
  background: rgba(8,9,26,0.95);
  border-bottom: 1px solid var(--border2);
  backdrop-filter: blur(14px);
  display: flex; align-items: center;
  padding: 0 14px; gap: 0;
}
.nav-logo {
  font-family: var(--font-main);
  font-weight: 900; font-size: 20px; letter-spacing: -1px;
  color: var(--text); margin-right: 16px; flex-shrink: 0;
}
.nav-logo span { color: var(--glow); }
.nav-tabs { display: flex; height: var(--nav-h); }
.nav-tab {
  height: var(--nav-h); padding: 0 16px;
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: var(--text2);
  background: transparent; border: none;
  border-bottom: 2px solid transparent;
  transition: all 0.15s; white-space: nowrap;
  letter-spacing: 0.3px; position: relative;
}
.nav-tab:hover { color: var(--text); background: rgba(123,94,167,0.07); }
.nav-tab.active { color: var(--glow); border-bottom-color: var(--glow); }
.nt-icon { font-size: 15px; }
.nav-badge {
  position: absolute; top: 10px; right: 8px;
  min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--red); font-size: 9px; font-weight: 700;
  color: #fff; display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.notif-btn {
  position: relative; width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text2); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.notif-btn:hover { border-color: var(--border2); color: var(--text); }
.notif-badge {
  position: absolute; top: 1px; right: 1px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--red); font-size: 9px; font-weight: 700;
  color: #fff; display: flex; align-items: center; justify-content: center;
}
.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 22px; padding: 4px 12px 4px 4px;
  transition: all 0.15s;
}
.user-chip:hover { border-color: var(--accent2); }
.user-av {
  width: 28px; height: 28px; border-radius: 50%;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-chip-name { font-size: 13px; font-weight: 700; color: var(--text); }

/* ── USER MENU ── */
.user-menu {
  position: fixed; top: 58px; right: 14px; z-index: 600;
  background: var(--bg2); border-radius: var(--radius-lg);
  border: 1px solid var(--border2);
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  padding: 12px; min-width: 200px; display: none;
}
.user-menu.open { display: block; }
.um-profile-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 4px 12px;
}
.um-av-lg {
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.um-dname { font-size: 14px; font-weight: 700; }
.um-uname { font-size: 12px; color: var(--text3); font-family: var(--font-mono); }
.um-sep { height: 1px; background: var(--border); margin: 6px 0; }
.umi {
  padding: 9px 10px; border-radius: 6px; font-size: 13px; font-weight: 600;
  transition: background 0.1s; display: flex; align-items: center; gap: 8px;
}
.umi:hover { background: var(--bg3); cursor: pointer; }
.umi.danger { color: var(--red); }

/* ── APP LAYOUT ── */
.app-body {
  display: flex;
  height: calc(100vh - var(--nav-h));
  margin-top: var(--nav-h);
  overflow: hidden;
}
.left-panel {
  width: 270px; flex-shrink: 0;
  background: var(--bg1);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.main-area { flex: 1; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.view { display: none; flex: 1; overflow: hidden; flex-direction: column; }
.view.active { display: flex; }

/* ── LEFT PANEL SHARED ── */
.lp-header { padding: 14px 12px 10px; border-bottom: 1px solid var(--border); }
.lp-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text3); margin-bottom: 9px;
  font-family: var(--font-mono);
}
.scope-row { display: flex; gap: 5px; flex-wrap: wrap; }
.sc-pill {
  font-family: var(--font-mono); font-size: 10px;
  padding: 4px 10px; border-radius: 20px; cursor: pointer;
  border: 1px solid var(--border2);
  background: transparent; color: var(--text2);
  transition: all 0.15s;
}
.sc-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg0); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 11px; margin-top: 10px;
}
.search-bar input {
  border: none; background: transparent; outline: none;
  font-family: var(--font-main); font-size: 13px; color: var(--text);
  width: 100%;
}
.search-bar input::placeholder { color: var(--text3); }
.si { color: var(--text3); font-size: 14px; }
.scope-label { font-size: 10px; color: var(--text3); font-family: var(--font-mono); margin-right: 4px; flex-shrink: 0; }

/* ── SPOT LIST ── */
.spot-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.sc {
  margin: 0 8px 6px; padding: 12px;
  background: var(--bg2); border-radius: var(--radius);
  border: 1px solid var(--border); cursor: pointer; transition: all 0.15s;
}
.sc:hover { border-color: var(--border2); transform: translateY(-1px); }
.sc.active-sc { border-color: var(--accent2); box-shadow: 0 0 0 1px rgba(123,94,167,0.15); }
.sc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.sc-name { font-size: 13px; font-weight: 700; line-height: 1.2; }
.sc-type {
  font-family: var(--font-mono); font-size: 9px;
  padding: 2px 6px; border-radius: 3px;
  background: var(--bg3); color: var(--accent2); white-space: nowrap; flex-shrink: 0;
}
.sc-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.sc-dist { font-family: var(--font-mono); font-size: 10px; color: var(--text3); }
.sc-votes { font-family: var(--font-mono); font-size: 10px; font-weight: 700; }
.sc-votes.hot { color: var(--glow); }
.sc-votes.warm { color: var(--amber); }
.sc-votes.cold { color: var(--text3); }
.expiry-tag { font-family: var(--font-mono); font-size: 9px; }
.expiry-tag.ok { color: var(--text3); }
.expiry-tag.warn { color: var(--amber); }
.expiry-tag.crit { color: var(--red); }
.yt-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: rgba(239,68,68,0.12); color: var(--red);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 3px; padding: 1px 5px;
  font-family: var(--font-mono); font-size: 9px;
}
.vbar { height: 2px; background: var(--bg0); border-radius: 1px; margin-top: 7px; overflow: hidden; }
.vfill { height: 100%; border-radius: 1px; transition: width 0.4s; }
.av-stack { display: flex; align-items: center; margin-top: 6px; }
.mav {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--bg2); margin-left: -4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 7px; font-weight: 700; color: #fff; flex-shrink: 0;
  overflow: hidden;
}
.mav:first-child { margin-left: 0; }
.mav img { width: 100%; height: 100%; object-fit: cover; }
.stack-ct { font-size: 10px; color: var(--text3); margin-left: 5px; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border2);
  padding: 10px 22px; border-radius: 22px;
  font-size: 13px; font-weight: 600;
  opacity: 0; transition: all 0.3s; z-index: 9999; pointer-events: none;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── SHARED MISC ── */
.ondot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.ondot.on { background: var(--green); }
.ondot.off { background: var(--text3); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .left-panel { display: none; }
  .nt-label { display: none; }
  .nav-tab { padding: 0 12px; }
}
@media (max-width: 600px) {
  .nav-logo { font-size: 17px; margin-right: 8px; }
  .user-chip-name { display: none; }
}
