/**
 * Magic Login admin — extends Code Snippets (cs-admin.css) layout.
 */

/* Settings form wraps multiple accordions; keep the same gap as sibling accordions. */
.wpps-cs-accordions > .wpps-magic-login-settings {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0;
}

	width: 220px;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--cs-black, #1d2327);
}

.wpps-magic-login-settings .form-table td {
	font-size: 0.875rem;
}

.wpps-magic-login-settings .form-table .description {
	font-size: 0.75rem;
	color: var(--cs-gray, #50575e);
}

.wpps-ml-shortcode-callout {
	margin: 0 0 16px;
	padding: 12px 14px;
	background: #f6f7f7;
	border: 1px solid var(--cs-border, #c3c4c7);
	border-radius: 4px;
	font-size: 0.875rem;
	color: var(--cs-gray, #50575e);
	line-height: 1.5;
}

.wpps-ml-shortcode-callout code {
	font-size: 0.8125rem;
	margin-left: 4px;
}

/* Form layout — Redirect Manager-style cards and grids (shared across accordions) */
.wpps-ml-form-panel,
.wpps-ml-sc-panel {
	padding-top: 4px;
}

.wpps-ml-form-card,
.wpps-ml-sc-card {
	background: #fff;
	border: 1px solid var(--cs-border, #c3c4c7);
	box-shadow: var(--cs-shadow, 0 1px 2px 0 rgba(0, 0, 0, 0.05));
	padding: 24px;
	margin-bottom: 20px;
}

.wpps-ml-form-card:last-child,
.wpps-ml-sc-card:last-child {
	margin-bottom: 0;
}

.wpps-ml-form-panel-title,
.wpps-ml-sc-panel-title {
	margin: 0 0 4px;
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--cs-black, #1d2327);
}

.wpps-ml-form-panel-desc,
.wpps-ml-sc-panel-desc {
	margin: 0 0 20px;
	font-size: 0.875rem;
	color: var(--cs-gray, #50575e);
	line-height: 1.5;
}

.wpps-ml-form-subsection-title,
.wpps-ml-sc-subsection-title {
	margin: 0 0 12px;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--cs-black, #1d2327);
}

.wpps-ml-form-subsection-title:not(:first-of-type),
.wpps-ml-sc-subsection-title:not(:first-of-type) {
	margin-top: 24px;
}

.wpps-ml-form-grid,
.wpps-ml-sc-form-grid {
	display: grid;
	gap: 20px;
	margin-bottom: 20px;
}

.wpps-ml-form-grid:last-child,
.wpps-ml-sc-form-grid:last-child {
	margin-bottom: 0;
}

.wpps-ml-form-grid-2col,
.wpps-ml-sc-form-grid-2col {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wpps-ml-form-grid-3col,
.wpps-ml-sc-form-grid-3col {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wpps-ml-form-grid-4col {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.wpps-ml-form-full,
.wpps-ml-sc-form-full {
	grid-column: 1 / -1;
}

.wpps-ml-form-group,
.wpps-ml-sc-form-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.wpps-ml-form-group > label,
.wpps-ml-sc-form-group > label,
.wpps-ml-form-group-label {
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--cs-black, #1d2327);
}

.wpps-ml-form-input,
.wpps-ml-form-select,
.wpps-ml-form-textarea,
.wpps-ml-sc-input,
.wpps-ml-sc-select,
.wpps-ml-sc-textarea {
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	padding: 10px 12px;
	min-height: 40px;
	border: 1px solid var(--cs-border, #c3c4c7);
	border-radius: 2px;
	font-size: 14px;
	background: #fff;
}

.wpps-ml-form-select,
.wpps-ml-sc-select {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2350575e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 36px;
}

.wpps-ml-form-textarea,
.wpps-ml-sc-textarea {
	min-height: 120px;
	resize: vertical;
	font-family: Consolas, Monaco, monospace;
}

.wpps-ml-form-input:focus,
.wpps-ml-form-select:focus,
.wpps-ml-form-textarea:focus,
.wpps-ml-sc-input:focus,
.wpps-ml-sc-select:focus,
.wpps-ml-sc-textarea:focus {
	outline: none;
	border-color: var(--cs-blue, #2271b1);
	box-shadow: 0 0 0 1px var(--cs-blue, #2271b1);
}

.wpps-ml-form-checkbox-label,
.wpps-ml-sc-checkbox-label {
	display: inline-flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--cs-black, #1d2327);
	cursor: pointer;
	line-height: 1.45;
}

.wpps-ml-form-checkbox-label input,
.wpps-ml-sc-checkbox-label input {
	width: 18px;
	height: 18px;
	margin: 2px 0 0;
	flex-shrink: 0;
}

.wpps-ml-form-help,
.wpps-ml-sc-help {
	margin: 0;
	font-size: 0.8125rem;
	color: var(--cs-gray, #50575e);
	line-height: 1.45;
}

.wpps-ml-form-inline-suffix {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.wpps-ml-form-inline-suffix .wpps-ml-form-help {
	white-space: nowrap;
}

.wpps-ml-form-card .notice.inline {
	margin: 0 0 20px;
}

.wpps-ml-form-panel .wpps-cwe-color-grid,
.wpps-ml-sc-panel .wpps-cwe-color-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px 24px;
}

.wpps-ml-sc-panel .wpps-cwe-color-cell,
.wpps-ml-sc-panel .wpps-cwe-field-cell,
.wpps-ml-style-panel .wpps-cwe-color-cell,
.wpps-ml-style-panel .wpps-cwe-field-cell {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wpps-ml-sc-panel .wpps-cwe-color-label,
.wpps-ml-style-panel .wpps-cwe-color-label {
	font-weight: 600;
	font-size: 13px;
	color: var(--cs-black, #1d2327);
	margin: 0;
}

.wpps-ml-sc-panel .wpps-color-field-row,
.wpps-ml-style-panel .wpps-color-field-row {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	flex-wrap: nowrap;
}

.wpps-ml-sc-panel .wpps-color-picker-circle,
.wpps-ml-style-panel .wpps-color-picker-circle {
	width: 40px !important;
	height: 40px !important;
	min-width: 40px;
	min-height: 40px;
	flex-shrink: 0;
	border-radius: 50% !important;
	border: 2px solid #ddd !important;
	padding: 0 !important;
	cursor: pointer;
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	appearance: none !important;
	overflow: hidden;
}

.wpps-ml-sc-panel .wpps-color-picker-circle::-webkit-color-swatch-wrapper,
.wpps-ml-style-panel .wpps-color-picker-circle::-webkit-color-swatch-wrapper {
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	border-radius: 50% !important;
}

.wpps-ml-sc-panel .wpps-color-picker-circle::-webkit-color-swatch,
.wpps-ml-style-panel .wpps-color-picker-circle::-webkit-color-swatch {
	border: none !important;
	border-radius: 50% !important;
	width: 100% !important;
	height: 100% !important;
}

.wpps-ml-sc-panel .wpps-color-picker-circle::-moz-color-swatch,
.wpps-ml-style-panel .wpps-color-picker-circle::-moz-color-swatch {
	border: none !important;
	border-radius: 50% !important;
	width: 100% !important;
	height: 100% !important;
}

.wpps-ml-sc-panel .wpps-color-code-wrap,
.wpps-ml-style-panel .wpps-color-code-wrap {
	display: inline-block;
	position: relative;
	margin: 0;
	flex-shrink: 0;
}

.wpps-ml-sc-panel .wpps-color-code-wrap .wpps-color-reset,
.wpps-ml-style-panel .wpps-color-code-wrap .wpps-color-reset {
	position: absolute;
	right: 5px;
	top: 50%;
	transform: translateY(-50%);
	padding: 0;
	margin: 0;
	background: none;
	border: none;
	cursor: pointer;
	min-height: 0;
	line-height: 1;
	color: var(--cs-gray, #50575e);
}

.wpps-ml-sc-panel .wpps-color-code-wrap .wpps-color-reset:hover {
	color: #2271b1;
}

.wpps-ml-sc-panel .wpps-color-code-wrap .wpps-color-reset .dashicons,
.wpps-ml-style-panel .wpps-color-code-wrap .wpps-color-reset .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.wpps-ml-sc-panel .wpps-color-code-wrap .wpps-color-code-input,
.wpps-ml-style-panel .wpps-color-code-wrap .wpps-color-code-input {
	box-sizing: border-box;
	width: 100px;
	padding: 8px 28px 8px 10px;
	border: 1px solid var(--cs-border, #c3c4c7);
	border-radius: 2px;
	font-size: 0.875rem;
}

.wpps-ml-radius-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px 24px;
}

.wpps-ml-radius-field {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.wpps-ml-radius-field .wpps-cwe-input,
.wpps-ml-radius-field .wpps-ml-sc-input {
	width: 80px;
	min-width: 80px;
}

.wpps-ml-radius-suffix {
	font-size: 0.875rem;
	color: var(--cs-gray, #50575e);
}

@media (max-width: 960px) {
	.wpps-ml-form-grid-2col,
	.wpps-ml-form-grid-3col,
	.wpps-ml-form-grid-4col,
	.wpps-ml-sc-form-grid-2col,
	.wpps-ml-sc-form-grid-3col,
	.wpps-ml-form-panel .wpps-cwe-color-grid,
	.wpps-ml-sc-panel .wpps-cwe-color-grid,
	.wpps-ml-radius-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 600px) {
	.wpps-ml-form-grid-2col,
	.wpps-ml-form-grid-3col,
	.wpps-ml-form-grid-4col,
	.wpps-ml-sc-form-grid-2col,
	.wpps-ml-sc-form-grid-3col,
	.wpps-ml-form-panel .wpps-cwe-color-grid,
	.wpps-ml-sc-panel .wpps-cwe-color-grid,
	.wpps-ml-radius-grid,
	.wpps-ml-error-grid {
		grid-template-columns: 1fr;
	}
}

.wpps-ml-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 12px;
	margin: 0;
}

.wpps-ml-stat-card {
	padding: 14px 16px;
	border: 1px solid var(--cs-border, #c3c4c7);
	background: #fafafa;
}

.wpps-ml-stat-card__label {
	margin: 0 0 4px;
	font-size: 0.75rem;
	color: var(--cs-gray, #50575e);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.wpps-ml-stat-card__value {
	margin: 0;
	font-size: 1.375rem;
	font-weight: 600;
	color: var(--cs-black, #1d2327);
}

.wpps-ml-stat-card__value.is-used {
	color: #00a32a;
}

.wpps-ml-stat-card__value.is-active {
	color: var(--cs-blue, #2271b1);
}

.wpps-ml-error-intro,
.wpps-ml-form-panel .wpps-ml-error-intro {
	margin: 0 0 20px;
	max-width: 42rem;
	font-size: 0.875rem;
	color: var(--cs-gray, #50575e);
}

.wpps-ml-error-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px;
}

.wpps-ml-error-field label {
	display: block;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--cs-black, #1d2327);
	margin-bottom: 4px;
}

.wpps-ml-error-field .wpps-ml-form-help {
	margin-top: 4px;
}

.wpps-ml-error-section-title {
	margin: 0 0 12px;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--cs-black, #1d2327);
}

.wpps-ml-activity-table-wrap {
	margin-top: 0;
}

.wpps-ml-activity-title {
	margin: 0 0 16px;
	padding: 0;
	font-size: 1rem;
	font-weight: 600;
	color: var(--cs-black, #1d2327);
}

.wpps-ml-activity-table-wrap .wp-list-table {
	margin-top: 0;
}

.wpps-ml-activity-list-header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 8px;
}

.wpps-ml-activity-list-header .subsubsub {
	margin: 0;
	flex: 1 1 auto;
}

.wpps-ml-activity-list-header .search-box {
	float: none;
	margin: 0;
	flex: 0 0 auto;
}

.wpps-ml-activity-table-wrap .tablenav {
	height: auto;
	min-height: 30px;
}

.wpps-ml-status {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 3px;
	font-size: 12px;
	line-height: 1.5;
	font-weight: 500;
}

.wpps-ml-status--used {
	background: #edfaef;
	color: #007017;
}

.wpps-ml-status--pending {
	background: #f0f6fc;
	color: #2271b1;
}

.wpps-ml-status--expired {
	background: #fcf0f1;
	color: #8a2424;
}

.wpps-ml-style-section-title {
	margin: 0 0 12px;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--cs-black, #1d2327);
}

.wpps-ml-style-section-title:not(:first-child) {
	margin-top: 24px;
}

.wpps-ml-limits-panel {
	padding-top: 4px;
}

.wpps-ml-limits-panel .form-table {
	margin-top: 0;
}

.wpps-ml-limits-lead {
	margin: 0 0 12px;
	max-width: 42rem;
}

.wpps-magic-login-settings .wpps-ct-multiselect {
	position: relative;
	max-width: 100%;
	z-index: 1;
}

.wpps-magic-login-settings .wpps-cs-accordion {
	position: relative;
}

/* Allow role multiselect dropdown to extend past accordion body */
.wpps-magic-login-settings .wpps-cs-accordion.is-open .wpps-cs-accordion-body {
	overflow: visible;
}

.wpps-magic-login-settings .wpps-cs-accordion.wpps-ml-accordion--dropdown-open {
	z-index: 30;
}

.wpps-magic-login-settings .wpps-ct-multiselect__trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--cs-border, #c3c4c7);
	border-radius: 2px;
	background: #fff;
	font-size: 0.875rem;
	text-align: left;
	cursor: pointer;
	color: var(--cs-black, #1d2327);
}

.wpps-magic-login-settings .wpps-ct-multiselect__trigger:hover,
.wpps-magic-login-settings .wpps-ct-multiselect__trigger:focus {
	border-color: var(--cs-blue, #2271b1);
	outline: none;
	box-shadow: 0 0 0 1px var(--cs-blue, #2271b1);
}

.wpps-magic-login-settings .wpps-ct-multiselect__chevron {
	font-size: 18px;
	width: 18px;
	height: 18px;
	color: var(--cs-gray, #50575e);
	flex-shrink: 0;
	margin-left: 8px;
}

.wpps-magic-login-settings .wpps-ct-multiselect__trigger[aria-expanded="true"] .wpps-ct-multiselect__chevron {
	transform: rotate(180deg);
}

.wpps-magic-login-settings .wpps-ct-multiselect__dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	margin-top: 4px;
	border: 1px solid var(--cs-border, #c3c4c7);
	border-radius: 2px;
	background: #fff;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	z-index: 40;
	max-height: 280px;
	display: flex;
	flex-direction: column;
}

.wpps-magic-login-settings .wpps-ct-multiselect__dropdown[hidden] {
	display: none !important;
}

.wpps-magic-login-settings .wpps-ct-multiselect__search {
	width: 100%;
	padding: 8px 12px;
	border: none;
	border-bottom: 1px solid var(--cs-border, #c3c4c7);
	font-size: 0.8125rem;
	box-sizing: border-box;
	outline: none;
}

.wpps-magic-login-settings .wpps-ct-multiselect__actions {
	padding: 6px 10px;
	border-bottom: 1px solid var(--cs-border, #c3c4c7);
	display: flex;
	gap: 12px;
}

.wpps-magic-login-settings .wpps-ct-multiselect__action {
	background: none;
	border: none;
	color: var(--cs-blue, #2271b1);
	cursor: pointer;
	font-size: 0.75rem;
	padding: 0;
}

.wpps-magic-login-settings .wpps-ct-multiselect__options {
	overflow-y: auto;
	padding: 4px 0;
	max-height: 200px;
}

.wpps-magic-login-settings .wpps-ct-multiselect__option {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	cursor: pointer;
	font-size: 0.8125rem;
}

.wpps-magic-login-settings .wpps-ct-multiselect__option:hover {
	background: var(--cs-bg, #f0f0f1);
}

.wpps-magic-login-settings .wpps-ct-multiselect__option.wpps-ct-multiselect__option--hidden {
	display: none;
}

.wpps-ml-save-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 8px;
	padding: 20px 0 8px;
}

.wpps-ml-save-footer .description {
	margin: 0;
	font-size: 0.875rem;
	color: var(--cs-gray, #50575e);
}

#wpps-ml-toast.wpps-cs-toast.is-visible {
	pointer-events: auto;
}

/* Accordion tooltips: stop header toggle when clicking help */
.wpps-cs-accordion-tooltip {
	cursor: help;
}
