/* ==========================================================================
   ToxicDev UI — style.css
   Источник палитры: manifest.json (Firefox theme)
   Mapping (manifest -> CSS vars):
     frame/toolbar/ntp_background     -> --bg-0: #1C1C1C
     tab_selected/sidebar/popup       -> --bg-1: #2E2E2E
     toolbar_text/tab_text/ntp_text   -> --fg-0: #E1E1E1
     tab_background_text              -> --fg-dim: #A0A0A0
     toolbar_top_separator/tab_line
     toolbar_field_border/popup_border-> --line: #3B3B3B
     icons_attention/tab_loading
     bookmark_text/field_focus        -> --accent: #FFD700
     highlight_text (контраст к accent)-> --accent-ink: #1C1C1C
   ========================================================================== */

:root{
  --bg-0:#1C1C1C;  /* frame, toolbar, ntp_background */
  --bg-1:#2E2E2E;  /* tab_selected, sidebar, popup */
  --fg-0:#E1E1E1;  /* toolbar_text, tab_text, ntp_text */
  --fg-dim:#A0A0A0;/* tab_background_text */
  --line:#3B3B3B;  /* separators/borders */
  --accent:#FFD700;/* icons_attention, tab_loading, bookmark_text */
  --accent-ink:#1C1C1C;

  /* Доп. семантика */
  --success:#2ea043;
  --warn:#e3b341;
  --danger:#ff4d4f;

  --radius:14px;
  --shadow:0 10px 30px rgba(0,0,0,.35);
}

/* ========== Сброс/база ========== */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg-0);
  color:var(--fg-0);
  font:500 16px/1.5 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", sans-serif;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
img{max-width:100%;height:auto;display:block}
a{color:var(--fg-0);text-decoration:none}
a:hover{color:var(--accent)}
hr{border:0;border-top:1px solid var(--line);margin:24px 0}

/* ========== Контейнеры/утилиты ========== */
.container{max-width:1200px;margin:0 auto;padding:24px}
.container-narrow{max-width:980px;margin:0 auto;padding:24px}
.grid{display:grid;gap:16px}
.grid.cards{grid-template-columns:repeat(auto-fill,minmax(260px,1fr))}
.hidden{display:none!important}
.muted{color:var(--fg-dim)}
.badge{display:inline-block;padding:4px 10px;border:1px solid var(--line);border-radius:999px;font-size:12px;color:var(--fg-dim)}
.badge--gold{border-color:var(--accent);color:var(--accent)}
kbd{
  background:var(--bg-1);border:1px solid var(--line);border-bottom-color:#242424;
  padding:2px 6px;border-radius:6px;font-size:12px
}

/* ========== Шапка/навигация ========== */
.header{
  position:sticky;top:0;z-index:50;
  background:linear-gradient(to bottom, rgba(28,28,28,.95), rgba(28,28,28,.85));
  backdrop-filter:saturate(1.1) blur(4px);
  border-bottom:1px solid var(--line);
}
.navbar{display:flex;align-items:center;gap:18px;padding:14px 20px}
.logo{display:flex;align-items:center;gap:10px;font-weight:800;letter-spacing:.3px}
.logo .dot{width:10px;height:10px;border-radius:50%;background:var(--accent);box-shadow:0 0 20px rgba(255,215,0,.45)}
.nav{display:flex;gap:12px;margin-left:auto}
.nav a{
  padding:8px 12px;border-radius:10px;border:1px solid transparent;color:var(--fg-dim)
}
.nav a:hover{color:var(--accent);border-color:var(--line);background:rgba(255,215,0,.06)}
.nav a.active{color:var(--accent);border-color:var(--accent);background:rgba(255,215,0,.12)}

/* ========== Сайдбар/лейаут ========== */
.layout{display:grid;grid-template-columns:260px 1fr;gap:0;min-height:calc(100vh - 64px)}
.sidebar{
  background:var(--bg-1);
  border-right:1px solid var(--line);
  padding:18px;
}
.sidebar h3{margin:0 0 10px 0;font-size:14px;text-transform:uppercase;letter-spacing:.08em;color:var(--fg-dim)}
.side-links{display:flex;flex-direction:column;gap:8px}
.side-links a{
  padding:10px 12px;border-radius:10px;border:1px solid var(--line);color:var(--fg-0);
  transition:all .15s ease
}
.side-links a:hover{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
.side-links a.active{
  color:var(--accent-ink);
  background:var(--accent);
  border-color:var(--accent);
}

/* Mobile: прячем сайдбар в аккордеон */
@media (max-width: 980px){
  .layout{grid-template-columns:1fr}
  .sidebar{position:sticky;top:56px;z-index:40;border-right:0;border-bottom:1px solid var(--line)}
}

/* ========== Карточки/каталог (товары, посты, привилегии) ========== */
.card{
  background:var(--bg-1);
  border:1px solid var(--line);
  border-radius:var(--radius);
  overflow:hidden;
  box-shadow:var(--shadow);
  transition:transform .12s ease, box-shadow .2s ease, border-color .12s ease;
}
.card:hover{transform:translateY(-2px);border-color:var(--accent);box-shadow:0 16px 40px rgba(0,0,0,.45)}
.card-media{aspect-ratio:16/10;background:#111;border-bottom:1px solid var(--line)}
.card-body{padding:14px}
.card-title{font-weight:700;margin:0 0 6px 0}
.card-desc{color:var(--fg-dim);font-size:14px;margin:0 0 12px 0}
.card-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
.price{font-weight:800;letter-spacing:.2px}
.price .old{color:var(--fg-dim);text-decoration:line-through;margin-right:8px;font-weight:600}
.price .tag{color:var(--accent);font-weight:800}

/* ========== Кнопки ========== */
.btn{
  --_bg:transparent; --_fg:var(--fg-0); --_bd:var(--line);
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:10px 14px;border-radius:12px;border:1px solid var(--_bd);
  background:var(--_bg);color:var(--_fg);cursor:pointer;font-weight:700;
  transition:all .15s ease;text-align:center
}
.btn:hover{border-color:var(--accent);color:var(--accent)}
.btn:active{transform:translateY(1px)}
.btn-primary{--_bg:var(--accent);--_fg:var(--accent-ink);--_bd:var(--accent)}
.btn-primary:hover{filter:brightness(1.06)}
.btn-outline{--_bg:transparent;--_fg:var(--accent);--_bd:var(--accent)}
.btn-ghost{--_bg:rgba(255,215,0,.12);--_fg:var(--accent-ink);--_bd:var(--accent)}

/* ========== Формы (поиск, логины, YooMoney и т.п.) ========== */
input, select, textarea{
  width:100%;background:var(--bg-1);color:var(--fg-0);
  border:1px solid var(--line);border-radius:12px;padding:10px 12px;
  outline:none;transition:border-color .12s ease, box-shadow .12s ease
}
input::placeholder, textarea::placeholder{color:var(--fg-dim)}
input:focus, select:focus, textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(255,215,0,.22)
}
label{display:block;margin:0 0 6px 2px;color:var(--fg-dim);font-size:13px}

/* ========== Таблицы/админка ========== */
.table{width:100%;border-collapse:separate;border-spacing:0;border:1px solid var(--line);border-radius:14px;overflow:hidden}
.table th,.table td{padding:12px;border-bottom:1px solid var(--line)}
.table th{background:#222;text-align:left;color:var(--fg-dim);font-size:13px}
.table tr:hover td{background:rgba(255,215,0,.05)}

/* ========== Алёрты (ошибки/успех) ========== */
.alert{
  padding:12px 14px;border-radius:12px;border:1px solid var(--line);background:var(--bg-1);
}
.alert--error{border-color:rgba(255,77,79,.5);background:rgba(255,77,79,.08);color:#ffb3b5}
.alert--ok{border-color:rgba(46,160,67,.45);background:rgba(46,160,67,.07);color:#b7f0c5}

/* ========== Пагинация/табы ========== */
.tabs{display:flex;gap:6px;border-bottom:1px solid var(--line);margin-bottom:16px}
.tabs a{
  padding:10px 12px;border-radius:10px 10px 0 0;border:1px solid transparent;border-bottom:0;color:var(--fg-dim)
}
.tabs a.active{color:var(--accent-ink);background:var(--accent);border-color:var(--accent)}

/* ========== Футер ========== */
.footer{border-top:1px solid var(--line);padding:18px;color:var(--fg-dim);text-align:center}

/* ========== Скроллбар (WebKit/Chromium) ========== */
*::-webkit-scrollbar{height:12px;width:12px}
*::-webkit-scrollbar-track{background:var(--bg-0)}
*::-webkit-scrollbar-thumb{background:var(--bg-1);border:3px solid var(--bg-0);border-radius:999px}
*::-webkit-scrollbar-thumb:hover{background:#3a3a3a}

/* ========== Анимации мелкие ========== */
@keyframes glowPulse{0%{box-shadow:0 0 0 0 rgba(255,215,0,.28)}100%{box-shadow:0 0 0 12px rgba(255,215,0,0)}}
.glow{animation:glowPulse 1.6s ease-out infinite}

.brand { display:flex; align-items:center; gap:10px; font-weight:800; letter-spacing:.2px; color:var(--fg-0) }
.brand:hover { color:var(--accent) }
.brand-logo { display:block; border-radius:8px; box-shadow:0 2px 8px rgba(255,215,0,.15) }
.brand-title { font-size:18px }

.btn-icon { display:inline-flex; align-items:center; justify-content:center; width:40px; height:40px;
  border-radius:12px; border:1px solid var(--line); color:var(--fg-0); background:var(--bg-1); transition:all .15s ease }
.btn-icon:hover { border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); color:var(--accent) }
.icon-img { width:22px; height:22px; display:block; object-fit:contain }

.avatar { width:20px; height:20px; border-radius:50%; object-fit:cover; margin-right:8px }

.profile { position:relative }
.profile-toggle { display:inline-flex; align-items:center; gap:8px }
.profile-menu {
  position:absolute; right:0; top:calc(100% + 10px); min-width:220px; padding:8px;
  background:var(--bg-1); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow);
  opacity:0; transform:translateY(-6px); pointer-events:none; transition:opacity .12s ease, transform .12s ease; z-index:70;
}
.profile-item { display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:10px; color:var(--fg-0) }
.profile-item:hover { background:rgba(255,215,0,.08) }
.menu-icon { width:18px; height:18px; object-fit:contain }
.profile-exit { color:#ffb3b5 }
.profile-exit:hover { background:rgba(255,77,79,.1) }

/* состояние "открыто" */
.profile[data-open="1"] .profile-menu { opacity:1; transform:translateY(0); pointer-events:auto }
/* ===== Dashboard (ЛК/Библиотека/Покупки) ===== */
.dash{
  display:grid;
  grid-template-columns:260px 1fr;
  min-height:calc(100vh - 64px);
}
.dash-aside{
  background:var(--bg-1);
  border-right:1px solid var(--line);
  padding:18px;
  position:sticky; top:64px; height:calc(100vh - 64px); overflow:auto;
}
.dash-aside .profile-mini{
  display:flex; align-items:center; gap:12px; margin-bottom:14px;
}
.dash-aside .profile-mini img{ width:44px; height:44px; border-radius:50%; object-fit:cover }
.dash-aside .profile-mini .nm{ font-weight:800 }
.dash-aside .muted code{ font-size:12px }

.dash-menu{ display:flex; flex-direction:column; gap:8px; margin-top:12px }
.dash-menu a{
  padding:10px 12px; border-radius:10px; border:1px solid var(--line);
  color:var(--fg-0); transition:all .15s ease
}
.dash-menu a:hover{ border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent) }
.dash-menu a.active{ color:var(--accent-ink); background:var(--accent); border-color:var(--accent) }

.dash-main{ padding:24px }

.stats{ display:grid; gap:12px; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); }
.stat{
  background:var(--bg-1); border:1px solid var(--line); border-radius:var(--radius);
  padding:16px; box-shadow:var(--shadow)
}
.stat .k{ font-size:13px; color:var(--fg-dim) }
.stat .v{ font-size:22px; font-weight:800; margin-top:4px }

.empty{
  padding:22px; border:1px dashed var(--line); border-radius:14px;
  text-align:center; color:var(--fg-dim); background:rgba(255,215,0,.04)
}

/* ===== Admin additions ===== */
.badge-pub{padding:2px 8px;border-radius:999px;background:rgba(46,160,67,.15);border:1px solid rgba(46,160,67,.35);color:#b7f0c5;font-size:12px}
.badge-draft{padding:2px 8px;border-radius:999px;background:rgba(255,77,79,.08);border:1px solid rgba(255,77,79,.35);color:#ffb3b5;font-size:12px}
.ts-card{background:var(--bg-1);border:1px solid var(--line);border-radius:14px;padding:16px;box-shadow:var(--shadow)}
