/* =========================
   Void Imperium — Dark Neon UI
   drop-in replacement for styles.css
   ========================= */

/* ---------- CSS Variables (theme) ---------- */
:root{
  --bg: #0c0f14;
  --bg-elev-1:#121622;
  --bg-elev-2:#171c2b;
  --panel:#1a2032;
  --panel-2:#1e2740;
  --text:#e6e9ef;
  --muted:#a6adbb;
  --primary:#00bcd4;
  --primary-600:#05a2b6;
  --secondary:#e91e63;
  --secondary-600:#c2185b;
  --success:#2ecc71;
  --danger:#ff5555;
  --border:#263045;
  --shadow:0 10px 30px rgba(0,0,0,.45);
  --glow:0 0 0 rgba(0,188,212,0);
}

@media (prefers-color-scheme: dark){
  :root { color-scheme: dark; }
}

/* ---------- Reset ---------- */
*{ box-sizing:border-box; margin:0; padding:0; }
html,body{ height:100%; }
body{
  font-family: 'Roboto', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 800px at 10% -10%, #10203a 0%, transparent 60%),
              radial-gradient(1000px 700px at 110% 20%, #221034 0%, transparent 60%),
              var(--bg);
  color:var(--text);
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

/* focus visible for a11y */
:focus-visible{
  outline:2px solid var(--primary);
  outline-offset:2px;
}

/* ---------- Layout ---------- */
.container{
  width: min(1200px, 92%);
  margin: 0 auto;
}

main{ padding: 40px 0; }
section{ margin: 48px 0; }

/* ---------- Header & Navigation ---------- */
header{
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background: color-mix(in oklab, var(--bg-elev-1) 70%, transparent);
  border-bottom: 1px solid var(--border);
}

nav{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 0;
}

.logo{
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: .5px;
  color:#fff;
}

.nav-links{
  list-style:none;
  display:flex;
  gap: 16px;
  align-items:center;
  overflow-x:auto;
  padding:4px 0;
}
.nav-links a{
  text-decoration:none;
  color:var(--muted);
  padding:8px 12px;
  border-radius:6px;
  transition: color .2s ease, background-color .2s ease;
}
.nav-links a:hover{
  color:#fff;
  background:rgba(255,255,255,0.04);
}

/* ---------- Hero ---------- */
.hero{
  position: relative;
  min-height: clamp(420px, 55vh, 680px);
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: url('/static/hero-bg.jpg') center/cover no-repeat, var(--bg-elev-1);
}
.hero::before{
  /* gradient overlay for readability */
  content:"";
  position:absolute; inset:0;
  background: radial-gradient(80% 60% at 50% 40%, rgba(0,0,0,.25) 0%, rgba(0,0,0,.65) 70%),
              linear-gradient(180deg, rgba(15,23,42,.45), rgba(2,6,23,.85));
}
.hero-content{ position:relative; z-index:1; padding: 28px; }
.hero-content h1{
  font-size: clamp(2rem, 3.6vw, 3rem);
  letter-spacing: .6px;
  margin-bottom: 8px;
  text-shadow: 0 6px 30px rgba(0,0,0,.6);
}
.hero-content h2{
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 18px;
}
.hero-content p{
  font-size: 1.05rem;
  margin: 0 auto 22px auto;
  max-width: 900px;
  color: #d3d7e2;
}

/* hero stars (subtle) */
.hero::after{
  content:"";
  position:absolute; inset:-20%;
  pointer-events:none;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.45) 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,.35) 50%, transparent 51%),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,.25) 50%, transparent 51%),
    radial-gradient(1px 1px at 85% 20%, rgba(255,255,255,.35) 50%, transparent 51%);
  opacity:.4;
  transform: translateZ(0);
}

.hero-buttons{ display:flex; gap:12px; flex-wrap:wrap; justify-content:center; }

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.5ch;
  background: var(--primary);
  color:#fff;
  padding: 12px 22px;
  border-radius: 10px;
  text-decoration:none;
  font-size: 0.975rem;
  font-weight: 600;
  border: 1px solid color-mix(in oklab, var(--primary) 82%, #fff 0%);
  box-shadow: 0 8px 30px rgba(0,188,212,.22), inset 0 0 0 0 rgba(255,255,255,.08);
  cursor:pointer;
  transition: transform .12s ease, box-shadow .2s ease, background-color .2s ease;
}
.btn:hover{
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: 0 10px 36px rgba(0,188,212,.28);
}
.btn:active{ transform: translateY(0); }

.btn.btn-secondary{
  background: var(--secondary);
  border-color: color-mix(in oklab, var(--secondary) 82%, #fff 0%);
  box-shadow: 0 8px 30px rgba(233,30,99,.22);
}
.btn.btn-secondary:hover{ background: var(--secondary-600); }

.btn.btn-ghost{
  background: transparent;
  border:1px solid var(--border);
  color: var(--text);
}
.btn.btn-ghost:hover{ background: rgba(255,255,255,0.04); }

/* ---------- Features Grid ---------- */
.features{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap:16px;
}
.feature{
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  text-align:center;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.feature:hover{
  transform: translateY(-3px);
  border-color: color-mix(in oklab, var(--primary) 40%, var(--border));
  box-shadow: 0 12px 40px rgba(0,188,212,.12);
}
.feature h3{
  margin-bottom: 10px;
  font-size: 1.2rem;
  color: var(--primary);
}
.feature p{ color: #d6dae4; }

/* ---------- Forms (Register/Login/Admin) ---------- */
.form, .admin-news-form{
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  max-width: 520px;
  margin: 32px auto;
  box-shadow: var(--shadow);
}
.form label, .form-group label{ color:#cfd6e5; }

.form input,
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.admin-news-form input[type="text"],
.admin-news-form textarea{
  width:100%;
  padding:12px 12px;
  border-radius:10px;
  border:1px solid #2b354f;
  background:#121828;
  color:var(--text);
  transition:border-color .15s ease, box-shadow .15s ease;
}
.form input:focus,
.form-group input:focus,
.admin-news-form input[type="text"]:focus,
.admin-news-form textarea:focus{
  border-color: color-mix(in oklab, var(--primary) 60%, #2b354f);
  box-shadow: 0 0 0 4px rgba(0,188,212,.12);
}

.admin-news-form textarea{
  min-height: 280px;
  max-height: 800px;
  resize: vertical;
}

/* small message helpers */
.success{ color: var(--success); margin-bottom: .8em; }
.error{ color: var(--danger); margin-bottom: .8em; }

/* ---------- Tables (Admin) ---------- */
.table,
.admin-users-table{
  width:100%;
  border-collapse: collapse;
  font-size: .95rem;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border:1px solid var(--border);
  border-radius: 12px;
  overflow:hidden;
  box-shadow: var(--shadow);
}
.table thead th,
.admin-users-table thead th{
  text-align:left;
  background: #141b2b;
  color:#d7ddef;
  border-bottom:1px solid var(--border);
  padding: 12px 14px;
}
.table tbody td,
.admin-users-table tbody td{
  padding: 12px 14px;
  border-bottom:1px solid #222b40;
  color:#dfe3ee;
}
.admin-users-table tbody tr:nth-child(odd){ background: #171e2e; }
.admin-users-table tbody tr:nth-child(even){ background: #1a2235; }
.admin-users-table tbody tr:hover{ background:#202b45; }
.admin-users-table tbody tr{ cursor:pointer; transition: background-color .15s; }

/* wrap long object names in releases page */
.admin-users-table td a{
  color: var(--primary);
  word-break: break-all;
}

/* make the container centered & scrollable if needed */
.table-container{ overflow-x:auto; margin: 16px auto 28px; }

/* admin quick nav list */
.admin-nav{ list-style:none; padding:0; margin: 12px 0; }
.admin-nav li{ margin:.5em 0; }
.admin-nav a{
  text-decoration:none; font-weight:700; color:var(--text);
  border-bottom:1px dashed transparent; transition: border-color .2s;
}
.admin-nav a:hover{ border-color: var(--primary); }

/* search form */
.admin-search-form{
  display:flex; gap:.6em; align-items:center; justify-content:center;
  margin: 16px auto 18px; max-width: 720px;
}
.admin-search-form input[type="text"]{
  flex:1; padding:.7em .9em; border:1px solid #2b354f; border-radius:10px;
  background:#121828; color:#e9edf7;
}
.admin-search-form button{ padding:.7em 1.1em; }

/* ---------- News ---------- */
.news-item{
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border:1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin: 18px 0;
  box-shadow: var(--shadow);
}
.news-item h3{ margin-bottom: 6px; }
.news-item .meta{
  color: var(--muted);
  font-size:.9rem;
  margin-bottom: 10px;
}
.news-item .body{
  white-space: pre-line; /* preserve line breaks from db */
  color: #dfe5f2;
}

/* ---------- Footer ---------- */
footer{
  border-top: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg-elev-1) 80%, transparent);
  padding: 22px 0;
  text-align:center;
  color: var(--muted);
}

/* ---------- Small Screens ---------- */
@media (max-width: 720px){
  nav{ gap: 12px; }
  .logo{ font-size: 1.2rem; }
  .hero{ border-radius: 10px; }
  .hero-content{ padding: 18px; }
  .features{ gap:12px; }
  .btn{ padding: 11px 18px; }
}

/* ---------- Motion-Reduced ---------- */
@media (prefers-reduced-motion: reduce){
  .feature, .btn{ transition: none !important; }
}

.download-card code{
  background: rgba(255,255,255,0.06);
  border: 1px solid #2b354f;
  padding: 2px 6px;
  border-radius: 6px;
}
.news-item .body p { margin: 0.6em 0; }
.news-item .body pre { overflow:auto; padding:12px; border:1px solid #2b354f; border-radius:8px; }
.news-item .body code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 6px; }
.dash-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap:14px;
  margin: 10px 0 18px;
}
.stat-card{
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border:1px solid var(--border);
  border-radius:14px;
  padding:16px;
  box-shadow: var(--shadow);
}
.stat-label{ color: var(--muted); font-size:.9rem; letter-spacing:.02em; }
.stat-value{ font-size:1.8rem; font-weight:800; margin-top:4px; }
.stat-sub{ color:#a6adbb; margin-top:4px; font-size:.9rem; }

.quick-actions{
  display:flex; flex-wrap:wrap; gap:10px; margin: 6px 0 20px;
}

.dash-panels{
  display:grid;
  grid-template-columns: 1fr;
  gap:14px;
}
.panel-head{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:10px;
}
@media (min-width: 1024px){
  .dash-panels{ grid-template-columns: 1fr 1fr; }
}
.admin-edit-grid{
  display:grid;
  gap:14px;
}
@media (min-width: 1024px){
  .admin-edit-grid{
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}
.admin-edit-grid{
  display:grid;
  gap:14px;
}
@media (min-width: 1024px){
  .admin-edit-grid{
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}
.preview-pane{
  max-width:none;
  position: sticky;
  top: 80px;         /* keeps preview in view while scrolling */
  min-height: 520px; /* bigger by default */
}
.preview-pane .news-item{
  min-height: 420px;
}
.news-item .body p { margin: 0.6em 0; }
.news-item .body pre { overflow:auto; padding:12px; border:1px solid #2b354f; border-radius:8px; }
.news-item .body code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 6px; }
/* admin news edit layout */
.admin-edit-grid{
  display:grid;
  gap:14px;
}
@media (min-width: 980px){
  /* Make the preview a little wider than the editor */
  .admin-edit-grid{
    grid-template-columns: minmax(520px, 1fr) minmax(620px, 1.2fr);
    align-items:start;
  }
}

/* make the preview card fill its grid column */
.preview-pane{
  max-width: none !important;
  width: 100%;
  margin: 0;                /* kill .form's auto-centering */
  position: sticky;
  top: 80px;
  min-height: 520px;
}
.preview-pane .news-item{
  min-height: 440px;
}

/* nicer markdown defaults */
.news-item .body p { margin: .6em 0; }
.news-item .body h1, .news-item .body h2, .news-item .body h3,
.news-item .body h4, .news-item .body h5, .news-item .body h6 {
  margin: .6em 0 .3em; line-height: 1.25;
}
.news-item .body pre { overflow:auto; padding:12px; border:1px solid #2b354f; border-radius:8px; }
.news-item .body code { background: rgba(255,255,255,.06); padding: 2px 6px; border-radius: 6px; }

/* News HTML should render normally (not pre-line) */
.news-item .body { white-space: normal; }

/* Line clamp with soft fade for list page (approx 6 lines) */
.clamp-6{
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
  /* subtle bottom fade */
  mask-image: linear-gradient(to bottom, black 75%, rgba(0,0,0,0.15) 92%, transparent 100%);
}

/* Better list spacing inside news cards */
.news-item .body ul,
.news-item .body ol { margin: 0.5em 0 0.6em 1.2em; }
.news-item .body li { margin: 0.25em 0; }

/* status cards reuse your theme */
.status-kpis{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap:14px;
  margin: 10px 0 18px;
}
.status-card{
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border:1px solid var(--border);
  border-radius:14px;
  padding:16px;
  box-shadow: var(--shadow);
}
.status-refresh{
  display:flex; gap:10px; align-items:center;
}
.status-refresh #auto-refresh{ color: var(--muted); font-size:.9rem; }

/* badges */
.badge{
  display:inline-block;
  padding: .25em .6em;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  border:1px solid transparent;
}
.badge-ok{
  background: rgba(46, 204, 113, 0.12);
  color: #2ecc71;
  border-color: rgba(46, 204, 113, 0.35);
}
.badge-warn{
  background: rgba(241, 196, 15, 0.12);
  color: #f1c40f;
  border-color: rgba(241, 196, 15, 0.35);
}
.badge-fail{
  background: rgba(255, 85, 85, 0.12);
  color: #ff6b6b;
  border-color: rgba(255, 85, 85, 0.35);
}
.muted{ color: var(--muted); }
