/*
 * Manager-only User Management screen styling. Depends on
 * hsi-portal-shell.css for design tokens (see wp_register_style() deps in
 * class-hsi-portal-user-management-render.php).
 */

.hsi-user-mgmt {
	width: 100%;
}

.hsi-user-mgmt__banner {
	padding: var(--hsi-space-3) var(--hsi-space-4);
	margin-bottom: var(--hsi-space-4);
	border-radius: var(--hsi-radius);
	border: 1px solid transparent;
}

.hsi-user-mgmt__banner--success {
	background: var(--hsi-blue-tint);
	border-color: var(--hsi-blue);
	color: #0c2e4e;
}

.hsi-user-mgmt__banner--error {
	background: var(--hsi-red-tint);
	border-color: var(--hsi-red);
	color: #611a15;
}

.hsi-user-mgmt__banner ul {
	margin: 0.5em 0 0;
	padding-left: 1.25em;
}

.hsi-user-mgmt__api-error {
	font-family: monospace;
	white-space: pre-wrap;
	word-break: break-word;
}

.hsi-user-mgmt__table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: var(--hsi-space-6);
}

@media (max-width: 720px) {
	.hsi-user-mgmt__table {
		display: block;
		overflow-x: auto;
	}
}

.hsi-user-mgmt__table th,
.hsi-user-mgmt__table td {
	text-align: left;
	padding: var(--hsi-space-2) var(--hsi-space-3);
	border-bottom: 1px solid var(--hsi-neutral-tint);
}

.hsi-user-mgmt__table td:last-child a {
	font-weight: 600;
	color: var(--hsi-blue);
	text-decoration: none;
}

.hsi-user-mgmt__table td:last-child a:hover {
	text-decoration: underline;
}

.hsi-user-mgmt__status {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 0.78em;
	font-weight: 700;
}

.hsi-user-mgmt__status--active {
	background: var(--hsi-blue-tint);
	color: #0c2e4e;
}

.hsi-user-mgmt__status--inactive {
	background: var(--hsi-neutral-tint);
	color: #555;
}

.hsi-user-mgmt__instruction {
	margin: 0 0 var(--hsi-space-4);
	font-size: 0.9em;
}

.hsi-user-mgmt__form {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 var(--hsi-space-4);
	max-width: var(--hsi-form-max);
	width:100%;
}

.hsi-user-mgmt__field {
	margin-bottom: var(--hsi-space-4);
	min-width: 0;
}

.hsi-user-mgmt__field label {
	display: block;
	font-weight: 600;
	margin-bottom: var(--hsi-space-1);
	/* Client-specified (2026-08-06). */
	text-align: left;
}

.hsi-user-mgmt__field input[type='text'],
.hsi-user-mgmt__field input[type='email'] {
	width: 100%;
	max-width: 100%;
}

/*
 * Item 2 (styling pass): .hsi-user-mgmt__field--checkboxes (Roles) is
 * deliberately NOT in this full-span list anymore — it now sits in Row 3's
 * right column next to Email instead of spanning the whole form width (see
 * templates/partials/user-management.php). It keeps the same fieldset
 * reset (border/padding/margin/min-width) via the shared rule just below.
 */
.hsi-user-mgmt__field--radio,
.hsi-user-mgmt__subsection,
.hsi-user-mgmt__field--submit {
	grid-column: 1 / -1;
}

.hsi-user-mgmt__field--radio,
.hsi-user-mgmt__field--checkboxes,
.hsi-user-mgmt__field--submit {
	border: 0;
	padding: 0;
	margin: 0 0 var(--hsi-space-4);
	min-width: 0;
}

/*
 * Brevo / Lead Assignment subsection (item 3, styling pass) — same visual
 * language as the Lookup/Update form's .hsi-lookup-form__section card
 * (border + radius-lg), not a new pattern.
 */
.hsi-user-mgmt__subsection {
	border: 1px solid var(--hsi-neutral-tint);
	border-radius: var(--hsi-radius-lg);
	padding: var(--hsi-space-4);
	margin: 0 0 var(--hsi-space-4);
	min-width: 0;
}

.hsi-user-mgmt__subsection legend {
	padding: 0 var(--hsi-space-2);
	font-family: var(--hsi-font-head);
	font-weight: 600;
	color: var(--hsi-navy);
}

.hsi-user-mgmt__subsection .hsi-user-mgmt__field:last-child {
	margin-bottom: 0;
}

.hsi-user-mgmt__field--checkbox label {
	display: flex;
	align-items: flex-start;
	gap: 0.5em;
	font-weight: normal;
}

@media (max-width: 720px) {
	.hsi-user-mgmt__form {
		grid-template-columns: 1fr;
	}
}

.hsi-user-mgmt__field--radio legend,
.hsi-user-mgmt__field--checkboxes legend {
	font-weight: 600;
	padding: 0;
	margin-bottom: var(--hsi-space-1);
	/* Client-specified (2026-08-06). */
	text-align: left;
}

.hsi-user-mgmt__radio-option,
.hsi-user-mgmt__checkbox-option {
	display: flex;
	align-items: center;
	gap: 0.4em;
	font-weight: normal;
	margin-bottom: var(--hsi-space-1);
}

.hsi-user-mgmt__required {
	color: var(--hsi-red);
}

.hsi-user-mgmt__hint {
	margin: var(--hsi-space-1) 0 0;
	font-size: 0.85em;
	font-weight: normal;
	color: #555;
}

.hsi-user-mgmt__field--submit button {
	padding: 10px 24px;
	border-radius: var(--hsi-radius);
	border: 1px solid var(--hsi-navy);
	background: var(--hsi-navy);
	color: var(--hsi-white);
	font-weight: 600;
	cursor: pointer;
}

.hsi-user-mgmt__field--submit button:hover {
	background: #10126b;
	border-color: #10126b;
}

/* Accounts search + pager (client-requested feature 2026-09-09 — functional
   styles for the new controls only). */
.hsi-user-mgmt__search {
	max-width: 420px;
	margin-bottom: var(--hsi-space-3);
}

.hsi-user-mgmt__pager {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--hsi-space-3);
	margin: var(--hsi-space-3) 0 var(--hsi-space-4);
}

.hsi-user-mgmt__pager-indicator {
	color: #555;
}

/* Pager layout fix (client report 2026-09-09): the theme stretches buttons
   full-width, stacking Prev/Next as giant bars — pin pager controls to
   natural inline size on one row. */
.hsi-user-mgmt__pager button {
	width: auto !important;
	flex: 0 0 auto;
	display: inline-flex;
	padding: 6px 18px;
	margin: 0;
}

/* Save + Cancel side by side (client request 2026-09-17): the edit view's
   new Cancel button sits beside Save Account — width auto (same
   !important the pager buttons needed against the theme's full-width
   button default) and a flex gap between them. */
.hsi-user-mgmt__field--submit {
	display: flex;
	align-items: center;
	gap: var(--hsi-space-3);
}

.hsi-user-mgmt__field--submit button,
.hsi-user-mgmt__cancel-edit {
	width: auto !important;
	flex: 0 0 auto;
}
