/* NexusGuild Staff Portal — Dark Theme */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #1e1f22;
    --bg-elevated: #2b2d31;
    --bg-hover:    #35373c;
    --bg-active:   #404249;
    --accent:      #5865f2;
    --accent-hover:#4752c4;
    --danger:      #ed4245;
    --success:     #3ba55c;
    --warning:     #faa61a;
    --text:        #dbdee1;
    --text-muted:  #80848e;
    --border:      #3f4147;
    --sidebar-w:   220px;
    --topbar-h:    52px;

    /* Role colors */
    --role-owner:      #f0b232;
    --role-superadmin: #9b59b6;
    --role-moderator:  #5865f2;
    --role-viewer:     #80848e;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

/* ─── Login ──────────────────────────────────────────────────────────────── */

.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg);
}

.login-card {
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 40px 32px;
    width: 380px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 4px;
}

.login-logo-icon {
    font-size: 24px;
    color: var(--accent);
}

.login-logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.login-card h2 {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.login-error {
    background: rgba(237,66,69,0.15);
    border: 1px solid var(--danger);
    border-radius: 4px;
    color: var(--danger);
    padding: 8px 12px;
    font-size: 13px;
}

.login-card input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    padding: 10px 12px;
    font-size: 14px;
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}

.login-card input:focus { border-color: var(--accent); }

.login-card button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 11px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 4px;
    transition: background 0.15s;
}

.login-card button:hover { background: var(--accent-hover); }

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.main-app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
    height: var(--topbar-h);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    z-index: 10;
}

.topbar-brand { display: flex; align-items: center; gap: 10px; }

.topbar-icon { font-size: 18px; color: var(--accent); }

.topbar-title { font-size: 15px; font-weight: 700; color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-username { color: var(--text-muted); font-size: 13px; }

.layout { display: flex; flex: 1; overflow: hidden; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    overflow-y: auto;
    padding: 12px 8px;
}

.nav-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.1s, color 0.1s;
    user-select: none;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-active); color: var(--text); }

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 4px;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn, button.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s, opacity 0.15s;
    text-decoration: none;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.85; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.85; }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ─── Stats cards ────────────────────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border);
}

.stat-card .stat-label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--text); }

/* ─── Tables ─────────────────────────────────────────────────────────────── */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.section-header h2 { font-size: 18px; font-weight: 700; }

.search-bar {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-bar input {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    padding: 7px 12px;
    font-size: 13px;
    outline: none;
    width: 220px;
    transition: border-color 0.15s;
}
.search-bar input:focus { border-color: var(--accent); }

.table-wrap {
    background: var(--bg-elevated);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text);
    vertical-align: middle;
}

.cell-muted { color: var(--text-muted); }
.cell-mono  { font-family: monospace; font-size: 12px; }

.actions-cell { display: flex; gap: 6px; }

/* ─── Role badges ────────────────────────────────────────────────────────── */

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.role-badge.owner      { background: rgba(240,178,50,0.15); color: var(--role-owner); }
.role-badge.superadmin { background: rgba(155,89,182,0.15); color: var(--role-superadmin); }
.role-badge.moderator  { background: rgba(88,101,242,0.15); color: var(--role-moderator); }
.role-badge.viewer     { background: rgba(128,132,142,0.15); color: var(--role-viewer); }

.ban-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(237,66,69,0.15);
    color: var(--danger);
}

/* ─── Pagination ─────────────────────────────────────────────────────────── */

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

.pagination button {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.1s;
}
.pagination button:hover:not(:disabled) { background: var(--bg-hover); }
.pagination button:disabled { opacity: 0.4; cursor: default; }
.pagination .page-info { color: var(--text-muted); font-size: 13px; }

/* ─── Detail cards ───────────────────────────────────────────────────────── */

.detail-card {
    background: var(--bg-elevated);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 20px;
}

.detail-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }

.detail-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 16px;
}

.detail-label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; align-self: center; }
.detail-value { font-size: 14px; color: var(--text); }

.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* ─── Ascension nodes form ───────────────────────────────────────────────── */

.node-inactive { opacity: 0.45; }

.asc-section { margin-bottom: 32px; }
.asc-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: var(--bg-elevated);
    border-radius: 8px;
    width: 460px;
    max-width: 96vw;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    border: 1px solid var(--border);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: background 0.1s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-confirm-text { color: var(--text); font-size: 14px; line-height: 1.6; }

.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    padding: 9px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
    resize: vertical;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: var(--accent); }

.form-field select option { background: var(--bg-elevated); }

/* ─── Toast ──────────────────────────────────────────────────────────────── */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    min-width: 240px;
    max-width: 360px;
    animation: toast-in 0.2s ease;
    border-left: 3px solid var(--success);
}

.toast.error { border-left-color: var(--danger); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Misc ───────────────────────────────────────────────────────────────── */

.loading { color: var(--text-muted); padding: 40px; text-align: center; font-size: 15px; }

.back-link {
    color: var(--accent);
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 16px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}
.back-link:hover { text-decoration: underline; }

.empty-state { color: var(--text-muted); padding: 32px; text-align: center; }

.inline-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
