/* HokmShT Admin Dashboard — Production CSS
   Desktop-first, no external CDN dependencies.
   No unsafe-eval, no inline scripts.
*/

:root {
    --bg:       #0f1117;
    --bg2:      #1a1d2e;
    --bg3:      #252840;
    --sidebar:  #141628;
    --accent:   #5b6af0;
    --accent2:  #4ade80;
    --danger:   #ef4444;
    --warning:  #f59e0b;
    --text:     #e2e8f0;
    --text-muted: #94a3b8;
    --border:   #2d3154;
    --radius:   8px;
    --font:     system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font);
    background:  var(--bg);
    color:       var(--text);
    display:     flex;
    min-height:  100vh;
    font-size:   14px;
}

/* ── Login page ───────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.login-container { width: 100%; max-width: 400px; padding: 24px; }
.login-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}
.login-title    { font-size: 24px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 24px; font-size: 12px; }

/* ── Sidebar ──────────────────────────────────────── */
.sidebar {
    width: 220px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 20px 16px;
    font-weight: 700;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
}
.sidebar-nav    { list-style: none; flex: 1; padding: 8px 0; }
.sidebar-nav li { margin: 2px 8px; }
.nav-separator  { border-top: 1px solid var(--border); margin: 8px 0; }
.nav-link {
    display: block;
    padding: 8px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    transition: background .15s, color .15s;
}
.nav-link:hover, .nav-link.active {
    background: var(--bg3);
    color: var(--text);
}
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.sidebar-user { font-size: 12px; color: var(--text-muted); flex: 1; }
.btn-logout {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all .15s;
}
.btn-logout:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ── Main content ─────────────────────────────────── */
.main-content {
    margin-left: 220px;
    flex: 1;
    padding: 24px;
    max-width: calc(100vw - 220px);
    overflow-x: auto;
}
.page-header { margin-bottom: 20px; }
.page-title  { font-size: 20px; font-weight: 600; }

/* ── Cards ────────────────────────────────────────── */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    background: var(--bg3);
}
.card-body { padding: 16px; }
.mt-2 { margin-top: 16px; }
.p-0  { padding: 0; }
.p-4  { padding: 16px; }

/* ── Metrics grid ─────────────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.metric-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.metric-card.online   { border-color: var(--accent2); }
.metric-card.highlight{ border-color: var(--accent); }
.metric-card.warning  { border-color: var(--warning); }
.metric-value { font-size: 28px; font-weight: 700; }
.metric-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── Section row ──────────────────────────────────── */
.section-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* ── Tables ───────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th { color: var(--text-muted); font-weight: 500; font-size: 11px; text-transform: uppercase; }
.table-striped tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }
.table-definition th { width: 160px; color: var(--text-muted); }
.row-moderated td   { opacity: .7; }
.text-right { text-align: right; }
.text-green { color: var(--accent2); }
.text-red   { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 11px; }
.monospace  { font-family: monospace; font-size: 12px; }

/* ── Badges ───────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success { background: rgba(74,222,128,.15); color: var(--accent2); }
.badge-danger  { background: rgba(239,68,68,.15);  color: var(--danger); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning); }

/* ── Alerts ───────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-success { background: rgba(74,222,128,.1); border: 1px solid var(--accent2); color: var(--accent2); }
.alert-danger  { background: rgba(239,68,68,.1);  border: 1px solid var(--danger);  color: var(--danger); }

/* ── Forms ────────────────────────────────────────── */
.form-group    { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.form-control {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: border-color .15s;
}
.form-control:focus { border-color: var(--accent); }

/* ── Buttons ──────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .85; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-success { background: var(--accent2); color: #000; }
.btn-warning { background: var(--warning); color: #000; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-block { width: 100%; justify-content: center; }
.btn-sm    { padding: 4px 10px; font-size: 12px; }
.btn-link  { background: none; border: none; color: var(--text-muted); text-decoration: underline; font-size: 12px; cursor: pointer; }

/* ── Search form ──────────────────────────────────── */
.search-form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.search-input { flex: 1; }

/* ── Tab bar ──────────────────────────────────────── */
.tab-bar { display: flex; gap: 4px; margin-bottom: 0; }
.tab {
    padding: 8px 16px;
    border-radius: 6px 6px 0 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    border: 1px solid var(--border);
    border-bottom: none;
    background: var(--bg2);
    display: flex;
    align-items: center;
    gap: 6px;
}
.tab-active { color: var(--text); background: var(--bg3); }

/* ── Action bar ───────────────────────────────────── */
.action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── User detail ──────────────────────────────────── */
.user-detail-header {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}
.player-code { font-family: monospace; font-size: 12px; color: var(--text-muted); margin-right: 8px; }
.user-stats { display: flex; gap: 20px; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat-val { font-weight: 700; font-size: 18px; }
.stat-lbl { font-size: 10px; color: var(--text-muted); }
.ban-row { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }

/* ── Modal ────────────────────────────────────────── */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.7);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-dialog {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 480px;
    max-width: 90vw;
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body   { padding: 20px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding-top: 16px; }

/* ── Health items ─────────────────────────────────── */
.health-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.health-item:last-child { border-bottom: none; }

/* ── TOTP input ───────────────────────────────────── */
.totp-input { letter-spacing: 6px; font-size: 24px; text-align: center; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 900px) {
    .sidebar { width: 56px; }
    .sidebar-brand span, .nav-link span:last-child { display: none; }
    .main-content { margin-left: 56px; max-width: calc(100vw - 56px); }
    .section-row { grid-template-columns: 1fr; }
}

/* ── Utility: hide/show ──────────────────────────────────────────────── */
.d-none  { display: none !important; }
.d-block { display: block !important; }

/* License Test Mode control */
.license-mode-card {
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.license-mode-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.license-mode-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.license-mode-description,
.license-mode-readonly {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 13px;
}

.license-mode-form {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.license-toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
}

.license-toggle input {
    appearance: none;
    -webkit-appearance: none;
    width: 48px;
    height: 27px;
    flex: 0 0 48px;
    margin: 0;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg3);
    position: relative;
    cursor: pointer;
    transition: background .18s, border-color .18s;
}

.license-toggle input::before {
    content: "";
    position: absolute;
    width: 19px;
    height: 19px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform .18s, background .18s;
}

.license-toggle input:checked {
    background: var(--accent2);
    border-color: var(--accent2);
}

.license-toggle input:checked::before {
    transform: translateX(21px);
    background: #fff;
}

.license-toggle input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.license-reason {
    max-width: 460px;
    margin-top: 16px;
}
