/**
 * Relatedly Admin Stylesheet
 *
 * @package Relatedly
 * @since   2.0.0
 * @since   2.3.0 Rebuilt with custom WordPress-native admin styles.
 */

.relatedly-admin-wrap,
.relatedly-statistics-wrap {
	--relatedly-bg: #f0f0f1;
	--relatedly-surface: #fff;
	--relatedly-surface-muted: #f8fafc;
	--relatedly-border: #c3c4c7;
	--relatedly-border-soft: #e2e8f0;
	--relatedly-text: #1d2327;
	--relatedly-heading: #1e293b;
	--relatedly-muted: #646970;
	--relatedly-blue: #2271b1;
	--relatedly-blue-hover: #135e96;
	--relatedly-green: #10b981;
	--relatedly-indigo: #4f46e5;
	--relatedly-red: #b32d2e;
	--relatedly-radius: 8px;
	--relatedly-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	color: var(--relatedly-text);
}

.relatedly-admin-wrap {
	max-width: 1200px;
}

.relatedly-admin-wrap * {
	box-sizing: border-box;
}

.relatedly-admin-shell {
	margin-top: 20px;
}

.relatedly-admin-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	margin-bottom: 24px;
}

.relatedly-admin-brand {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 0;
}

.relatedly-admin-logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	border-radius: var(--relatedly-radius);
	background: #fff;
	border: 1px solid var(--relatedly-border-soft);
	box-shadow: var(--relatedly-shadow);
}

.relatedly-admin-logo img {
	display: block;
	width: 32px;
	height: 32px;
}

.relatedly-admin-brand h1 {
	margin: 0;
	color: var(--relatedly-heading);
	font-size: 24px;
	font-weight: 700;
	line-height: 1.2;
}

.relatedly-admin-brand p {
	margin: 4px 0 0;
	color: var(--relatedly-muted);
	font-size: 13px;
	line-height: 1.5;
}

.relatedly-admin-status {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	flex-wrap: wrap;
}

.relatedly-version,
.relatedly-plan-badge,
.relatedly-admin-tab-badge,
.relatedly-pro-badge {
	display: inline-flex;
	align-items: center;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
}

.relatedly-version {
	padding: 6px 9px;
	background: #fff;
	border: 1px solid var(--relatedly-border-soft);
	color: var(--relatedly-muted);
}

.relatedly-plan-badge,
.relatedly-admin-tab-badge,
.relatedly-pro-badge {
	padding: 6px 9px;
	background: #eef2ff;
	color: #3730a3;
}

.relatedly-admin-tab-badge,
.relatedly-pro-badge {
	padding: 4px 7px;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.relatedly-admin-tabs {
	display: flex;
	align-items: stretch;
	margin: 0 0 24px;
	border-bottom: 1px solid var(--relatedly-border);
	overflow-x: auto;
	scrollbar-width: thin;
}

.relatedly-admin-tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 12px 18px;
	border-bottom: 2px solid transparent;
	color: #50575e;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.relatedly-admin-tab:hover,
.relatedly-admin-tab:focus {
	background: rgba(255, 255, 255, 0.7);
	color: var(--relatedly-text);
	box-shadow: none;
	outline: none;
}

.relatedly-admin-tab.is-active {
	border-color: var(--relatedly-blue);
	color: var(--relatedly-text);
}

.relatedly-admin-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: 28px;
	align-items: start;
}

.relatedly-admin-main,
.relatedly-admin-sidebar {
	min-width: 0;
}

.relatedly-admin-sidebar {
	display: grid;
	gap: 16px;
}

.relatedly-settings-panel,
.relatedly-admin-sidebar-box,
.relatedly-kpi-card,
.relatedly-chart-card,
.relatedly-table-card,
.relatedly-comparison-card {
	background: var(--relatedly-surface);
	border: 1px solid var(--relatedly-border);
	border-radius: var(--relatedly-radius);
	box-shadow: var(--relatedly-shadow);
}

.relatedly-settings-panel-header {
	padding: 22px 24px;
	border-bottom: 1px solid #f1f5f9;
}

.relatedly-settings-panel-title {
	margin: 0;
	color: var(--relatedly-heading);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
}

.relatedly-settings-panel-desc,
.relatedly-field-hint,
.relatedly-admin-sidebar-box p,
.relatedly-upgrade-panel p {
	color: var(--relatedly-muted);
	font-size: 13px;
	line-height: 1.55;
}

.relatedly-settings-panel-desc {
	margin: 4px 0 0;
}

.relatedly-settings-panel-body {
	padding: 24px 28px;
}

.relatedly-settings-table {
	width: 100%;
	border-collapse: collapse;
}

.relatedly-settings-table th {
	width: 280px;
	padding: 22px 24px 22px 0;
	border-bottom: 1px solid var(--relatedly-border-soft);
	color: var(--relatedly-heading);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	text-align: left;
	vertical-align: top;
}

.relatedly-settings-table td {
	padding: 22px 0;
	border-bottom: 1px solid var(--relatedly-border-soft);
	vertical-align: top;
}

.relatedly-settings-table tr:first-child th,
.relatedly-settings-table tr:first-child td {
	padding-top: 0;
}

.relatedly-settings-table tr:last-child th,
.relatedly-settings-table tr:last-child td {
	padding-bottom: 0;
	border-bottom: 0;
}

.relatedly-field-label {
	display: block;
	color: var(--relatedly-heading);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
}

.relatedly-field-hint {
	margin: 6px 0 0;
	font-weight: 400;
}

.relatedly-control,
.relatedly-settings-panel input[type="text"],
.relatedly-settings-panel input[type="number"],
.relatedly-settings-panel input[type="email"],
.relatedly-settings-panel select,
.relatedly-settings-panel textarea,
.relatedly-date-input,
.relatedly-comparison-group input {
	width: 100%;
	max-width: 360px;
	min-height: 36px;
	padding: 6px 10px;
	border: 1px solid #cbd5e1;
	border-radius: 4px;
	background: var(--relatedly-surface-muted);
	color: var(--relatedly-text);
	font-size: 14px;
	line-height: 1.5;
	box-shadow: none;
}

.relatedly-textarea,
.relatedly-settings-panel textarea {
	max-width: 520px;
	min-height: 110px;
	resize: vertical;
}

.relatedly-control-small {
	max-width: 120px;
	margin-top: 10px;
}

.relatedly-control:focus,
.relatedly-settings-panel input:focus,
.relatedly-settings-panel select:focus,
.relatedly-settings-panel textarea:focus,
.relatedly-date-input:focus,
.relatedly-comparison-group input:focus {
	border-color: var(--relatedly-blue);
	box-shadow: 0 0 0 1px var(--relatedly-blue);
	outline: none;
}

.relatedly-toggle-row {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 28px;
}

.relatedly-toggle-switch {
	position: relative;
	display: inline-block;
	flex: 0 0 44px;
	width: 44px;
	height: 24px;
	vertical-align: middle;
}

.relatedly-toggle-switch input {
	position: absolute;
	inset: 0;
	z-index: 2;
	width: 44px;
	height: 24px;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.relatedly-toggle-switch label {
	position: absolute;
	inset: 0;
	display: block;
	border-radius: 999px;
	background: #cbd5e1;
	cursor: pointer;
	transition: background 160ms ease;
}

.relatedly-toggle-switch label::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	transition: transform 160ms ease;
}

.relatedly-toggle-switch input:checked + label {
	background: var(--relatedly-green);
}

.relatedly-toggle-switch input:checked + label::after {
	transform: translateX(20px);
}

.relatedly-toggle-status {
	color: #059669;
	font-size: 14px;
	font-weight: 600;
}

.relatedly-toggle-status.is-inactive {
	color: var(--relatedly-muted);
}

.relatedly-checkbox-list {
	display: grid;
	gap: 8px;
	max-width: 360px;
	max-height: 180px;
	padding: 10px;
	overflow-y: auto;
	border: 1px solid var(--relatedly-border-soft);
	border-radius: 4px;
	background: var(--relatedly-surface-muted);
}

.relatedly-checkbox-list-auto {
	max-height: none;
}

.relatedly-checkbox-item {
	display: flex;
	align-items: center;
	gap: 9px;
	min-height: 28px;
	padding: 3px 4px;
	border-radius: 4px;
	color: #334155;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
}

.relatedly-checkbox-item:hover {
	background: #eef2f7;
}

.relatedly-checkbox-item.is-disabled {
	opacity: 0.55;
}

.relatedly-checkbox-item input {
	margin: 0;
}

.relatedly-color-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.relatedly-color-field {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 7px 9px;
	border: 1px solid var(--relatedly-border-soft);
	border-radius: 4px;
	background: var(--relatedly-surface-muted);
	color: #334155;
	font-size: 12px;
	font-weight: 600;
}

.relatedly-color-field input[type="color"] {
	width: 28px;
	height: 24px;
	min-height: 24px;
	padding: 0;
	border: 0;
	background: transparent;
}

.relatedly-save-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px 28px;
	border-top: 1px solid var(--relatedly-border-soft);
	border-radius: 0 0 var(--relatedly-radius) var(--relatedly-radius);
	background: var(--relatedly-surface-muted);
}

.relatedly-preview-frame {
	max-width: 520px;
	min-height: 120px;
	padding: 14px;
	border: 1px solid var(--relatedly-border-soft);
	border-radius: 6px;
	background: var(--relatedly-surface-muted);
}

.relatedly-preview-placeholder {
	padding: 12px;
	border-left: 4px solid var(--relatedly-blue);
	background: #fff;
}

.relatedly-preview-placeholder strong {
	display: block;
	margin-bottom: 4px;
	color: var(--relatedly-heading);
}

.relatedly-preview-placeholder span {
	color: var(--relatedly-muted);
	font-size: 13px;
}

.relatedly-is-hidden {
	display: none;
}

.relatedly-dashboard-stats-table {
	margin-bottom: 12px;
}

.relatedly-inline-spinner {
	float: none;
}

.relatedly-preview-error {
	color: var(--relatedly-red);
}

.relatedly-upgrade-panel {
	max-width: 620px;
	padding: 22px;
	border: 1px solid #c7d2fe;
	border-radius: var(--relatedly-radius);
	background: linear-gradient(135deg, #eef2ff, #eff6ff);
}

.relatedly-upgrade-panel h3 {
	margin: 0 0 8px;
	color: #312e81;
	font-size: 18px;
}

.relatedly-upgrade-panel p {
	margin: 0 0 16px;
	color: #312e81;
}

.relatedly-admin-sidebar-box {
	padding: 18px;
}

.relatedly-admin-sidebar-box h3 {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 10px;
	color: var(--relatedly-heading);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.4;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.relatedly-admin-sidebar-box p {
	margin: 0 0 14px;
}

.relatedly-premium-box {
	background: linear-gradient(135deg, #eef2ff, #eff6ff);
	border-color: #c7d2fe;
}

.relatedly-premium-box h3,
.relatedly-premium-box p,
.relatedly-feature-list {
	color: #312e81;
}

.relatedly-feature-list,
.relatedly-help-links {
	display: grid;
	gap: 9px;
	margin: 0 0 16px;
	padding: 0;
	list-style: none;
}

.relatedly-feature-list li {
	position: relative;
	padding-left: 20px;
	font-size: 13px;
	line-height: 1.45;
}

.relatedly-feature-list li::before {
	content: "";
	position: absolute;
	top: 0.55em;
	left: 0;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--relatedly-indigo);
}

.relatedly-help-links a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--relatedly-blue);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}

.relatedly-help-links a:hover {
	color: var(--relatedly-blue-hover);
}

.relatedly-danger-notice {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	max-width: 520px;
	margin-top: 10px;
	padding: 10px 12px;
	border-left: 3px solid var(--relatedly-red);
	background: #fcf0f1;
	color: #742021;
	font-size: 13px;
	line-height: 1.45;
}

.relatedly-danger-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--relatedly-red);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
}

.relatedly-statistics-wrap h1 {
	margin-bottom: 18px;
}

.relatedly-stats-toolbar,
.relatedly-comparison-fields {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 18px;
	padding: 14px;
	background: var(--relatedly-surface);
	border: 1px solid var(--relatedly-border);
	border-radius: var(--relatedly-radius);
}

.relatedly-stats-label,
.relatedly-comparison-group label {
	color: var(--relatedly-heading);
	font-size: 13px;
	font-weight: 700;
}

.relatedly-stats-sep,
.relatedly-comparison-group span {
	color: var(--relatedly-muted);
}

.relatedly-kpi-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 14px;
	margin-bottom: 18px;
}

.relatedly-kpi-card,
.relatedly-chart-card,
.relatedly-table-card,
.relatedly-comparison-card {
	padding: 18px;
}

.relatedly-kpi-label {
	display: block;
	margin-bottom: 8px;
	color: var(--relatedly-muted);
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.relatedly-kpi-value {
	display: block;
	color: var(--relatedly-heading);
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
}

.relatedly-chart-grid,
.relatedly-tables-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px;
	margin-bottom: 18px;
}

.relatedly-chart-card h2,
.relatedly-table-card h2,
.relatedly-comparison-card h2 {
	margin: 0 0 14px;
	color: var(--relatedly-heading);
	font-size: 16px;
	font-weight: 700;
}

.relatedly-chart-canvas-wrap {
	position: relative;
	min-height: 260px;
}

.relatedly-num {
	text-align: right;
}

.relatedly-comparison-results {
	margin-top: 14px;
	padding: 14px;
	border: 1px solid var(--relatedly-border-soft);
	border-radius: 4px;
	background: var(--relatedly-surface-muted);
}

.relatedly-comparison-card p {
	max-width: 720px;
	color: var(--relatedly-muted);
	font-size: 13px;
	line-height: 1.55;
}

.relatedly-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(15, 23, 42, 0.45);
}

.relatedly-modal.open {
	display: flex;
}

.relatedly-modal-dialog {
	width: min(760px, 100%);
	max-height: calc(100vh - 48px);
	overflow: auto;
	background: var(--relatedly-surface);
	border-radius: var(--relatedly-radius);
	box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.relatedly-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 18px;
	border-bottom: 1px solid var(--relatedly-border-soft);
}

.relatedly-modal-header h2 {
	margin: 0;
	font-size: 18px;
}

.relatedly-modal-body {
	padding: 18px;
}

@media (max-width: 1080px) {
	.relatedly-admin-layout,
	.relatedly-chart-grid,
	.relatedly-tables-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 782px) {
	.relatedly-admin-wrap {
		margin-right: 12px;
	}

	.relatedly-admin-header {
		align-items: flex-start;
		flex-direction: column;
	}

	.relatedly-admin-status {
		justify-content: flex-start;
	}

	.relatedly-admin-tab {
		padding-inline: 14px;
	}

	.relatedly-settings-panel-body,
	.relatedly-settings-panel-header,
	.relatedly-save-bar {
		padding-inline: 18px;
	}

	.relatedly-settings-table,
	.relatedly-settings-table tbody,
	.relatedly-settings-table tr,
	.relatedly-settings-table th,
	.relatedly-settings-table td {
		display: block;
		width: 100%;
	}

	.relatedly-settings-table th {
		padding: 18px 0 8px;
		border-bottom: 0;
	}

	.relatedly-settings-table td {
		padding: 0 0 18px;
	}

	.relatedly-control,
	.relatedly-settings-panel input[type="text"],
	.relatedly-settings-panel input[type="number"],
	.relatedly-settings-panel input[type="email"],
	.relatedly-settings-panel select,
	.relatedly-settings-panel textarea,
	.relatedly-date-input,
	.relatedly-comparison-group input {
		max-width: 100%;
	}

	.relatedly-kpi-grid {
		grid-template-columns: 1fr;
	}
}
