@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700;800&display=swap');

:root {
	--bg: #06070d;
	--bg-elevated: #0a0c18;
	--surface: #12142a;
	--surface-2: #191c33;
	--border: rgba(139, 63, 245, 0.28);
	--border-soft: rgba(139, 63, 245, 0.16);
	--text: #e7e9f5;
	--text-muted: #9aa0c2;
	--text-faint: #6b7093;
	--accent: #8b3ff5;
	--accent-hover: #a568ff;
	--accent-soft: rgba(139, 63, 245, 0.18);
	--ns-cyan: #22d3ee;
	--ns-blue: #3f6bf5;
	--ns-gradient: linear-gradient(90deg, #8b3ff5, #3f6bf5 55%, #22d3ee);
	--success: #34d399;
	--success-soft: rgba(52, 211, 153, 0.14);
	--warning: #fbbf24;
	--warning-soft: rgba(251, 191, 36, 0.14);
	--danger: #f76b6b;
	--danger-soft: rgba(247, 107, 107, 0.14);
	--radius: 14px;
	--radius-sm: 10px;
	--shadow: 0 10px 32px rgba(0, 0, 0, 0.5);
	--font: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
	--font-display: 'Rajdhani', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	min-height: 100%;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: 14px;
	-webkit-font-smoothing: antialiased;
}

body {
	background:
		radial-gradient(circle at 15% 15%, rgba(139, 63, 245, 0.16), transparent 45%),
		radial-gradient(circle at 85% 25%, rgba(34, 211, 238, 0.10), transparent 50%),
		radial-gradient(circle at 50% 95%, rgba(63, 107, 245, 0.14), transparent 55%),
		var(--bg);
	background-attachment: fixed;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; letter-spacing: 0.01em; }
p { margin: 0; }
.muted { color: var(--text-muted); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
	width: 240px;
	flex-shrink: 0;
	background: var(--bg-elevated);
	border-right: 1px solid var(--border-soft);
	display: flex;
	flex-direction: column;
	padding: 18px 14px;
	position: sticky;
	top: 0;
	height: 100vh;
}

.sidebar-brand {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 6px 8px 18px;
}
.brand-badge {
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	display: block;
	object-fit: cover;
	border-radius: 11px;
	box-shadow: 0 0 22px rgba(139, 63, 245, 0.55), 0 0 44px rgba(34, 211, 238, 0.18);
}
.brand-text-group { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text {
	font-family: var(--font-display);
	font-weight: 800;
	font-size: 16px;
	letter-spacing: 0.06em;
	background: var(--ns-gradient);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}
.brand-sub { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }

/* Status card */
.status-card {
	background: var(--surface);
	border: 1px solid var(--border-soft);
	border-radius: var(--radius-sm);
	padding: 12px 14px;
	margin-bottom: 18px;
}
.status-card-row { display: flex; align-items: center; gap: 8px; }
.status-card-label { font-weight: 650; font-size: 13px; }
.status-card-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; padding-left: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.status-dot.online { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); animation: pulse-dot 2s ease-in-out infinite; }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.status-dot.pending { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); animation: pulse-dot-amber 1s ease-in-out infinite; }
@keyframes pulse-dot {
	0%, 100% { box-shadow: 0 0 0 3px var(--success-soft); }
	50% { box-shadow: 0 0 0 5px var(--success-soft); }
}
@keyframes pulse-dot-amber {
	0%, 100% { box-shadow: 0 0 0 3px var(--warning-soft); }
	50% { box-shadow: 0 0 0 5px var(--warning-soft); }
}

/* Process controls (Start/Restart/Stop) */
.process-controls { display: flex; gap: 8px; margin-top: 12px; }
.proc-btn {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 32px;
	border-radius: 8px;
	border: 1px solid transparent;
	cursor: pointer;
	font-size: 13px;
	font-weight: 700;
	color: white;
	transition: filter 0.12s, opacity 0.12s;
}
.proc-btn:hover:not(:disabled) { filter: brightness(1.1); }
.proc-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.proc-btn-start { background: var(--success); }
.proc-btn-restart { background: var(--warning); color: #1a1400; }
.proc-btn-stop { background: var(--danger); }

/* Nav */
.sidebar-nav { display: flex; flex-direction: column; gap: 16px; flex: 1; overflow-y: auto; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label {
	font-size: 10.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--text-faint);
	padding: 0 10px 6px;
}

.nav-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border: none;
	border-left: 3px solid transparent;
	background: transparent;
	color: var(--text-muted);
	border-radius: var(--radius-sm);
	cursor: pointer;
	text-align: left;
	font-weight: 600;
	font-size: 13.5px;
	transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active {
	background: linear-gradient(90deg, var(--accent-soft), transparent);
	color: #fff;
	border-left-color: var(--ns-cyan);
}
.nav-item.active .nav-icon { filter: none; opacity: 1; }

.nav-icon {
	font-size: 13.5px;
	width: 26px;
	height: 26px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	opacity: 0.9;
}
.icon-blue { background: rgba(96, 165, 250, 0.16); }
.icon-teal { background: rgba(45, 212, 191, 0.16); }
.icon-purple { background: rgba(167, 139, 250, 0.16); }
.icon-amber { background: rgba(251, 191, 36, 0.16); }
.icon-green { background: rgba(52, 211, 153, 0.16); }
.icon-red { background: rgba(247, 107, 107, 0.16); }
.icon-slate { background: rgba(148, 163, 184, 0.16); }

/* Footer / profile */
.sidebar-footer { padding-top: 14px; border-top: 1px solid var(--border-soft); }
.profile-pill {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px;
	border-radius: var(--radius-sm);
	background: var(--surface);
	border: 1px solid var(--border-soft);
}
.profile-avatar {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--ns-gradient);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 12.5px;
	flex-shrink: 0;
	color: white;
}
.profile-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.profile-name { font-size: 13px; font-weight: 650; }
.profile-role { font-size: 11px; color: var(--text-faint); }
.profile-logout {
	background: transparent;
	border: none;
	color: var(--text-muted);
	font-size: 15px;
	cursor: pointer;
	width: 26px;
	height: 26px;
	border-radius: 6px;
	flex-shrink: 0;
	transition: background 0.12s, color 0.12s;
}
.profile-logout:hover { background: var(--danger-soft); color: var(--danger); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 18px 28px;
	border-bottom: 1px solid var(--border-soft);
	position: sticky;
	top: 0;
	background: rgba(6, 7, 13, 0.85);
	backdrop-filter: blur(8px);
	z-index: 5;
}
.topbar h2 { font-size: 19px; flex: 1; }
.mobile-nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }

.topbar-guild { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.topbar-guild img { width: 24px; height: 24px; border-radius: 50%; }

.content { padding: 24px 28px 60px; max-width: 1200px; width: 100%; margin: 0 auto; }

.page { display: none; }
.page.active { display: block; animation: fadein 0.18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Stat grid ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
	background: var(--surface);
	border: 1px solid var(--border-soft);
	border-radius: var(--radius);
	padding: 16px 18px;
	display: flex;
	align-items: center;
	gap: 14px;
	transition: transform 0.12s, border-color 0.12s;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--ns-cyan); box-shadow: 0 0 20px rgba(34, 211, 238, 0.15); }
.stat-icon {
	width: 42px;
	height: 42px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 19px;
	border-radius: 12px;
}
.stat-card-body { min-width: 0; }
.stat-card .stat-value { font-size: 24px; font-weight: 750; line-height: 1.15; }
.stat-card .stat-label { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ---------- Cards ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
.card-body { padding: 18px; }
.danger-card { border-color: rgba(247, 107, 107, 0.35); }

.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Toolbar / tabs ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border-soft); padding: 4px; border-radius: var(--radius-sm); }
.tab { border: none; background: transparent; color: var(--text-muted); padding: 7px 14px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.tab.active { background: var(--ns-gradient); color: white; }

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	padding: 9px 16px;
	font-weight: 600;
	cursor: pointer;
	transition: filter 0.12s, background 0.12s, transform 0.05s;
	white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--ns-gradient); color: white; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); box-shadow: 0 0 18px rgba(34, 211, 238, 0.35); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--ns-cyan); box-shadow: 0 0 14px rgba(34, 211, 238, 0.2); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface); color: var(--text); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
input[type="text"], input[type="password"], input[type="number"], select {
	background: var(--surface-2);
	border: 1px solid var(--border);
	color: var(--text);
	border-radius: var(--radius-sm);
	padding: 9px 12px;
	outline: none;
	transition: border-color 0.12s;
}
input:focus, select:focus { border-color: var(--accent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 16px) center, calc(100% - 11px) center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
select[multiple] { appearance: auto; background-image: none; padding: 4px; }
select[multiple] option { padding: 6px 8px; border-radius: 4px; }
.form-grid { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.checkbox-field input { width: 16px; height: 16px; }

.settings-form { display: flex; flex-direction: column; gap: 16px; }
.settings-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 12px; align-items: end; padding-bottom: 14px; border-bottom: 1px solid var(--border-soft); }
.settings-row:last-child { border-bottom: none; padding-bottom: 0; }
.settings-row .field-label { font-size: 13px; color: var(--text); }
.settings-row .field-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: left; padding: 12px 16px; color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid var(--border-soft); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255, 255, 255, 0.015); }
.empty-state { padding: 32px; text-align: center; color: var(--text-faint); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.badge-open { background: var(--success-soft); color: var(--success); }
.badge-closed { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge-priority-low { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge-priority-normal { background: var(--accent-soft); color: var(--accent-hover); }
.badge-priority-high { background: var(--warning-soft); color: var(--warning); }
.badge-priority-urgent { background: var(--danger-soft); color: var(--danger); }

/* ---------- Mini lists (leaderboard, activity feed) ---------- */
.mini-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.mini-row:last-child { border-bottom: none; }
.mini-row-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mini-row-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row-count { color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* ---------- Avatars ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); object-fit: cover; }

/* ---------- Search ---------- */
.search-row { position: relative; margin-bottom: 16px; }
.search-row input { width: 100%; max-width: 340px; }
.search-results { position: absolute; top: 100%; left: 0; margin-top: 4px; width: 340px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); z-index: 10; overflow: hidden; display: none; }
.search-results.open { display: block; }
.search-result-item { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; }
.search-result-item:hover { background: var(--surface); }
.search-result-item img { width: 24px; height: 24px; border-radius: 50%; }

.staff-detail { margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--border-soft); }
.staff-detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.staff-detail-name { font-weight: 700; font-size: 15px; }
.staff-detail-id { font-size: 12px; }
.staff-detail-header .btn { margin-left: auto; }

/* ---------- Console ---------- */
.console-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.console-output {
	background: #08090e;
	font-family: 'Cascadia Code', 'Consolas', 'SF Mono', Menlo, monospace;
	font-size: 12.5px;
	line-height: 1.65;
	padding: 16px 18px;
	height: 560px;
	overflow-y: auto;
	white-space: pre-wrap;
	word-break: break-word;
}
.console-line { display: flex; gap: 10px; }
.console-line .ts { color: var(--text-faint); flex-shrink: 0; user-select: none; }
.console-line .lvl { flex-shrink: 0; width: 46px; font-weight: 700; user-select: none; }
.console-line .msg { flex: 1; min-width: 0; }
.console-line.lvl-info .lvl { color: var(--accent-hover); }
.console-line.lvl-warn .lvl, .console-line.lvl-warn .msg { color: var(--warning); }
.console-line.lvl-error .lvl, .console-line.lvl-error .msg { color: var(--danger); }
.console-line.lvl-system .lvl, .console-line.lvl-system .msg { color: var(--text-faint); font-style: italic; }
.console-empty { color: var(--text-faint); padding: 4px 0; }

/* ---------- Result box (FiveM output) ---------- */
.result-box { margin-top: 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 13px; max-height: 340px; overflow-y: auto; }
.result-box.error { border-color: rgba(247, 107, 107, 0.4); color: var(--danger); }
.result-kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
.result-kv div:nth-child(odd) { color: var(--text-muted); }

/* ---------- Toasts ---------- */
.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
.toast { min-width: 260px; max-width: 360px; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow); font-size: 13px; animation: toastin 0.18s ease; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes toastin { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(5, 6, 10, 0.6); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 20px; }
.modal { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 460px; box-shadow: var(--shadow); animation: modalin 0.15s ease; max-height: 90vh; overflow-y: auto; }
@keyframes modalin { from { opacity: 0; transform: scale(0.97) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border-soft); }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 14px 18px; border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Ticket detail modal specifics ---------- */
.ticket-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; font-size: 13px; }
.ticket-meta div:nth-child(odd) { color: var(--text-muted); }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Login page ---------- */
.login-body {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	background:
		radial-gradient(circle at 20% 20%, rgba(139, 63, 245, 0.28), transparent 45%),
		radial-gradient(circle at 80% 30%, rgba(34, 211, 238, 0.16), transparent 50%),
		radial-gradient(circle at 50% 90%, rgba(63, 107, 245, 0.2), transparent 55%),
		var(--bg);
}
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow); }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-logo {
	width: 84px;
	height: 84px;
	border-radius: 20px;
	margin-bottom: 14px;
	box-shadow: 0 0 40px rgba(139, 63, 245, 0.5), 0 0 80px rgba(34, 211, 238, 0.15);
}
.login-brand h1 {
	font-family: var(--font-display);
	font-size: 24px;
	font-weight: 800;
	letter-spacing: 0.06em;
	margin-bottom: 6px;
	background: var(--ns-gradient);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}
.login-brand p { color: var(--text-muted); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-error { color: var(--danger); font-size: 13px; text-align: center; }

/* ---------- Loading ---------- */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); border-top-color: white; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row td { text-align: center; padding: 30px; color: var(--text-faint); }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #363c56; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	.sidebar { position: fixed; left: -260px; top: 0; bottom: 0; z-index: 100; transition: left 0.2s ease; box-shadow: var(--shadow); }
	.sidebar.open { left: 0; }
	.mobile-nav-toggle { display: block; }
	.content { padding: 18px; }
	.settings-row { grid-template-columns: 1fr; }
}
