/* ── Mobile Roles tab ────────────────────────────────────────────────
   Full-screen Fluxer-style layout. Both the list view and the role
   editor sit inside the existing MobileServerSettings body area and
   share the `--background-primary` page surface.

   Cards use `--background-secondary` as a distinct raised surface
   (same treatment the You page uses), with inset dividers in
   `--background-header-secondary`. */

.root {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 0;
}

/* ── Search input ───────────────────────────────────────────────────*/

.searchBar {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 40px;
	padding: 0 2.25rem 0 2.25rem;
	border-radius: 8px;
	background-color: var(--background-secondary);
	flex-shrink: 0;
}

.searchIcon {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--text-tertiary);
	pointer-events: none;
}

.searchInput {
	flex: 1;
	background: transparent;
	border: none;
	outline: none;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
	padding: 10px 0;
	font: inherit;
	font-size: 15px;
	color: var(--text-primary);
}

.searchInput:focus,
.searchInput:focus-visible {
	outline: none;
	box-shadow: none;
}

.searchInput::placeholder {
	color: var(--text-tertiary-muted, var(--text-tertiary));
}

/* ── Helper text between search and everyone card ──────────────────*/

.helperText {
	font-size: 13px;
	color: var(--text-primary-muted);
	line-height: 1.4;
	padding: 0 4px;
}

/* ── @everyone single-item card ────────────────────────────────────*/

.everyoneCard {
	background-color: var(--background-secondary);
	border-radius: 0.75rem;
	overflow: hidden;
}

/* ── "Roles — N" section header row ────────────────────────────────*/

.rolesHeader {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 4px 4px;
}

.rolesHeaderTitle {
	font-size: 13px;
	font-weight: 700;
	color: var(--text-primary);
}

.rolesHeaderCreate {
	display: flex;
	align-items: center;
	gap: 4px;
	background: transparent;
	border: none;
	color: var(--brand-primary-light);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 6px;
	-webkit-tap-highlight-color: transparent;
}

.rolesHeaderCreate:disabled {
	opacity: 0.5;
	cursor: default;
}

/* ── Roles list card ───────────────────────────────────────────────*/

.rolesCard {
	background-color: var(--background-secondary);
	border-radius: 0.75rem;
	overflow: hidden;
}

.roleRow {
	position: relative;
	display: grid;
	grid-template-columns: 36px 1fr auto;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 14px 16px;
	background: transparent;
	border: none;
	color: var(--text-primary);
	font: inherit;
	text-align: left;
	cursor: pointer;
	transition: background-color 0.1s;
	-webkit-tap-highlight-color: transparent;
}

.roleRow:active {
	background-color: var(--background-modifier-hover);
}

.roleRow:not(:last-child)::after {
	content: '';
	position: absolute;
	left: calc(16px + 36px + 12px);
	right: 16px;
	bottom: 0;
	height: 1px;
	background-color: var(--background-header-secondary);
	pointer-events: none;
}

.roleAvatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: var(--background-secondary-alt);
	flex-shrink: 0;
}

/* Small colored dot sitting inside the circle avatar — shows the
   role color even when no icon is attached. */
.roleAvatarDot {
	width: 18px;
	height: 18px;
	border-radius: 50%;
}

.roleRowText {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.roleRowName {
	font-size: 15px;
	font-weight: 600;
	color: var(--text-primary);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.roleRowSubtitle {
	font-size: 12px;
	color: var(--text-primary-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.roleRowCaret {
	color: var(--text-primary-muted);
}

/* ── Empty state ───────────────────────────────────────────────────*/

.emptyState {
	padding: 24px;
	text-align: center;
	color: var(--text-primary-muted);
	font-size: 14px;
}

.error {
	padding: 12px 16px;
	background-color: hsl(0, calc(60% * var(--saturation-factor)), 20%);
	color: hsl(0, calc(80% * var(--saturation-factor)), 85%);
	border-radius: 0.5rem;
	font-size: 13px;
}

.gate {
	padding: 32px 16px;
	text-align: center;
}

.gateTitle {
	font-size: 18px;
	font-weight: 700;
	color: var(--text-primary);
	margin: 0 0 8px;
}

.gateBody {
	font-size: 14px;
	color: var(--text-primary-muted);
	margin: 0;
}

/* ── Editor view ───────────────────────────────────────────────────*/

.editorRoot {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.fieldLabel {
	font-size: 13px;
	font-weight: 500;
	color: var(--text-primary-muted);
	padding: 0 4px 6px;
}

/* Single-row input card (role name textbox wrapped in a rounded
   --background-secondary surface). */
.inputCard {
	background-color: var(--background-secondary);
	border-radius: 0.75rem;
	padding: 14px 16px;
	display: flex;
	align-items: center;
}

.inputCard input {
	flex: 1;
	background: transparent;
	border: none;
	outline: none;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	color: var(--text-primary);
}

.inputCard input:focus,
.inputCard input:focus-visible {
	outline: none;
	box-shadow: none;
}

.inputCard input::placeholder {
	color: var(--text-tertiary-muted, var(--text-tertiary));
}

/* Grouped card with multiple rows (Role Color, Power Level, etc). */
.groupCard {
	background-color: var(--background-secondary);
	border-radius: 0.75rem;
	overflow: hidden;
}

.groupRow {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
}

.groupRow:not(:last-child)::after {
	content: '';
	position: absolute;
	left: 16px;
	right: 16px;
	bottom: 0;
	height: 1px;
	background-color: var(--background-header-secondary);
	pointer-events: none;
}

.groupRowLeft {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1;
}

.groupRowLabel {
	font-size: 15px;
	font-weight: 700;
	color: var(--text-primary);
}

.groupRowSublabel {
	font-size: 12px;
	color: var(--text-primary-muted);
}

.colorPreview {
	width: 22px;
	height: 22px;
	border-radius: 6px;
	flex-shrink: 0;
}

/* Stacked row (row + content below it, for swatches / slider) */
.stackedRow {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 14px 16px;
}

.stackedRow:not(:last-child)::after {
	content: '';
	position: absolute;
	left: 16px;
	right: 16px;
	bottom: 0;
	height: 1px;
	background-color: var(--background-header-secondary);
	pointer-events: none;
}

.swatchRow {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.swatch {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 2px solid transparent;
	cursor: pointer;
	transition: transform 0.1s, border-color 0.1s;
	-webkit-tap-highlight-color: transparent;
	padding: 0;
}

.swatchActive {
	border-color: #fff;
}

.swatchNone {
	background-color: var(--background-secondary-alt);
	color: var(--text-primary-muted);
	display: flex;
	align-items: center;
	justify-content: center;
}

.hexInput {
	margin-top: 4px;
	background: var(--background-secondary-alt);
	border: none;
	outline: none;
	padding: 8px 10px;
	border-radius: 6px;
	color: var(--text-primary);
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 13px;
}

.powerHeader {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.powerValue {
	font-size: 15px;
	font-weight: 700;
	color: var(--brand-primary-light);
}

.slider {
	width: 100%;
	accent-color: var(--brand-primary-light);
}

.powerHint {
	font-size: 12px;
	color: var(--text-primary-muted);
	margin: 0;
	line-height: 1.4;
}

/* ── Abilities readout ─────────────────────────────────────────────*/

.abilities {
	background-color: var(--background-secondary);
	border-radius: 0.75rem;
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.abilitiesHeader {
	font-size: 13px;
	color: var(--text-primary-muted);
}

.abilitiesList {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr;
	gap: 6px;
}

.abilitiesList li {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
}

.abilityOn {
	color: var(--text-primary);
}

.abilityOn svg {
	color: hsl(139, calc(47.3% * var(--saturation-factor)), 43.9%);
}

.abilityOff {
	color: var(--text-primary-muted);
}

.abilityOff svg {
	color: var(--text-primary-muted);
	opacity: 0.6;
}

/* ── Delete button ─────────────────────────────────────────────────*/

.deleteCard {
	background-color: var(--background-secondary);
	border-radius: 0.75rem;
	overflow: hidden;
}

.deleteButton {
	width: 100%;
	padding: 16px;
	background: transparent;
	border: none;
	color: hsl(350, calc(90% * var(--saturation-factor)), 65%);
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	text-align: center;
	-webkit-tap-highlight-color: transparent;
}

.deleteButton:active {
	background-color: var(--background-modifier-hover);
}

/* ── Save status strip ─────────────────────────────────────────────*/

.status {
	padding: 10px 14px;
	border-radius: 0.5rem;
	font-size: 13px;
}

.statusSuccess {
	background-color: hsl(139, calc(47.3% * var(--saturation-factor)), 20%);
	color: hsl(139, calc(47.3% * var(--saturation-factor)), 85%);
}

.statusError {
	background-color: hsl(0, calc(60% * var(--saturation-factor)), 22%);
	color: hsl(0, calc(80% * var(--saturation-factor)), 85%);
}

.saveButton {
	width: 100%;
	padding: 14px 16px;
	background-color: var(--brand-primary);
	border: none;
	border-radius: 0.75rem;
	color: #fff;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition: filter 0.15s;
	-webkit-tap-highlight-color: transparent;
}

.saveButton:active:not(:disabled) {
	filter: brightness(0.92);
}

.saveButton:disabled {
	opacity: 0.5;
	cursor: default;
}
