:root {
    --bg: #0a0a0a;
    --panel: #111111;
    --panel-alt: #161616;
    --border: #262626;
    --white: #f5f5f5;
    --muted: #8a8a8a;
    --on: #f5f5f5;
    --off: #3a3a3a;
    --danger: #e5484d;
    --radius: 10px;
}

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

html, body {
    width: 100%;
    min-height: 100vh;
    background: var(--bg);
    font-family: 'Segoe UI', 'Inter', Arial, sans-serif;
    color: var(--white);
}

.hidden { display: none !important; }

/* ---------------- LOGIN ---------------- */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    width: 340px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
}

.login-hint { color: var(--muted); font-size: 13px; margin: 16px 0 12px 0; }

.login-box input {
    width: 100%;
    padding: 10px 12px;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--white);
    font-size: 13px;
    margin-bottom: 12px;
}

.login-error { color: var(--danger); font-size: 12px; margin-top: 10px; }

.btn-primary {
    width: 100%;
    padding: 10px;
    background: var(--white);
    color: #000;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}
.btn-primary:hover { opacity: 0.85; }

/* ---------------- BRAND ---------------- */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-bottom: 6px;
}
.sidebar .brand { justify-content: flex-start; padding: 0 20px 20px 20px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--white);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: 0.5px;
    font-size: 14px;
    flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.brand-title { font-weight: 700; font-size: 15px; letter-spacing: 2px; }
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: 1.5px; }

/* ---------------- APP LAYOUT ---------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: #0d0d0d;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
}

.tabs { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; }
.tab-btn {
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
}
.tab-btn:hover { background: var(--panel-alt); color: var(--white); }
.tab-btn.active { background: var(--white); color: #000; font-weight: 600; }

.sidebar-footer { margin-top: auto; padding: 14px 20px 0 20px; border-top: 1px solid var(--border); }

.btn-ghost {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
}
.btn-ghost:hover { border-color: var(--white); color: var(--white); }

.content { flex: 1; padding: 30px 36px; overflow-y: auto; }
.content-header { margin-bottom: 20px; }
.content-header h1 { font-size: 21px; font-weight: 700; }
.content-header p { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------------- BANS TABLE ---------------- */
.search-input {
    width: 100%;
    max-width: 420px;
    padding: 9px 12px;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--white);
    font-size: 13px;
    margin-bottom: 16px;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

.bans-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.bans-table th, .bans-table td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.bans-table th { color: var(--muted); font-weight: 600; background: var(--panel-alt); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.bans-table tr:last-child td { border-bottom: none; }
.bans-table td.reason-cell { white-space: normal; max-width: 320px; }

.btn-unban {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 6px;
    font-size: 11.5px;
    cursor: pointer;
}
.btn-unban:hover { background: var(--danger); color: #fff; }

.empty-hint { color: var(--muted); font-size: 13px; margin-top: 20px; }

/* ---------------- SETTINGS ---------------- */
.settings-layout { display: flex; gap: 24px; }

.category-list {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--muted);
    user-select: none;
}
.category-item:hover { background: var(--panel-alt); color: var(--white); }
.category-item.active { background: var(--white); color: #000; font-weight: 600; }
.category-count { font-size: 10px; opacity: 0.6; }

.options-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    align-content: start;
}

.option-card {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 13px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.option-name { font-size: 12.5px; font-weight: 500; }

.switch { position: relative; width: 38px; height: 21px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--off); border-radius: 999px; transition: 0.15s; }
.slider::before { content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; background: #d0d0d0; border-radius: 50%; transition: 0.15s; }
.switch input:checked + .slider { background: var(--on); }
.switch input:checked + .slider::before { transform: translateX(17px); background: #000; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- STATISZTIKA ---------------- */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 26px; font-weight: 700; }
.stat-value-small { font-size: 15px; font-weight: 600; }

.section-title { font-size: 15px; font-weight: 700; margin: 22px 0 12px 0; }

.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 180px 1fr 40px; align-items: center; gap: 10px; }
.bar-label { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 14px; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--white); border-radius: 999px; transition: width 0.3s ease; }
.bar-count { font-size: 12px; text-align: right; }

/* ---------------- TISZTÍTÁS ---------------- */
.cleanup-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 6px; }
.btn-action {
    padding: 12px 18px;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    color: var(--white);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}
.btn-action:hover { border-color: var(--white); }

.notify-box { display: flex; flex-direction: column; gap: 10px; max-width: 480px; }
.notify-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--white);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}
.notify-box .btn-primary { width: auto; padding: 10px 18px; }

/* ---------------- WHITELIST ---------------- */
.whitelist-list { list-style: none; display: flex; flex-direction: column; gap: 8px; max-width: 480px; margin-top: 16px; }
.whitelist-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}

/* ---------------- BADGES ---------------- */
.badge { padding: 3px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px; }
.badge-ok { background: rgba(245,245,245,0.12); color: var(--white); border: 1px solid var(--border); }
.badge-warn { background: rgba(229,72,77,0.12); color: var(--danger); border: 1px solid rgba(229,72,77,0.4); }

/* ---------------- BAN DETAIL MODAL ---------------- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.modal-box {
    width: 460px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
}
.modal-box h2 { font-size: 16px; margin-bottom: 16px; }
.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
}
.modal-close:hover { color: var(--white); }
.modal-body { display: flex; flex-direction: column; gap: 10px; }
.detail-row { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.detail-key { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-val { font-size: 13px; word-break: break-all; }

/* ---------------- CUSTOM NOTIFY / TOAST RENDSZER ----------------
   Saját, egyedi értesítő rendszer - NEM a böngésző natív alert()/
   confirm()-jét használja. Minden API-hívás után megjelenik egy
   toast, ami a szervertől kapott { success: true/false } válasz
   alapján mutatja, hogy a művelet ténylegesen lefutott-e. */
#toastStack {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 340px;
}
.toast {
    background: var(--panel);
    border: 1px solid var(--border);
    border-left: 3px solid var(--white);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 12.5px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    animation: toast-in 0.18s ease;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.toast-icon { font-size: 15px; flex-shrink: 0; line-height: 1.1; }
.toast-msg { flex: 1; line-height: 1.4; }
.toast.toast-success { border-left-color: #3ecf8e; }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-info { border-left-color: var(--muted); }
.toast.toast-fade { animation: toast-out 0.25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateX(16px); } }

/* ---------------- CUSTOM CONFIRM MODAL (alert()/confirm() helyett) ---------------- */
.confirm-box { width: 380px; }
.confirm-box p { font-size: 13.5px; color: var(--white); margin: 4px 0 20px 0; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.confirm-actions button { padding: 9px 16px; border-radius: 8px; font-size: 12.5px; cursor: pointer; border: 1px solid var(--border); }
.btn-confirm-cancel { background: transparent; color: var(--muted); }
.btn-confirm-cancel:hover { color: var(--white); border-color: var(--white); }
.btn-confirm-ok { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn-confirm-ok:hover { opacity: 0.85; }

/* ---------------- SETTINGS: SZÖVEG / SZÁM / SELECT MEZŐK ----------------
   A boolean kapcsolók mellett (option-card + switch) a teljes
   config.lua-t (Logs webhookok, Preferences üzenetek, Thresholds,
   AntiVPN, WebPanel, stb.) is meg kell tudni jeleníteni és
   szerkeszteni - ezekhez szöveg/szám mezők és egy select (Reputation
   módhoz) kellenek. */
.option-card.option-field { flex-direction: column; align-items: stretch; gap: 8px; }
.option-field .option-name { display: block; }
.option-field input[type="text"],
.option-field input[type="number"],
.option-field input[type="password"],
.option-field textarea,
.option-field select {
    width: 100%;
    padding: 9px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--white);
    font-size: 12.5px;
    font-family: inherit;
}
.option-field textarea { resize: vertical; min-height: 60px; }
.option-hint { font-size: 10.5px; color: var(--muted); }
.option-field .field-row { display: flex; gap: 8px; align-items: center; }
.option-field .btn-save-field {
    padding: 8px 12px;
    background: var(--white);
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}
.option-field .btn-save-field:hover { opacity: 0.85; }

/* ---------------- WHITELIST: ÉSZLELT SCRIPTEK + MÓD KAPCSOLÓ ---------------- */
.whitelist-mode-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    max-width: 560px;
    margin-bottom: 22px;
}
.whitelist-mode-card .option-name { font-size: 13.5px; font-weight: 600; display: block; }
.whitelist-mode-card .option-hint { margin-top: 4px; }

.detected-list { list-style: none; display: flex; flex-direction: column; gap: 6px; max-width: 480px; margin-top: 10px; }
.detected-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12.5px;
}
.detected-list .res-state { font-size: 10px; color: var(--muted); text-transform: uppercase; margin-right: 10px; }
.btn-add-small {
    padding: 5px 10px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--white);
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
}
.btn-add-small:hover { border-color: var(--white); }
.btn-add-small:disabled { opacity: 0.4; cursor: default; }

/* ---------------- ADMINS FÜL ---------------- */
.admins-list { list-style: none; display: flex; flex-direction: column; gap: 8px; max-width: 640px; margin-top: 16px; }
.admins-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12.5px;
    gap: 10px;
}
.admin-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.admin-name { font-weight: 600; }
.admin-identifier { color: var(--muted); font-size: 11px; word-break: break-all; }
.admin-form { display: flex; flex-wrap: wrap; gap: 10px; max-width: 640px; }
.admin-form input { flex: 1; min-width: 200px; }
