/* ============================================================================
   theme-under.css — GIAO DIỆN "UNDERGROUND" (tối, terminal, neon)

   NGUYÊN TẮC:
     - TẤT CẢ luật đều nằm dưới `body.under` -> giao diện cũ không bị ảnh hưởng,
       bật/tắt bằng công tắc (cookie), không cần build lại.
     - NEON CHỈ dùng cho viền/badge/nhãn/số liệu. Chữ nội dung giữ độ tương phản cao
       (>= 7:1) vì đây là trang đọc 10-20 phút, không phải poster.
     - Hiệu ứng (scanline) mặc định TẮT khi người dùng bật "giảm chuyển động".
   ============================================================================ */

body.under {
  --bg: #07090c;
  --panel: #0c1016;
  --panel-2: #0a0e13;
  --line: #1b2430;
  --fg: #ccd6e2;          /* chữ nội dung: tương phản ~12:1 trên --bg */
  --fg-dim: #8b97a6;      /* chữ phụ: ~7:1 */
  --cyan: #22d3ee;
  --green: #34d399;
  --mag: #a855f7;
  --red: #ff3860;
  --orange: #ff9f1c;
  --yellow: #f5d90a;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  background: var(--bg);
  color: var(--fg);
  font-variant-ligatures: none;
}

/* nền lưới mờ + đường quét rất nhẹ (tắt được) */
body.under::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(34, 211, 238, .035) 0 1px, transparent 1px 3px);
  opacity: .5;
}
@media (prefers-reduced-motion: reduce) {
  body.under::before { display: none; }
}

body.under > * { position: relative; z-index: 1; }

/* ---- khung trang ---- */
body.under .wrap, body.under main { max-width: 1180px; }

/* ---- header: kiểu bảng điều khiển ---- */
body.under header {
  background: linear-gradient(180deg, #0b1016, #080b10);
  border-bottom: 1px solid var(--line);
}
body.under header .brand, body.under header a.brand {
  font-family: var(--mono);
  letter-spacing: .04em;
}
body.under header .brand b { color: var(--cyan); text-shadow: 0 0 14px rgba(34, 211, 238, .45); }
body.under header nav a {
  font-family: var(--mono); font-size: 12.5px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--fg-dim);
}
body.under header nav a:hover { color: var(--cyan); }

/* ---- thanh tab: chip có viền, tab đang chọn phát sáng ---- */
body.under .tabs .tab {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .02em;
}
body.under .tabs .tab:hover { border-color: #2b3a4c; color: var(--fg); }
body.under .tabs .tab.on {
  background: linear-gradient(180deg, rgba(34, 211, 238, .16), rgba(34, 211, 238, .04));
  border-color: var(--cyan);
  color: #d9fbff;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, .35), 0 0 18px rgba(34, 211, 238, .18);
}
body.under .tabs .tab small {
  font-family: var(--mono); color: var(--cyan); opacity: .9;
}

/* ---- thẻ tin: khung tối, vạch màu bên trái, hover sáng viền ---- */
body.under .item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}
body.under .item:hover {
  border-color: #2f4a5e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 0 22px rgba(34, 211, 238, .07);
}
body.under .item .title, body.under .item a.title {
  color: #e8f1fb;
  font-family: var(--mono);
  letter-spacing: -.01em;
}
body.under .item a.title:hover { color: var(--cyan); }
body.under .item .meta, body.under .item .kv { color: var(--fg-dim); }
body.under .item .badge {
  font-family: var(--mono); font-size: 11.5px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px;
}

/* ---- điểm số: số lớn kiểu bảng điều khiển ---- */
body.under .score {
  font-family: var(--mono);
  background: #0a0f15;
  border: 1px solid #24303f;
  color: var(--cyan);
  border-radius: 6px;
  text-shadow: 0 0 12px rgba(34, 211, 238, .4);
}
body.under .score.hot { color: var(--red); border-color: rgba(255, 56, 96, .5);
  text-shadow: 0 0 12px rgba(255, 56, 96, .45); }

/* ---- lỗ hổng: khối kết luận như "bảng điều khiển sự cố" ---- */
body.under .vuln {
  background: linear-gradient(180deg, #0b1118, #090d12);
  border: 1px solid #22303f;
  border-left: 3px solid var(--orange);
  border-radius: 6px;
  font-size: 13.5px;
}
body.under .vuln[style*="--bad"], body.under .vuln.urgent {
  border-left-color: var(--red);
  box-shadow: 0 0 0 1px rgba(255, 56, 96, .18), 0 0 20px rgba(255, 56, 96, .08);
}
body.under .vuln summary { font-family: var(--mono); font-size: 12.5px; letter-spacing: .02em; }
body.under .vuln summary::-webkit-details-marker { color: var(--cyan); }
body.under .vuln ol, body.under .vuln ul { color: var(--fg); }
body.under .vuln li::marker { color: var(--cyan); }
body.under .vuln li::marker { font-family: var(--mono); }

/* ---- chip lăng kính / đối tượng / nguồn ---- */
body.under .chip, body.under .chips .chip {
  font-family: var(--mono); font-size: 11.5px;
  background: #0a0f14; border: 1px solid #24313f; color: var(--fg-dim);
  border-radius: 4px;
}
body.under .chip:hover { border-color: var(--cyan); color: var(--cyan); }

/* ---- tag #hash ---- */
body.under .tag {
  font-family: var(--mono); font-size: 11.5px;
  color: #8ea3b8; border-color: #1e2836; background: transparent;
}
body.under .tag:hover { color: var(--cyan); border-color: var(--cyan); }

/* ---- thanh lọc / ô tìm: giả lập dấu nhắc terminal ---- */
body.under input[type="search"], body.under input[name="q"], body.under select {
  background: #080c11;
  border: 1px solid #22303f;
  color: var(--fg);
  font-family: var(--mono);
}
body.under input[name="q"] { padding-left: 74px; }
body.under form .qwrap { position: relative; }
body.under form .qwrap::before {
  content: "~/intel $";
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 12px; color: var(--green);
  opacity: .85; pointer-events: none; z-index: 2;
}
body.under input:focus, body.under select:focus {
  outline: none; border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .12);
}

/* ---- bảng Radar / báo cáo: số kiểu mono, dòng kẻ mảnh ---- */
body.under table { border-collapse: collapse; }
body.under table th {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; color: #7f8d9d; border-bottom: 1px solid var(--line);
}
body.under table td { border-bottom: 1px solid #121a24; }
body.under table tr:hover td { background: #0a1016; }
body.under table td.num, body.under .num { font-family: var(--mono); color: var(--cyan); }

/* ---- thống kê / hint ---- */
body.under .stats .stat {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
}
body.under .stats .stat b { font-family: var(--mono); color: var(--cyan); }
body.under .stats .stat i { color: var(--fg-dim); font-style: normal; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .06em; }
body.under .hint { color: var(--fg-dim); border-left: 2px solid #22303f; padding-left: 10px; }

/* ---- nút ---- */
body.under .btn, body.under button {
  background: #0c141b; border: 1px solid #26343f; color: var(--fg);
  font-family: var(--mono); font-size: 12.5px; border-radius: 5px;
}
body.under .btn:hover, body.under button:hover {
  border-color: var(--cyan); color: var(--cyan);
  box-shadow: 0 0 14px rgba(34, 211, 238, .15);
}
body.under .btn.primary, body.under button.primary {
  background: linear-gradient(180deg, rgba(52, 211, 153, .2), rgba(52, 211, 153, .06));
  border-color: var(--green); color: #d6ffee;
}

/* ---- chân trang + công tắc giao diện ---- */
body.under footer { color: #64748b; border-top: 1px solid var(--line); }
body.under .theme-switch {
  font-family: var(--mono); font-size: 12px; color: var(--fg-dim);
  border: 1px solid var(--line); border-radius: 5px; padding: 4px 9px;
  background: var(--panel-2); text-decoration: none;
}
body.under .theme-switch:hover { color: var(--cyan); border-color: var(--cyan); }


/* ============================================================================
   LỚP "HACKER CHUYÊN NGHIỆP": thêm chi tiết kỹ thuật, vẫn giữ khả năng đọc.
   Tất cả hiệu ứng đều tắt khi prefers-reduced-motion.
   ============================================================================ */

/* --- thương hiệu kiểu terminal: dấu nháy nhấp nháy --- */
body.under .brand::after {
  content: "_";
  color: var(--green);
  margin-left: 2px;
  animation: under-blink 1.1s steps(2, start) infinite;
}
@keyframes under-blink { 50% { opacity: 0; } }

/* --- vạch quét mảnh chạy ngang đỉnh trang (rất nhẹ, không gây chói) --- */
body.under header::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: .45;
  animation: under-sweep 7s linear infinite;
}
@keyframes under-sweep {
  0% { transform: translateX(-40%); }
  100% { transform: translateX(40%); }
}

/* --- thẻ tin: góc ngoặc kỹ thuật (như khung HUD) --- */
body.under .item { position: relative; }
body.under .item::before,
body.under .item::after {
  content: ""; position: absolute; width: 10px; height: 10px;
  border: 1px solid var(--cyan); opacity: .35; pointer-events: none;
}
body.under .item::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
body.under .item::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
body.under .item:hover::before, body.under .item:hover::after { opacity: .9; }

/* --- tiêu đề mục: dấu // như chú thích code --- */
body.under h2::before { content: "// "; color: var(--cyan); opacity: .7; }
body.under h2 {
  font-family: var(--mono); font-size: 17px; letter-spacing: .02em;
  text-transform: none;
}

/* --- badge dạng [nhãn] --- */
body.under .item .badge::before { content: "["; opacity: .55; margin-right: 3px; }
body.under .item .badge::after { content: "]"; opacity: .55; margin-left: 3px; }

/* --- đầu bảng: mũi tên >> --- */
body.under table th::before { content: ">> "; color: #2f4a5e; }

/* --- điểm số: thêm thanh khối ▮ theo mức --- */
body.under .score { position: relative; overflow: hidden; }
body.under .score::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--cyan); opacity: .8;
}
body.under .score.hot::after { background: var(--red); }

/* --- dòng phụ kiểu log hệ thống --- */
body.under .sysline {
  font-family: var(--mono); font-size: 11.5px; color: #6b7a8c;
  letter-spacing: .04em; text-transform: uppercase;
}
body.under .sysline b { color: var(--green); font-weight: 600; }

/* --- chân trang: như banner phiên làm việc --- */
body.under footer {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .05em;
  text-transform: uppercase;
}
body.under footer::before {
  content: "SYS// ";
  color: var(--cyan); opacity: .7;
}

/* --- liên kết trong bài: gạch chân chấm --- */
body.under .item a:not(.title):not(.tag):not(.chip) {
  text-decoration: underline dotted; text-underline-offset: 2px;
}

/* --- khối lỗ hổng: nhãn góc "ALERT" --- */
body.under .vuln { position: relative; }
body.under .vuln > div:first-child::before {
  content: "! "; color: var(--red); font-family: var(--mono);
}

@media (prefers-reduced-motion: reduce) {
  body.under .brand::after { animation: none; }
  body.under header::after { animation: none; opacity: .2; }
}
