/* ============================================================================
   TRINITYRP Portal — "Iris Command"
   Deep blue/violet command surface: void background with a fixed aurora,
   glass panels on hairlines, one signature — the nav beacon.
   Display: Sora · Body: Instrument Sans · Data: JetBrains Mono
   ========================================================================== */

:root {
	--void: #07070f;
	--glass: rgba(148, 142, 255, 0.05);
	--glass-2: rgba(148, 142, 255, 0.09);
	--line: rgba(148, 142, 255, 0.16);
	--line-soft: rgba(148, 142, 255, 0.09);
	--text: #eeedfb;
	--muted: #9a99b5;
	--iris: #7c6cff;
	--iris-2: #a78bff;
	--pulse: #4cc2ff;
	--ok: #3edc97;
	--warn: #ffb347;
	--bad: #ff5c77;
	--r-card: 16px;
	--r-ctl: 10px;
	--font-display: "Sora", "Instrument Sans", sans-serif;
	--font-body: "Instrument Sans", -apple-system, "Segoe UI", sans-serif;
	--font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scrollbar-color: rgba(148, 142, 255, 0.25) transparent; }

body {
	margin: 0;
	background: var(--void);
	color: var(--text);
	font: 400 14.5px/1.55 var(--font-body);
	-webkit-font-smoothing: antialiased;
}

/* The aurora: radial glows anchored to the top of the viewport, plus a faint floor reflection. */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 0;
	background:
		radial-gradient(900px 560px at 12% -10%, rgba(79, 70, 229, 0.30), transparent 68%),
		radial-gradient(820px 520px at 88% -14%, rgba(124, 58, 237, 0.24), transparent 68%),
		radial-gradient(560px 340px at 55% -6%, rgba(76, 194, 255, 0.10), transparent 70%),
		radial-gradient(1100px 460px at 50% 112%, rgba(99, 68, 245, 0.10), transparent 72%);
}

a { color: var(--iris-2); text-decoration: none; }
a:hover { color: #c4b5ff; text-decoration: none; }

:focus-visible {
	outline: 2px solid var(--iris);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ---------------------------------------------------------------- layout */

.layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
	width: 256px;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	padding: 22px 0 18px;
	border-right: 1px solid var(--line-soft);
	background: linear-gradient(180deg, rgba(148, 142, 255, 0.045), rgba(148, 142, 255, 0.015));
	backdrop-filter: blur(20px);
	position: sticky;
	top: 0;
	height: 100vh;
}

.brand {
	display: block;
	padding: 2px 22px 18px;
	font: 700 17px/1.2 var(--font-display);
	letter-spacing: 0.06em;
	color: #fff;
}

.brand span { color: var(--iris-2); }

.brand small {
	display: block;
	margin-top: 3px;
	font: 500 10px/1 var(--font-body);
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--muted);
}

.brand::after {
	content: "";
	display: block;
	margin-top: 16px;
	height: 1px;
	background: linear-gradient(90deg, var(--iris), transparent 80%);
	opacity: 0.55;
}

/* ------------------------------------------------------------ nav beacon */

.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 12px; }

.nav a {
	position: relative;
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 10px 12px;
	border-radius: 10px;
	color: var(--muted);
	font-weight: 500;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.8; }

.nav a:hover { color: var(--text); background: var(--glass); }

/* The beacon: a vertical light bar with a soft halo marks where you are. */
.nav a.active {
	color: #fff;
	background: linear-gradient(90deg, rgba(124, 108, 255, 0.16), rgba(124, 108, 255, 0.03));
}

.nav a.active::before {
	content: "";
	position: absolute;
	left: -12px;
	top: 8px;
	bottom: 8px;
	width: 3px;
	border-radius: 3px;
	background: linear-gradient(180deg, var(--pulse), var(--iris));
	box-shadow: 0 0 12px rgba(124, 108, 255, 0.9);
}

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

.user-card {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
}

.user-avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font: 600 14px var(--font-display);
	color: #fff;
	background: linear-gradient(135deg, var(--iris), var(--iris-2));
}

.user-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--muted); }

.lang-switch {
	display: inline-flex;
	padding: 3px;
	gap: 2px;
	margin-bottom: 12px;
	border: 1px solid var(--line-soft);
	border-radius: 999px;
	background: rgba(7, 7, 15, 0.5);
}

.lang-switch a {
	padding: 4px 12px;
	border-radius: 999px;
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--muted);
}

.lang-switch a.active { background: linear-gradient(135deg, var(--iris), var(--iris-2)); color: #fff; }
.lang-switch a:hover:not(.active) { color: var(--text); }

/* ----------------------------------------------------- mobile top bar */

.mobile-bar { display: none; }
#nav-toggle { display: none; }

/* ---------------------------------------------------------------- content */

.content { flex: 1; min-width: 0; padding: 34px 40px 60px; max-width: 1200px; }

.topbar {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 26px;
}

h1 {
	margin: 0 0 4px;
	font: 700 26px/1.2 var(--font-display);
	letter-spacing: -0.01em;
}

h2 {
	margin: 26px 0 14px;
	font: 600 15px/1.3 var(--font-display);
	letter-spacing: 0.01em;
	color: var(--text);
}

.muted { color: var(--muted); }

/* ---------------------------------------------------------------- cards */

.card {
	position: relative;
	background: var(--glass);
	border: 1px solid var(--line-soft);
	border-radius: var(--r-card);
	padding: 22px;
	margin-bottom: 18px;
	backdrop-filter: blur(14px);
	overflow-x: auto;
}

/* A whisper of light along the top edge — the glass catches the aurora. */
.card::before {
	content: "";
	position: absolute;
	top: 0;
	left: 18px;
	right: 18px;
	height: 1px;
	background: linear-gradient(90deg, transparent, rgba(196, 181, 255, 0.28), transparent);
	pointer-events: none;
}

/* --------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; min-width: 560px; }

th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line-soft); }

tbody tr:last-child td { border-bottom: none; }

tbody tr { transition: background-color 0.12s ease; }
tbody tr:hover { background: rgba(148, 142, 255, 0.04); }

th {
	color: var(--muted);
	font: 600 10.5px/1.4 var(--font-body);
	text-transform: uppercase;
	letter-spacing: 0.12em;
	border-bottom-color: var(--line);
}

td code, .mono { font-family: var(--font-mono); font-size: 12.5px; }

/* -------------------------------------------------------------- buttons */

.btn {
	position: relative;
	background: linear-gradient(135deg, var(--iris) 0%, var(--iris-2) 100%);
	color: #fff;
	border: none;
	padding: 9px 18px;
	border-radius: var(--r-ctl);
	cursor: pointer;
	font: 600 13px var(--font-body);
	letter-spacing: 0.01em;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 16px rgba(124, 108, 255, 0.22);
	transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 6px 20px rgba(124, 108, 255, 0.32); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; filter: none; box-shadow: none; }

.btn.secondary {
	background: var(--glass-2);
	border: 1px solid var(--line);
	color: var(--text);
	box-shadow: none;
}
.btn.secondary:hover { background: rgba(148, 142, 255, 0.14); }

.btn.danger {
	background: linear-gradient(135deg, #f43f5e, #ff5c77);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 4px 16px rgba(255, 92, 119, 0.2);
}

/* ---------------------------------------------------------------- forms */

input, select, textarea {
	background: rgba(7, 7, 15, 0.6);
	border: 1px solid var(--line);
	color: var(--text);
	padding: 9px 12px;
	border-radius: var(--r-ctl);
	font: 400 13.5px var(--font-body);
	width: 100%;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder { color: rgba(154, 153, 181, 0.55); }

input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--iris);
	box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.18);
}

label {
	display: block;
	font: 600 11px/1.4 var(--font-body);
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--muted);
	margin: 12px 0 6px;
}

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

/* ---------------------------------------------------------------- pills */

.pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px;
	border-radius: 999px;
	font: 700 11px var(--font-body);
	letter-spacing: 0.02em;
}

.pill.on { background: rgba(76, 194, 255, 0.12); color: var(--pulse); border: 1px solid rgba(76, 194, 255, 0.3); }
.pill.on::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--pulse); box-shadow: 0 0 8px var(--pulse); }
.pill.off { background: rgba(255, 92, 119, 0.1); color: var(--bad); border: 1px solid rgba(255, 92, 119, 0.25); }
.pill.warnflag { background: rgba(255, 179, 71, 0.12); color: var(--warn); border: 1px solid rgba(255, 179, 71, 0.3); }

/* -------------------------------------------------------------- specials */

.token {
	font-family: var(--font-mono);
	font-size: 13px;
	background: rgba(7, 7, 15, 0.7);
	border: 1px dashed var(--iris);
	box-shadow: 0 0 24px rgba(124, 108, 255, 0.15) inset;
	padding: 12px 14px;
	border-radius: var(--r-ctl);
	word-break: break-all;
}

code {
	font-family: var(--font-mono);
	font-size: 12.5px;
	background: var(--glass-2);
	padding: 1px 7px;
	border-radius: 5px;
}

/* Stat tiles (dashboard) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }

.stat {
	background: var(--glass);
	border: 1px solid var(--line-soft);
	border-radius: var(--r-card);
	padding: 16px 18px;
}

.stat b { display: block; font: 700 26px/1.1 var(--font-display); letter-spacing: -0.01em; color: #fff; }
.stat span { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 920px) {
	.layout { flex-direction: column; }

	.mobile-bar {
		display: flex;
		align-items: center;
		justify-content: space-between;
		position: sticky;
		top: 0;
		z-index: 20;
		padding: 12px 18px;
		background: rgba(7, 7, 15, 0.85);
		backdrop-filter: blur(20px);
		border-bottom: 1px solid var(--line-soft);
	}

	.mobile-bar .brand { padding: 0; }
	.mobile-bar .brand::after { display: none; }

	.nav-burger {
		display: flex;
		flex-direction: column;
		gap: 4px;
		padding: 10px;
		cursor: pointer;
		border-radius: 8px;
	}

	.nav-burger i { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--text); transition: transform 0.2s ease, opacity 0.2s ease; }

	.sidebar { display: none; }

	#nav-toggle:checked ~ .sidebar {
		display: flex;
		position: fixed;
		inset: 49px 0 auto 0;
		height: auto;
		max-height: calc(100vh - 49px);
		width: 100%;
		z-index: 19;
		border-right: none;
		border-bottom: 1px solid var(--line);
		background: rgba(7, 7, 15, 0.96);
		overflow-y: auto;
	}

	#nav-toggle:checked ~ .mobile-bar .nav-burger i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
	#nav-toggle:checked ~ .mobile-bar .nav-burger i:nth-child(2) { opacity: 0; }
	#nav-toggle:checked ~ .mobile-bar .nav-burger i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

	.content { padding: 22px 18px 48px; }
	.topbar { align-items: flex-start; flex-direction: column; }
	h1 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------------- rules editor */

.rules-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.rules-head label { margin-top: 0; }
.rules-status { padding-bottom: 8px; }

.rules-editor {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-top: 6px;
}

.rules-pane { display: flex; flex-direction: column; min-width: 0; }

.rules-pane-label {
	font: 600 10.5px/1.4 var(--font-body);
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--muted);
	margin-bottom: 6px;
}

.rules-editor textarea {
	min-height: 420px;
	resize: vertical;
	font-family: var(--font-mono);
	font-size: 13px;
	line-height: 1.6;
	tab-size: 2;
}

.rules-preview {
	min-height: 420px;
	max-height: 620px;
	overflow-y: auto;
	background: rgba(7, 7, 15, 0.5);
	border: 1px solid var(--line);
	border-radius: var(--r-ctl);
	padding: 18px 22px;
}

/* Rendered-markdown typography — shared feel with the in-game embed. */
.rules-preview h1, .rules-preview h2, .rules-preview h3 {
	font-family: var(--font-display);
	color: #fff;
	letter-spacing: -0.01em;
	margin: 1.1em 0 0.5em;
}
.rules-preview h1 { font-size: 24px; margin-top: 0; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.rules-preview h2 { font-size: 18px; }
.rules-preview h3 { font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--iris-2); }
.rules-preview p { margin: 0.6em 0; color: var(--text); }
.rules-preview ul, .rules-preview ol { margin: 0.6em 0; padding-left: 1.4em; }
.rules-preview li { margin: 0.3em 0; }
.rules-preview li::marker { color: var(--iris-2); }
.rules-preview a { color: var(--iris-2); border-bottom: 1px solid rgba(167, 139, 255, 0.35); }
.rules-preview strong { color: #fff; }
.rules-preview code { background: var(--glass-2); }
.rules-preview blockquote {
	margin: 0.8em 0;
	padding: 4px 16px;
	border-left: 3px solid var(--iris);
	background: rgba(124, 108, 255, 0.06);
	border-radius: 0 8px 8px 0;
	color: var(--muted);
}
.rules-preview hr { border: none; border-top: 1px solid var(--line); margin: 1.2em 0; }
.rules-preview table { min-width: 0; margin: 0.8em 0; }
.rules-preview th, .rules-preview td { border: 1px solid var(--line-soft); padding: 7px 10px; }

.rules-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

.rules-flash {
	margin-top: 16px;
	padding: 10px 14px;
	border-radius: var(--r-ctl);
	background: rgba(62, 220, 151, 0.1);
	border: 1px solid rgba(62, 220, 151, 0.3);
	color: var(--ok);
	font-size: 13px;
}

/* Deployment picker */
.server-picker { display: flex; flex-direction: column; gap: 8px; }

.server-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 11px 14px;
	border-radius: var(--r-ctl);
	background: var(--glass);
	border: 1px solid var(--line-soft);
	cursor: pointer;
	text-transform: none;
	letter-spacing: 0;
	font-size: 14px;
	transition: background 0.12s ease, border-color 0.12s ease;
}
.server-row:hover { background: var(--glass-2); }
.server-row.picked { border-color: var(--iris); background: rgba(124, 108, 255, 0.08); }
.server-row input { width: auto; margin: 0; }
.server-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.server-dot.online { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.server-dot.offline { background: var(--muted); opacity: 0.5; }
.server-name { color: var(--text); font-weight: 600; }
.server-state { margin-left: auto; font-size: 12px; }

@media (max-width: 820px) {
	.rules-editor { grid-template-columns: 1fr; }
	.rules-editor textarea { min-height: 260px; }
	.rules-preview { min-height: 200px; }
}
