/* ================================================================
   DHT Search — Public Stylesheet
   Dark terminal aesthetic. Bootstrap 5 base + custom overrides.
   ================================================================ */

:root {
  --bg:         #0d0f14;
  --bg-surface: #141720;
  --bg-card:    #1a1e2a;
  --bg-hover:   #1f2333;
  --border:     rgba(255,255,255,.07);
  --accent:     #4f9ef0;
  --accent-h:   #6db3ff;
  --accent-glow:rgba(79,158,240,.14);
  --text:       #e8eaf0;
  --text-muted: #8892a4;
  --text-dim:   #555e72;
  --radius:     8px;
  --radius-lg:  12px;
}

/* ── Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body.public-body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }
code { font-family: 'Space Mono','Courier New',monospace; font-size:.87em; color: var(--accent-h); }

/* ── Navbar ──────────────────────────────────────────────────── */
#mainNav {
  background: rgba(13,15,20,.96) !important;
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: .65rem 0;
  transition: box-shadow .2s;
}
.navbar-brand { font-family: 'Space Mono',monospace; font-weight:700; font-size:1.1rem; color:var(--text)!important; letter-spacing:-.5px; }
.brand-hex { color:var(--accent); margin-right:.35rem; }
.nav-cat { color:var(--text-muted)!important; font-size:.85rem; font-weight:500; padding:.35rem .8rem!important; border-radius:var(--radius); transition:all .15s; }
.nav-cat:hover { color:var(--text)!important; background:var(--bg-surface); }

.nav-search .form-control { background:var(--bg-card); border-color:var(--border); color:var(--text); font-size:.83rem; }
.nav-search .form-control:focus { background:var(--bg-card); border-color:var(--accent); color:var(--text); box-shadow:0 0 0 2px var(--accent-glow); }
.nav-search .btn-outline-secondary { border-color:var(--border); color:var(--text-dim); }
.nav-search .btn-outline-secondary:hover { background:var(--bg-hover); color:var(--text); }

/* ── Hero ────────────────────────────────────────────────────── */
.hero-section {
  background: linear-gradient(180deg,rgba(79,158,240,.05) 0%,transparent 100%);
  border-bottom: 1px solid var(--border);
  padding: 5rem 0 4rem;
  position: relative;
}
.hero-section::before {
  content:''; position:absolute; inset:0;
  background: radial-gradient(ellipse 60% 50% at 50% 0%,rgba(79,158,240,.07),transparent);
  pointer-events:none;
}
.hero-inner { position:relative; }

.hero-title {
  font-family: 'Space Mono',monospace;
  font-size: clamp(1.8rem,4vw,2.7rem);
  font-weight:700; letter-spacing:-1px; margin:0;
  background: linear-gradient(135deg,#e8eaf0 0%,#8892a4 100%);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
}
.hero-sub { color:var(--text-muted); font-size:1rem; margin-top:.4rem; }

.stat-pill {
  display:inline-flex; align-items:center;
  background:var(--accent-glow); border:1px solid rgba(79,158,240,.22);
  color:var(--accent-h); padding:.22rem .9rem;
  border-radius:99px; font-size:.78rem; font-weight:600;
  font-family:'Space Mono',monospace;
}

/* ── Search bar ──────────────────────────────────────────────── */
.hero-search-form { max-width:680px; margin:0 auto; }

.search-wrapper {
  display:flex; align-items:center;
  background:var(--bg-card); border:1px solid var(--border);
  border-radius:var(--radius-lg); overflow:hidden;
  transition:border-color .2s, box-shadow .2s;
}
.search-wrapper:focus-within { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-glow); }
.search-ico { padding:0 .75rem 0 1.1rem; color:var(--text-dim); font-size:1.05rem; flex-shrink:0; }
.search-input { background:transparent!important; border:none!important; color:var(--text)!important; font-size:.97rem; padding:.875rem .4rem; flex:1; outline:none; box-shadow:none!important; }
.search-input::placeholder { color:var(--text-dim); }
.search-btn { border-radius:0!important; padding:.875rem 1.5rem; font-weight:600; border:none; background:var(--accent); color:#fff; transition:background .15s; flex-shrink:0; }
.search-btn:hover { background:var(--accent-h); color:#fff; }

/* ── Category pills ──────────────────────────────────────────── */
.cat-pills { display:flex; gap:.35rem; flex-wrap:wrap; justify-content:center; }
.cat-pill { display:inline-flex; align-items:center; padding:.28rem .75rem; border-radius:99px; font-size:.775rem; font-weight:500; color:var(--text-muted); border:1px solid var(--border); background:var(--bg-card); transition:all .15s; text-decoration:none; }
.cat-pill:hover { color:var(--text); border-color:rgba(255,255,255,.15); }
.cat-pill.active { color:var(--accent); border-color:var(--accent); background:var(--accent-glow); }

/* ── Torrent list ────────────────────────────────────────────── */
.torrent-list { display:flex; flex-direction:column; gap:.4rem; }
.torrent-card-link { text-decoration:none; color:inherit; display:block; }
.torrent-card {
  display:flex; align-items:center; gap:1rem;
  background:var(--bg-card); border:1px solid var(--border);
  border-radius:var(--radius); padding:.85rem 1rem;
  transition:all .15s;
}
.torrent-card-link:hover .torrent-card { background:var(--bg-hover); border-color:rgba(79,158,240,.2); transform:translateX(2px); }

.t-cat-icon { width:36px; height:36px; border-radius:var(--radius); display:flex; align-items:center; justify-content:center; font-size:1rem; flex-shrink:0; }
.cat-video    { background:rgba(252,129,129,.1);  color:#fc8181; }
.cat-audio    { background:rgba(183,148,244,.1);  color:#b794f4; }
.cat-software { background:rgba(104,211,145,.1);  color:#68d391; }
.cat-ebook    { background:rgba(246,173,85,.1);   color:#f6ad55; }
.cat-image    { background:rgba(99,179,237,.1);   color:#63b3ed; }
.cat-document { background:rgba(118,228,247,.1);  color:#76e4f7; }
.cat-other    { background:rgba(160,174,192,.1);  color:#a0aec0; }

.t-info { flex:1; min-width:0; }
.t-name { font-weight:500; font-size:.915rem; color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.t-meta { display:flex; gap:.7rem; flex-wrap:wrap; margin-top:.18rem; }
.t-meta span { font-size:.77rem; color:var(--text-dim); display:flex; align-items:center; gap:.25rem; }
.t-meta i { font-size:.8rem; }

/* Category badge shared */
.cat-badge { font-size:.7rem; font-weight:600; padding:.18rem .55rem; border-radius:99px; text-transform:uppercase; letter-spacing:.5px; white-space:nowrap; flex-shrink:0; }
.cat-badge-video    { background:rgba(252,129,129,.12); color:#fc8181; }
.cat-badge-audio    { background:rgba(183,148,244,.12); color:#b794f4; }
.cat-badge-software { background:rgba(104,211,145,.12); color:#68d391; }
.cat-badge-ebook    { background:rgba(246,173,85,.12);  color:#f6ad55; }
.cat-badge-image    { background:rgba(99,179,237,.12);  color:#63b3ed; }
.cat-badge-document { background:rgba(118,228,247,.12); color:#76e4f7; }
.cat-badge-other    { background:rgba(160,174,192,.12); color:#a0aec0; }

/* ── Results header ──────────────────────────────────────────── */
.results-title { font-family:'Space Mono',monospace; font-size:1.1rem; font-weight:700; }
.results-title em { color:var(--accent); font-style:normal; }
.badge-count { display:inline-block; background:var(--bg-card); border:1px solid var(--border); border-radius:99px; padding:.12rem .65rem; font-size:.78rem; color:var(--text-muted); font-family:'Space Mono',monospace; }
.section-heading { font-family:'Space Mono',monospace; font-size:1rem; font-weight:700; color:var(--text); }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state .empty-icon { font-size:4rem; opacity:.25; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination .page-link { background:var(--bg-card); border-color:var(--border); color:var(--text-muted); }
.pagination .page-link:hover { background:var(--bg-hover); color:var(--text); border-color:var(--border); }
.pagination .page-item.active .page-link { background:var(--accent); border-color:var(--accent); color:#fff; }

/* ── Live feed ───────────────────────────────────────────────── */
.live-section { border-top:1px solid var(--border); }
.live-dot { display:inline-block; width:8px; height:8px; background:#48bb78; border-radius:50%; margin-right:.4rem; animation:pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.25} }
.live-item { display:flex; justify-content:space-between; align-items:center; padding:.48rem .75rem; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); font-size:.8rem; color:var(--text-muted); transition:all .15s; gap:1rem; text-decoration:none; }
.live-item:hover { color:var(--text); border-color:rgba(79,158,240,.25); }
.live-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.live-size { flex-shrink:0; font-family:'Space Mono',monospace; font-size:.73rem; color:var(--text-dim); }

/* ── Category stat cards ─────────────────────────────────────── */
.cat-stat-card { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:1.25rem; border-radius:var(--radius-lg); border:1px solid var(--border); text-decoration:none; transition:all .15s; text-align:center; gap:.35rem; }
.cat-stat-card:hover { border-color:rgba(255,255,255,.14); transform:translateY(-2px); }
.cat-stat-icon { font-size:1.6rem; margin-bottom:.25rem; }
.cat-stat-name { font-size:.82rem; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; }
.cat-stat-count { font-family:'Space Mono',monospace; font-size:1.1rem; font-weight:700; color:var(--text); }
/* apply category colour to icon */
.cat-stat-card.cat-video    .cat-stat-icon { color:#fc8181; }
.cat-stat-card.cat-audio    .cat-stat-icon { color:#b794f4; }
.cat-stat-card.cat-software .cat-stat-icon { color:#68d391; }
.cat-stat-card.cat-ebook    .cat-stat-icon { color:#f6ad55; }
.cat-stat-card.cat-image    .cat-stat-icon { color:#63b3ed; }
.cat-stat-card.cat-document .cat-stat-icon { color:#76e4f7; }
.cat-stat-card.cat-other    .cat-stat-icon { color:#a0aec0; }

/* ── Torrent detail ──────────────────────────────────────────── */
.detail-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:2rem; }
.detail-header { }
.detail-cat-icon { width:52px; height:52px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:1.5rem; flex-shrink:0; }
.detail-title { font-size:1.2rem; font-weight:600; margin:0; line-height:1.35; }
.detail-badges { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; }
.detail-meta-item { font-size:.8rem; color:var(--text-muted); }
.detail-divider { border-color:var(--border); margin:1.5rem 0; }
.field-label { display:block; font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:var(--text-dim); margin-bottom:.4rem; }
.hash-row { display:flex; align-items:center; gap:.5rem; background:var(--bg); border:1px solid var(--border); border-radius:var(--radius); padding:.55rem .9rem; }
.hash-code { font-size:.8rem; word-break:break-all; flex:1; color:var(--accent-h); }
.magnet-row { display:flex; align-items:center; gap:.5rem; }
.magnet-input { background:var(--bg)!important; border-color:var(--border)!important; color:var(--text-muted)!important; font-family:'Space Mono',monospace; font-size:.75rem; }
.btn-icon { background:var(--bg-surface); border:1px solid var(--border); color:var(--text-muted); padding:.3rem .55rem; }
.btn-icon:hover { background:var(--bg-hover); color:var(--text); }

.file-list-section { margin-top:1.75rem; }
.file-list-title { font-size:.95rem; font-weight:600; margin-bottom:.75rem; }
.file-list-scroll { background:var(--bg); border:1px solid var(--border); border-radius:var(--radius); max-height:420px; overflow-y:auto; }
.file-row { display:flex; justify-content:space-between; align-items:center; padding:.42rem .9rem; border-bottom:1px solid var(--border); font-size:.82rem; }
.file-row:last-child { border-bottom:none; }
.file-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text-muted); flex:1; min-width:0; }
.file-size { flex-shrink:0; margin-left:1rem; font-family:'Space Mono',monospace; font-size:.74rem; color:var(--text-dim); }

.sidebar-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:1.25rem; }
.sidebar-card-title { font-family:'Space Mono',monospace; font-size:.75rem; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:var(--text-dim); margin-bottom:.75rem; }
.info-table td { padding:.3rem .2rem; font-size:.84rem; vertical-align:middle; border:none; }
.info-table td:first-child { color:var(--text-muted); min-width:80px; }
.info-table td:last-child strong { color:var(--text); }

.similar-list { display:flex; flex-direction:column; gap:2px; }
.similar-item { display:block; padding:.42rem .5rem; border-radius:6px; font-size:.82rem; color:var(--text-muted); text-decoration:none; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; transition:all .12s; }
.similar-item:hover { background:var(--bg-hover); color:var(--text); }

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb { background:none; padding:0; }
.breadcrumb-item + .breadcrumb-item::before { color:var(--text-dim); }
.breadcrumb-item a { color:var(--text-muted); }
.breadcrumb-item.active { color:var(--text-secondary); }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer { background:var(--bg-surface); border-top:1px solid var(--border); margin-top:auto; }
.footer-brand { font-family:'Space Mono',monospace; font-weight:700; font-size:1rem; color:var(--text); }
.footer-heading { font-size:.75rem; text-transform:uppercase; letter-spacing:1px; color:var(--text-dim); margin-bottom:.6rem; }
.footer-links { }
.footer-links li { margin-bottom:.3rem; }
.footer-links a { color:var(--text-muted); font-size:.875rem; transition:color .12s; }
.footer-links a:hover { color:var(--accent); }
.footer-divider { border-color:var(--border); }

/* ── Bootstrap overrides ─────────────────────────────────────── */
.btn-primary { background:var(--accent); border-color:var(--accent); }
.btn-primary:hover { background:var(--accent-h); border-color:var(--accent-h); }
.btn-success { background:#2f855a; border-color:#2f855a; }
.btn-success:hover { background:#38a169; border-color:#38a169; }
.btn-outline-secondary { border-color:var(--border); color:var(--text-muted); }
.btn-outline-secondary:hover { background:var(--bg-hover); color:var(--text); border-color:var(--border); }
.btn-outline-primary { border-color:var(--accent); color:var(--accent); }
.btn-outline-primary:hover { background:var(--accent-glow); color:var(--accent-h); border-color:var(--accent-h); }
.min-w-0 { min-width:0; }
