/* Settings → Webfon. Sizes and colors are the WordPress Design System's (wp-admin/css/colors/_tokens.scss). */

.webfon {
	max-width: 800px;
}

.webfon-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 16px 0;
}

.webfon-header img {
	display: block;
}

.wrap.webfon .webfon-header h1 {
	padding: 0;
	font-size: 20px;
	font-weight: 600;
	line-height: 28px;
}

/* The panel's link: a small icon raised beside the title, as a superscript */
.webfon-panel-link {
	position: relative;
	top: -7px;
	margin-inline-start: -8px;
	color: var(--wp-admin-theme-color, #3858e9);
	text-decoration: none;
}

.webfon-panel-link .dashicons {
	width: 14px;
	height: 14px;
	font-size: 14px;
}

/* Tabs: the current one underlined in the theme color, as the block editor's */

.webfon-tabs {
	display: flex;
	margin: 0 0 24px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.webfon-tabs a {
	padding: 12px 16px;
	color: #1e1e1e;
	font-size: 13px;
	line-height: 24px;
	text-decoration: none;
}

.webfon-tabs a:hover {
	color: var(--wp-admin-theme-color, #3858e9);
}

.webfon-tabs a[aria-current="page"] {
	box-shadow: inset 0 -2px var(--wp-admin-theme-color, #3858e9);
	font-weight: 600;
}

.webfon .card {
	max-width: none;
	margin: 0 0 16px;
	padding: 24px;
}

.webfon .card h2 {
	margin: 0;
	font-size: 15px;
	line-height: 24px;
}

.webfon .card p {
	margin: 4px 0 0;
	color: #757575;
}

/* Not connected */

.webfon .webfon-welcome h2 {
	font-size: 20px;
	line-height: 28px;
}

.webfon .webfon-welcome > p {
	margin: 8px 0 20px;
	font-size: 14px;
	line-height: 24px;
}

/* Connected: the status and what works on the site, two to a row */

.webfon-dot {
	width: 10px;
	height: 10px;
	margin: 4px 5px 0;
	border-radius: 50%;
	background: #4ab866;
	box-shadow: 0 0 0 4px #eff9f1;
}

/* Core's button states all read the theme color: red ($alert-red) here, hover and active its darker shade. */
.webfon-disconnect {
	--wp-admin-theme-color: #cc1818;
	--wp-admin-theme-color--rgb: 204, 24, 24;
	--wp-admin-theme-color-darker-20: #710d0d;
}

/* The first row starts at the card's top; the last row's lines fall outside, where the first section draws its own. */
.webfon-checks {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	column-gap: 32px;
	margin: -16px 0 0;
	overflow: hidden;
}

.webfon-checks li {
	display: grid;
	grid-template-columns: 20px 1fr;
	align-content: start;
	gap: 2px 16px;
	margin: 0 0 -1px;
	padding: 16px 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.webfon-checks .is-wide {
	grid-column: 1 / -1;
}

.webfon-checks .webfon-dot {
	grid-row: span 2;
}

.webfon-checks .dashicons {
	grid-row: span 2;
	color: #4ab866;
}

.webfon .webfon-checks h2 {
	font-size: inherit;
	line-height: inherit;
}

.webfon-checks .is-off .dashicons {
	color: #949494;
}

.webfon-checks .is-warning .dashicons {
	color: #f0b849;
}

.webfon-checks strong {
	color: #1e1e1e;
}

.webfon-checks li > span:last-child {
	color: #757575;
}

/* Connect's form: the AI agent tools and the Gravatar switch, each a section under a line */

.webfon-section {
	position: relative;
	min-width: 0;
	margin: 0;
	padding: 20px 0;
	border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Connect with Webfon, and the connection code's link beside it */
.webfon-connect-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
	margin-top: 8px;
}

/* A floated legend lays out as a block, under which the description clears. */
.webfon-section legend {
	float: left;
	width: 100%;
	padding: 0;
}

.webfon-section legend,
.webfon-gravatar label {
	color: #1e1e1e;
	font-size: 14px;
	font-weight: 600;
	line-height: 20px;
}

.webfon .webfon-section p {
	clear: both;
	margin: 4px 0 0;
	font-size: 13px;
	line-height: 20px;
}

.webfon-section-actions {
	position: absolute;
	top: 20px;
	inset-inline-end: 0;
	display: flex;
	gap: 16px;
	line-height: 20px;
}

/* The tools, as tiles that take the theme color once ticked */

.webfon-tools-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 8px;
	margin-top: 16px;
}

.webfon-tools-grid label {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	color: #1e1e1e;
	cursor: pointer;
	transition: border-color 0.1s ease-in-out, background-color 0.1s ease-in-out;
}

.webfon-tools-grid label:hover {
	border-color: #949494;
}

.webfon-tools-grid label:has(:checked) {
	border-color: var(--wp-admin-theme-color, #3858e9);
	background: rgba(var(--wp-admin-theme-color--rgb, 56, 88, 233), 0.04);
}

.webfon .webfon-tools-grid input[type="checkbox"] {
	margin: 0;
}

/* Gravatar: the text, and the switch on its right */

.webfon-gravatar {
	display: flex;
	align-items: flex-start;
	gap: 24px;
}

.webfon-gravatar > div {
	flex: 1;
}

/* A checkbox drawn as the block editor's toggle (ToggleControl), over core's checkbox styles. */
.webfon input.webfon-switch[type="checkbox"] {
	position: relative;
	flex: none;
	width: 36px;
	min-width: 36px;
	height: 20px;
	margin: 0;
	border: 1px solid #1e1e1e;
	border-radius: 10px;
	box-shadow: none;
	background: #fff;
	transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.webfon input.webfon-switch[type="checkbox"]::before,
.webfon input.webfon-switch[type="checkbox"]:checked::before {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	float: none;
	width: 14px;
	height: 14px;
	margin: 0;
	border-radius: 50%;
	background: #1e1e1e;
	transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

.webfon input.webfon-switch[type="checkbox"]:checked {
	border-color: var(--wp-admin-theme-color, #3858e9);
	background: var(--wp-admin-theme-color, #3858e9);
}

.webfon input.webfon-switch[type="checkbox"]:checked::before {
	transform: translateX(16px);
	background: #fff;
}

.rtl .webfon input.webfon-switch[type="checkbox"]:checked::before {
	transform: translateX(-16px);
}

.rtl .webfon input.webfon-switch[type="checkbox"]::before {
	right: 2px;
	left: auto;
}

.webfon input.webfon-switch[type="checkbox"]:focus-visible {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wp-admin-theme-color, #3858e9);
}

/* What waits for a Reconnect, above it */

.webfon .webfon-sync {
	margin: 0 0 16px;
}

.webfon .webfon-sync p {
	margin: 0;
	color: #1e1e1e;
}

.webfon .webfon-sync p + p {
	margin-top: 4px;
}

/* The connection code's dialog, as the block editor's Modal */

.webfon-dialog {
	box-sizing: border-box;
	width: 480px;
	padding: 32px;
	border: 0;
	border-radius: 8px;
	box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08), 0 15px 27px rgba(0, 0, 0, 0.07), 0 30px 36px rgba(0, 0, 0, 0.04), 0 50px 43px rgba(0, 0, 0, 0.02);
	color: #1e1e1e;
}

.webfon-dialog::backdrop {
	background: rgba(0, 0, 0, 0.35);
}

.webfon .webfon-dialog h2 {
	font-size: 20px;
	line-height: 28px;
}

.webfon .webfon-dialog p {
	margin: 8px 0 16px;
}

.webfon-dialog-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 24px;
}

/* Settings */

.webfon .card textarea {
	display: block;
	width: 100%; /* not large-text's 99%: flush with the code editors */
	margin-top: 16px;
}

.webfon-advanced .form-table th {
	width: 160px;
}

/* Events */

.webfon-presets {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 16px;
}

/* A preset whose code is in the boxes */
.webfon-presets .button[aria-pressed="true"] {
	border-color: var(--wp-admin-theme-color, #3858e9);
	background: var(--wp-admin-theme-color, #3858e9);
	color: #fff;
}

.webfon-presets .button-link-delete {
	margin-inline-start: auto;
}

.webfon .webfon-presets + .description {
	margin-top: 8px;
}

.webfon-event {
	margin-top: 20px;
}

.webfon-event label {
	display: block;
	color: #757575;
}

.webfon-event label code {
	margin-inline-end: 4px;
	color: #1e1e1e;
	font-weight: 600;
}

.webfon .webfon-event textarea,
.webfon-event .CodeMirror {
	margin-top: 8px;
}

/* The code editor grows with its code, from three lines up to fifteen. */
.webfon-event .CodeMirror {
	height: auto;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	font-size: 13px;
}

.webfon-event .CodeMirror-scroll {
	min-height: 66px;
	max-height: 300px;
}
