/* ── AddFriendsSheet ─────────────────────────────────────────────────
   Tabbed bottom sheet reached from the "Add Friends" button in the
   DM sidebar. Two tabs — Add (username input + pending strangers) and
   Ignored Friends (review / unignore). Mirrors the chrome we already
   use in MobileServerSettings and ChannelDetailsDrawer so both
   settings surfaces feel consistent. */

.root {
	display: flex;
	flex-direction: column;
	height: 100%;
}

/* ── Top bar (drag handle + title + close) ───────────────────────── */

.topBar {
	position: relative;
	flex-shrink: 0;
	display: grid;
	grid-template-columns: 48px 1fr 48px;
	align-items: center;
	height: 56px;
	padding: 0 8px;
	border-bottom: 1px solid var(--background-header-secondary);
}

.topBarTitle {
	font-size: 17px;
	font-weight: 700;
	color: var(--text-primary);
	text-align: center;
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.topBarButton {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	background: transparent;
	color: var(--text-primary);
	cursor: pointer;
	transition: background-color 0.15s;
	-webkit-tap-highlight-color: transparent;
	margin: 0 auto;
}

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

/* ── Tabs (Add / Ignored Friends) ─────────────────────────────────── */

.tabBar {
	position: relative;
	display: flex;
	align-items: stretch;
	padding: 0;
	border-bottom: 1px solid var(--background-header-secondary);
	flex-shrink: 0;
}

.tabButton {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 14px 8px;
	background: none;
	border: none;
	color: var(--text-secondary, var(--text-primary-muted));
	cursor: pointer;
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	transition: color 0.15s;
	-webkit-tap-highlight-color: transparent;
}

.tabButtonActive {
	color: var(--brand-primary-light);
}

/* Active tab underline — 2px bar overlapping the row divider. */
.tabButtonActive::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 2px;
	background-color: var(--brand-primary-light);
	border-radius: 2px 2px 0 0;
}

.tabBadge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 999px;
	background-color: hsl(0, calc(80% * var(--saturation-factor)), 55%);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

/* ── Body (scrolling area) ────────────────────────────────────────── */

.body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 16px;
}

/* ── Username input row (Add tab) ────────────────────────────────── */

.usernameRow {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 20px;
}

.usernameInput {
	width: 100%;
	padding: 14px 16px;
	background-color: var(--background-secondary-alt);
	border: 1px solid transparent;
	border-radius: 0.75rem;
	color: var(--text-primary);
	font: inherit;
	font-size: 15px;
	font-weight: 500;
	outline: none;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
	box-sizing: border-box;
}

.usernameInput:focus,
.usernameInput:focus-visible {
	outline: none;
	border-color: var(--brand-primary);
}

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

.primaryButton {
	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;
}

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

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

/* ── Error / status banners ───────────────────────────────────────── */

.statusError {
	padding: 10px 14px;
	border-radius: 8px;
	background-color: hsl(0, calc(60% * var(--saturation-factor)), 22%);
	color: hsl(0, calc(80% * var(--saturation-factor)), 85%);
	font-size: 13px;
	margin-top: 4px;
}

.statusSuccess {
	padding: 10px 14px;
	border-radius: 8px;
	background-color: hsl(139, calc(47.3% * var(--saturation-factor)), 20%);
	color: hsl(139, calc(47.3% * var(--saturation-factor)), 85%);
	font-size: 13px;
	margin-top: 4px;
}

/* ── Section label ────────────────────────────────────────────────── */

.sectionLabel {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-primary-muted);
	padding: 0 4px 8px;
}

/* ── Row list (pending + ignored) ────────────────────────────────── */

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

.row {
	position: relative;
	display: grid;
	grid-template-columns: 40px 1fr auto;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
}

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

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

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

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

.rowActions {
	display: flex;
	align-items: center;
	gap: 6px;
}

.pillButton {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px 12px;
	border: none;
	border-radius: 999px;
	background-color: var(--background-secondary);
	color: var(--text-primary);
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	cursor: pointer;
	transition: filter 0.15s;
	-webkit-tap-highlight-color: transparent;
}

.pillButton:active:not(:disabled) {
	filter: brightness(1.2);
}

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

.pillButtonPrimary {
	background-color: var(--brand-primary);
	color: #fff;
}

.pillButtonDanger {
	background-color: transparent;
	color: hsl(350, calc(90% * var(--saturation-factor)), 65%);
	border: 1px solid hsla(350, calc(90% * var(--saturation-factor)), 65%, 0.35);
}

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

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