/* ─────────────────────────────────────────────────────────────────────────────
   MilfWare Web Panel — stylesheet
   Dark space theme matching the C++ loader GUI
───────────────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0a0a0e;
  --bg2:          #0e0e16;
  --sidebar:      #111118;
  --sidebar-b:    #1c1c28;
  --accent:       #dc1e32;
  --accent-h:     #b81428;
  --blue:         #3250dc;
  --blue-h:       #2840c0;
  --text:         #e6e6eb;
  --subtext:      #8c8c96;
  --input-bg:     #16161e;
  --input-border: #3c3c50;
  --input-focus:  #dc1e32;
  --card-bg:      #12121a;
  --card-border:  #28283c;
  --danger:       #dc1e32;
  --green:        #3cc060;
  --yellow:       #e6c832;
  --mono:         'JetBrains Mono', monospace;
  --sans:         'Inter', sans-serif;
  --sidebar-w:    200px;
  --radius:       6px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  overflow: hidden;
}

/* ── Stars canvas ──────────────────────────────────────────────────────────── */
#stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ── App shell ─────────────────────────────────────────────────────────────── */
#app { position: relative; z-index: 1; height: 100vh; }

/* ── Views ─────────────────────────────────────────────────────────────────── */
.view { display: none; height: 100vh; }
.view.active { display: flex; align-items: center; justify-content: center; }

/* ── Login / Register card ─────────────────────────────────────────────────── */
.card {
  background: rgba(14, 14, 20, 0.92);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 2.5rem 2.2rem;
  backdrop-filter: blur(12px);
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-card h2 {
  font-size: 1.4rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
}

/* ── Brand ─────────────────────────────────────────────────────────────────── */
.brand {
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: .25rem;
  font-family: var(--sans);
}
.brand-red   { color: var(--accent); }
.brand-white { color: var(--text); }

/* ── Inputs ─────────────────────────────────────────────────────────────────── */
.input-group { display: flex; flex-direction: column; }

input[type=text],
input[type=password],
input[type=email],
input[type=number] {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--sans);
  font-size: .9rem;
  padding: .7rem .9rem;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
input::placeholder { color: var(--subtext); }
input:focus { border-color: var(--input-focus); }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 600;
  padding: .6rem 1.1rem;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-accent  { background: var(--accent);  color: #fff; }
.btn-accent:hover:not(:disabled)  { background: var(--accent-h); }

.btn-blue    { background: var(--blue);    color: #fff; }
.btn-blue:hover:not(:disabled)    { background: var(--blue-h); }

.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover:not(:disabled)  { background: var(--accent-h); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--subtext);
}
.btn-outline:hover { border-color: var(--text); color: var(--text); }

.btn-full { width: 100%; }
.btn-sm   { padding: .3rem .7rem; font-size: .8rem; }

/* ── Subtle link ─────────────────────────────────────────────────────────────── */
.subtle-link {
  text-align: center;
  font-size: .85rem;
  color: var(--subtext);
  margin-top: .25rem;
}
.subtle-link a { color: var(--subtext); text-decoration: underline; cursor: pointer; }
.subtle-link a:hover { color: var(--text); }

/* ── Error / status messages ──────────────────────────────────────────────── */
.error-msg  { color: var(--accent); font-size: .85rem; text-align: center; }
.success-msg{ color: var(--green);  font-size: .85rem; text-align: center; }
.hidden { display: none !important; }

/* ── Dashboard layout ─────────────────────────────────────────────────────── */
#view-dashboard {
  display: none;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}
#view-dashboard.active { display: flex; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-b);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 2;
}

.sidebar-brand {
  padding: .9rem 1rem .7rem;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 2px;
  border-bottom: 1px solid var(--sidebar-b);
}

/* Nav list */
.nav-list {
  list-style: none;
  flex: 1;
  padding: .4rem 0;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .72rem 1rem;
  cursor: pointer;
  color: var(--subtext);
  font-weight: 500;
  font-size: .875rem;
  border-left: 3px solid transparent;
  transition: background .12s, color .12s;
  user-select: none;
}
.nav-item svg {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.nav-item:hover  { background: rgba(255,255,255,.04); color: var(--text); }
.nav-item.active {
  background: rgba(50, 80, 220, .15);
  color: #fff;
  border-left-color: var(--blue);
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--sidebar-b);
  padding: .75rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-shrink: 0;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.user-name {
  font-weight: 600;
  font-size: .85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-sub, .user-ping {
  font-size: .75rem;
  color: var(--subtext);
}
.user-ping { color: var(--green); }

/* ── Content area ────────────────────────────────────────────────────────── */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 2.5rem;
  position: relative;
  z-index: 1;
}

/* Tabs */
.tab { display: none; }
.tab.active { display: block; }

.tab-header { margin-bottom: 1.5rem; }
.tab-header h1 { font-size: 1.5rem; font-weight: 600; color: var(--text); }
.tab-sub { color: var(--subtext); margin-top: .3rem; font-size: .875rem; }

/* ── Products tab ──────────────────────────────────────────────────────────── */
.info-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.info-card-icon { font-size: 1.6rem; }
.info-title { font-weight: 600; font-size: .95rem; color: var(--text); }
.info-sub   { font-size: .82rem; color: var(--subtext); margin-top: .2rem; }

.license-bar {
  display: flex;
  gap: .6rem;
  align-items: center;
  margin-bottom: .75rem;
}
.license-bar input {
  flex: 1;
  font-family: var(--mono);
  letter-spacing: .06em;
}

/* ── Build tab ─────────────────────────────────────────────────────────────── */
.build-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 1.25rem;
}
.build-icon  { font-size: 2rem; flex-shrink: 0; }
.build-info  { flex: 1; }
.build-title { font-weight: 600; color: var(--text); }
.build-sub   { font-size: .82rem; color: var(--subtext); margin-top: .2rem; }

.result-card {
  background: var(--card-bg);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.result-row  { display: flex; align-items: center; gap: .6rem; }
.result-label{ width: 80px; color: var(--subtext); font-size: .82rem; }
.result-val  { color: var(--text); font-size: .875rem; }
.mono        { font-family: var(--mono); font-size: .82rem; }

/* ── Updates tab ───────────────────────────────────────────────────────────── */
.update-item {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: 1rem;
}
.update-version { font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: .5rem; }
.update-date    { color: var(--subtext); font-size: .82rem; margin: .3rem 0 .6rem; }
.update-notes   { padding-left: 1.2rem; color: var(--subtext); font-size: .85rem; line-height: 1.7; }

.badge         { font-size: .72rem; font-weight: 600; padding: .15rem .5rem; border-radius: 100px; }
.badge-green   { background: rgba(60, 192, 96, .15); color: var(--green); }

/* ── Settings tab ──────────────────────────────────────────────────────────── */
.settings-grid {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.setting-row {
  display: flex;
  align-items: center;
  padding: .85rem 1.2rem;
  border-bottom: 1px solid var(--sidebar-b);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { width: 110px; color: var(--subtext); font-size: .85rem; }
.setting-val   { color: var(--text); font-size: .875rem; }

/* ── Admin tab ─────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .8rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat-val   { font-size: 1.8rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: .78rem; color: var(--subtext); margin-top: .2rem; }

.admin-section { margin-bottom: 2rem; }
.admin-section h3 {
  font-size: .95rem; font-weight: 600;
  margin-bottom: .75rem;
  display: flex; align-items: center; gap: .6rem;
}

.admin-form .form-row {
  display: flex;
  gap: .6rem;
  align-items: center;
  flex-wrap: wrap;
}
.admin-form label {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .8rem;
  color: var(--subtext);
}
.admin-form label input { width: 100px; }
.admin-form label:has([style*="flex:1"]) { flex: 1; }

textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  color: var(--green);
  font-family: var(--mono);
  font-size: .82rem;
  padding: .7rem;
  resize: vertical;
  outline: none;
  margin-top: .6rem;
}

/* Tables */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
thead th {
  text-align: left;
  padding: .6rem .8rem;
  color: var(--subtext);
  border-bottom: 1px solid var(--sidebar-b);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid rgba(255,255,255,.04); }
tbody tr:hover { background: rgba(255,255,255,.03); }
tbody td {
  padding: .55rem .8rem;
  color: var(--text);
  font-family: var(--mono);
  vertical-align: middle;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.td-active { color: var(--green); }
.td-revoked{ color: var(--accent); }

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sidebar-b); border-radius: 3px; }

/* ── Responsive tweaks ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  #sidebar { width: 52px; min-width: 52px; }
  .nav-item span, .user-info, .sidebar-brand span, .sidebar-brand { display: none; }
  .nav-item { justify-content: center; padding: .72rem; }
  #content { padding: 1.2rem; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
