/*
 * Forms, one look on every page: Contact Form 7 (footer, contacts, consultation, collaboration,
 * popups), checkout and My Account, product reviews, blog comments, the catalog sorting and
 * filters, the search dialog. Enqueued last (functions.php → agskindermo_forms_assets), so it has
 * the final word over the older per-page rules; the !important is there for the plugins' own.
 *
 * The look is the one of the aesthetics theme (assets/css/main.css → "Shared form parts",
 * checkout): white 60px fields with 12px corners and a grey hairline that turns ink on focus,
 * red when invalid; 16px text, grey placeholders, the label 12px above. Checkboxes: 20px, 6px
 * corners, ink with a white tick. Radios: 20px rings with a 6px ink border when chosen; a chosen
 * payment or delivery row gets a warm tint. Line icons in the name, email, phone and password
 * fields (img/forms, from aesthetics).
 * Left alone: the header's search pill, quantity steppers, the loyalty points converter.
 */

/* The fields' font: Neue Haas Unica with room for its descenders. The font says they go 2px below
   the baseline at 16px, they go 3px, and a field cuts its text where the font says: "g", "y" lost
   their tails. Same file as style.css's, so nothing more is downloaded. */
@font-face {
	font-display: swap;
	font-family: "Neue Haas Unica Field";
	font-style: normal;
	font-weight: 400;
	src: url("../fonts/NeueHaasUnica-Regular.woff2?v=2") format("woff2");
	ascent-override: 87.5%;
	descent-override: 22%;
	line-gap-override: 0%;
}

:root {
	--ags-field-h: 60px;
	--ags-field-radius: 12px;
	--ags-field-area-radius: 12px;
	--ags-field-fill: #fff;
	--ags-field-hairline: rgba(144, 150, 154, 0.4);
	--ags-field-border: rgba(144, 150, 154, 0.6);
	--ags-field-ink: #201600;
	--ags-field-text: #6f7579;
	--ags-field-placeholder: rgba(144, 150, 154, 0.8);
	--ags-field-error: #e01616;
	--ags-field-chosen: #fff6f1;
	--ags-field-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%23fff'%3E%3Cpath d='M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z'/%3E%3C/svg%3E");
	--ags-field-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%23201600'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------
 * Text fields, selects, textareas
 * ---------------------------------------------------------- */

:is(
	input:is([type="text"], [type="email"], [type="tel"], [type="password"], [type="search"], [type="number"], [type="date"], [type="url"], [type="time"], [type="datetime-local"]),
	select,
	textarea
):not(:where(.qty, .wc-block-components-quantity-selector__input, .ags-search__field, .select2-hidden-accessible, .select2-search__field, .wlr-input-point-conversion *, #wpadminbar *)) {
	box-sizing: border-box;
	width: 100%;
	height: var(--ags-field-own-h, var(--ags-field-h)) !important;
	min-height: var(--ags-field-min-h, 0) !important;
	margin: 0;
	padding: var(--ags-field-padding, 0 20px) !important;
	border: 1px solid var(--ags-field-line, var(--ags-field-hairline)) !important;
	border-radius: var(--ags-field-own-radius, var(--ags-field-radius)) !important;
	outline: 0;
	background: var(--ags-field-bg, var(--ags-field-fill)) !important;
	box-shadow: none !important;
	color: var(--ags-field-ink) !important;
	font-family: "Neue Haas Unica Field", "Neue Haas Unica", sans-serif !important;
	font-size: var(--ags-field-font, 16px) !important;
	font-weight: 400 !important;
	letter-spacing: -0.46px;
	line-height: 1.4;
	transition: border-color 0.2s;
}

/* Only the variables above differ between kinds of fields, so these need no !important */
textarea {
	--ags-field-own-h: auto;
	--ags-field-own-radius: var(--ags-field-area-radius);
	--ags-field-padding: 20px;
	--ags-field-min-h: 124px;
	line-height: 22px;
	resize: vertical;
}

select {
	--ags-field-padding: 0 56px 0 20px;
	--ags-field-bg: var(--ags-field-fill) var(--ags-field-chevron) right 22px center / 18px 10px no-repeat;
	text-overflow: ellipsis;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

/* The date picker's button: the calendar icon from aesthetics */
input[type="date"]::-webkit-calendar-picker-indicator {
	width: 20px;
	height: 20px;
	padding: 0;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%2390969A'%3E%3Cpath d='M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z'/%3E%3C/svg%3E") center / 20px no-repeat;
	opacity: 1;
	cursor: pointer;
}

:is(input, select, textarea)::placeholder {
	color: var(--ags-field-placeholder);
	opacity: 1;
}

:is(input, select, textarea):not(.ags-search__field):focus {
	--ags-field-line: var(--ags-field-ink);
	outline: 0;
	box-shadow: none !important;
}

/* Line icons inside the fields, as in aesthetics: a person in names, an envelope in emails and
   logins, a phone, a lock in passwords (also while the eye shows the password as text).
   Not in My Account: its fields carry no decorative icons (css/account.css). */
input:is([type="text"], [type="email"], [type="tel"], [type="password"]):is([type="email"], [type="tel"], [type="password"], [name*="name" i], [name="author"], [name*="patronymic"], #username, #user_login):not([name*="telegram"]):not(:where(.woocommerce-account .site-main *)),
.password-input input {
	--ags-field-padding: 0 20px 0 52px;
	--ags-field-bg: var(--ags-field-fill) var(--ags-field-icon) 20px center / 20px no-repeat;
}

input:is([name*="name" i], [name="author"], [name*="patronymic"]) {
	--ags-field-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%2390969A'%3E%3Cpath d='M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z'/%3E%3C/svg%3E");
}

input:is([type="email"], #username, #user_login) {
	--ags-field-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%2390969A'%3E%3Cpath d='M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM203.43,64,128,133.15,52.57,64ZM216,192H40V74.19l82.59,75.71a8,8,0,0,0,10.82,0L216,74.19V192Z'/%3E%3C/svg%3E");
}

input[type="tel"] {
	--ags-field-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%2390969A'%3E%3Cpath d='M222.37,158.46l-47.11-21.11-.13-.06a16,16,0,0,0-15.17,1.4,8.12,8.12,0,0,0-.75.56L134.87,160c-15.42-7.49-31.34-23.29-38.83-38.51l20.78-24.71c.2-.25.39-.5.57-.77a16,16,0,0,0,1.32-15.06l0-.12L97.54,33.64a16,16,0,0,0-16.62-9.52A56.26,56.26,0,0,0,32,80c0,79.4,64.6,144,144,144a56.26,56.26,0,0,0,55.88-48.92A16,16,0,0,0,222.37,158.46ZM176,208A128.14,128.14,0,0,1,48,80,40.2,40.2,0,0,1,82.87,40a.61.61,0,0,0,0,.12l21,47L83.2,111.86a6.13,6.13,0,0,0-.57.77,16,16,0,0,0-1,15.7c9.06,18.53,27.73,37.06,46.46,46.11a16,16,0,0,0,15.75-1.14,8.44,8.44,0,0,0,.74-.56L168.89,152l47,21.05h0s.08,0,.11,0A40.21,40.21,0,0,1,176,208Z'/%3E%3C/svg%3E");
}

input[type="password"],
.password-input input {
	--ags-field-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%2390969A'%3E%3Cpath d='M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z'/%3E%3C/svg%3E");
}

/* The password eye sits inside the field, on the right */
.password-input input {
	--ags-field-padding: 0 52px;
}

/* Phone mask (js/phone-mask.js): the rest of "+38 (0__) ___ __ __" after the typed digits */
.has-phone-ghost {
	position: relative;
}

.woocommerce-input-wrapper.has-phone-ghost {
	display: block;
}

.phone-ghost {
	position: absolute;
	display: flex;
	align-items: center;
	color: var(--ags-field-placeholder);
	white-space: pre;
	pointer-events: none;
}

.phone-ghost[hidden] {
	display: none;
}

.phone-ghost__typed {
	visibility: hidden;
}

/* Invalid after a submit: Contact Form 7, WooCommerce */
:is(input, select, textarea).wpcf7-not-valid,
.woocommerce-invalid :is(input, select, textarea),
.woocommerce-invalid .select2-selection {
	border-color: var(--ags-field-error) !important;
}

.wpcf7-not-valid-tip {
	margin: 6px 0 0 !important;
	color: var(--ags-field-error) !important;
	font-size: 12px !important;
	line-height: 1.4;
}

/* Contact Form 7 wraps every field in a span; the spacing comes from the form's own layout */
.wpcf7-form-control-wrap {
	display: block;
	margin: 0 !important;
}

/* Select2 (Nova Poshta city and warehouse at checkout): the field, and its list continues it */
.select2-container .select2-selection--single {
	position: relative !important;
	box-sizing: border-box;
	padding: 0 !important;
	height: var(--ags-field-h) !important;
	border: 1px solid var(--ags-field-hairline) !important;
	border-radius: var(--ags-field-radius) !important;
	background: var(--ags-field-fill) !important;
	transition: border-color 0.2s;
}

.select2-container .select2-selection--single .select2-selection__rendered {
	padding: 0 56px 0 20px !important;
	color: var(--ags-field-ink) !important;
	font-family: "Neue Haas Unica", sans-serif;
	font-size: 16px !important;
	letter-spacing: -0.46px;
	line-height: calc(var(--ags-field-h) - 2px) !important;
}

.select2-container .select2-selection--single .select2-selection__placeholder {
	color: var(--ags-field-placeholder) !important;
}

/* The same chevron as the selects instead of select2's triangle; it turns over while open */
.select2-container .select2-selection--single .select2-selection__arrow {
	top: 0 !important;
	right: 22px !important;
	width: 18px !important;
	height: 100% !important;
	background: var(--ags-field-chevron) center / 18px 10px no-repeat;
	transform: none !important;
	transition: transform 0.2s;
}

.select2-container--open .select2-selection--single .select2-selection__arrow {
	transform: rotate(180deg) !important;
}

.select2-container .select2-selection--single .select2-selection__arrow b {
	display: none !important;
}

.select2-container--open .select2-selection--single,
.select2-container--focus .select2-selection--single {
	border-color: var(--ags-field-ink) !important;
	box-shadow: none !important;
}

.select2-container--open.select2-container--below .select2-selection--single {
	border-bottom-color: transparent !important;
	border-radius: var(--ags-field-radius) var(--ags-field-radius) 0 0 !important;
}

.select2-container--open.select2-container--above .select2-selection--single {
	border-top-color: transparent !important;
	border-radius: 0 0 var(--ags-field-radius) var(--ags-field-radius) !important;
}

.select2-container .select2-dropdown {
	overflow: hidden;
	border: 1px solid var(--ags-field-ink) !important;
	background: #fff;
	font-family: "Neue Haas Unica", sans-serif;
	font-size: 16px;
	letter-spacing: -0.3px;
}

.select2-container .select2-dropdown--below {
	border-top: 0 !important;
	border-radius: 0 0 var(--ags-field-radius) var(--ags-field-radius) !important;
	box-shadow: 0 16px 24px -8px rgba(0, 0, 0, 0.08) !important;
}

.select2-container .select2-dropdown--above {
	border-bottom: 0 !important;
	border-radius: var(--ags-field-radius) var(--ags-field-radius) 0 0 !important;
	box-shadow: 0 -16px 24px -8px rgba(0, 0, 0, 0.08) !important;
}

.select2-container .select2-search--dropdown {
	padding: 12px 12px 6px;
}

.select2-container .select2-search--dropdown .select2-search__field {
	height: 44px;
	padding: 0 14px !important;
	border: 1px solid var(--ags-field-hairline) !important;
	border-radius: 8px !important;
	outline: 0;
	background: #fff !important;
	font: inherit;
}

.select2-container .select2-search--dropdown .select2-search__field:focus {
	border-color: var(--ags-field-ink) !important;
}

.select2-container .select2-results > .select2-results__options {
	max-height: 280px;
	padding: 6px;
}

.select2-container .select2-results__option {
	padding: 12px 14px;
	border-radius: 8px;
	color: var(--ags-field-ink);
	line-height: 20px;
}

.select2-container .select2-results__option[aria-selected="true"],
.select2-container .select2-results__option--selected {
	background: #f4f4f4 !important;
	color: var(--ags-field-ink) !important;
}

.select2-container .select2-results__option--highlighted[aria-selected],
.select2-container .select2-results__option--highlighted.select2-results__option--selectable {
	background: var(--ags-field-chosen) !important;
	color: var(--ags-field-ink) !important;
}

.select2-container .select2-results__message {
	color: rgba(0, 0, 0, 0.4);
}

/* ------------------------------------------------------------
 * Labels
 * ---------------------------------------------------------- */

/* Contact Form 7: the label above a field (not the text beside a checkbox) */
.wpcf7 label:not(:has(input[type="checkbox"], input[type="radio"])),
:is(.wpcf7, .woocommerce form, .comment-form) :is(.form-row, p:not(.comment-form-cookies-consent), .wpcf7-form-control-wrap) > label:not(.checkbox, .woocommerce-form__label-for-checkbox),
.comment-form :is(.comment-form-author, .comment-form-email, .comment-form-comment, .comment-form-rating) > label {
	display: block;
	margin: 0 0 12px;
	color: var(--ags-field-ink) !important;
	font-family: "Neue Haas Unica", sans-serif;
	font-size: 16px !important;
	font-weight: 400 !important;
	letter-spacing: -0.3px;
	line-height: 18px !important;
}

/* WooCommerce's and the comment form's required mark: a red star, no underline */
.woocommerce form .form-row .required,
.comment-form .required {
	border: 0;
	color: var(--ags-field-error) !important;
	text-decoration: none;
}

/* ------------------------------------------------------------
 * Checkboxes and radios
 * ---------------------------------------------------------- */

/* Contact Form 7 lists on the consultation and collaboration pages drew their own boxes over
   hidden inputs; the inputs are shown again and look like the rest */
.wpcf7-list-item input:is([type="checkbox"], [type="radio"]) {
	position: relative !important;
	display: inline-block !important;
	opacity: 1 !important;
}

.wpcf7-list-item-label::before,
.wpcf7-list-item-label::after {
	content: none !important;
}

.wpcf7-list-item-label {
	font-family: "Neue Haas Unica", sans-serif !important;
	font-size: inherit !important;
	line-height: inherit !important;
}

.wpcf7 .consultation__form-data-wrapper {
	margin-left: 0;
}

/* Every tick box on the site; not the on/off switches (.ags-switch, css/account.css) */
:is(input[type="checkbox"], input[type="radio"]):not(#wpadminbar *, .ags-loyalty-preferences *, .ags-switch) {
	position: relative;
	flex: 0 0 auto;
	box-sizing: border-box;
	width: 20px !important;
	min-width: 20px;
	height: 20px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 1px solid var(--ags-field-border) !important;
	border-radius: 6px !important;
	background: #fff center / 14px no-repeat !important;
	box-shadow: none !important;
	vertical-align: middle;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.2s, border-color 0.2s;
}

input[type="radio"]:not(#wpadminbar *, .ags-loyalty-preferences *, .ags-switch) {
	border-color: rgba(0, 0, 0, 0.2) !important;
	border-radius: 50% !important;
	transition: border 0.2s;
}

/* Some plugins draw their own tick or dot with a pseudo-element */
:is(input[type="checkbox"], input[type="radio"]):not(#wpadminbar *, .ags-loyalty-preferences *, .ags-switch)::before,
:is(input[type="checkbox"], input[type="radio"]):not(#wpadminbar *, .ags-loyalty-preferences *, .ags-switch)::after {
	content: none !important;
}

input[type="checkbox"]:not(#wpadminbar *, .ags-loyalty-preferences *, .ags-switch):checked {
	border-color: var(--ags-field-ink) !important;
	background-color: var(--ags-field-ink) !important;
	background-image: var(--ags-field-tick) !important;
}

input[type="radio"]:not(#wpadminbar *, .ags-loyalty-preferences *, .ags-switch):checked {
	border: 6px solid var(--ags-field-ink) !important;
	background: #fff !important;
}

:is(input[type="checkbox"], input[type="radio"]):not(#wpadminbar *, .ags-switch):focus-visible {
	outline: 2px solid var(--ags-field-ink);
	outline-offset: 2px;
}

/* A box and its text on one line */
.wpcf7-list-item > label,
.woocommerce-form__label-for-checkbox,
.woocommerce form .form-row label.checkbox,
.comment-form-cookies-consent {
	display: inline-flex !important;
	align-items: flex-start;
	gap: 12px;
	margin: 0 !important;
	color: var(--ags-field-text) !important;
	font-size: 16px !important;
	font-weight: 400 !important;
	letter-spacing: -0.46px !important;
	line-height: 20px !important;
	text-transform: none !important;
	cursor: pointer;
}

.wpcf7-list-item {
	margin: 0 !important;
}

/* Contact Form 7 lists of options: one per line, 12px apart */
.wpcf7-checkbox,
.wpcf7-radio,
.wpcf7-acceptance {
	display: flex !important;
	flex-direction: column;
	gap: 12px;
}

/* ------------------------------------------------------------
 * Footer newsletter: email, an optional phone for SMS, the button and the consent line under it
 * (sending the form is the consent, no boxes to tick)
 * ---------------------------------------------------------- */

.site-footer .footer-subscribe-form {
	gap: 12px !important;
}

.site-footer .footer-subscribe-form .footer-form-send {
	height: 52px;
	margin: 4px 0 0 !important;
}

.site-footer .footer-subscribe-note {
	margin: 2px 0 0;
	color: var(--ags-field-text);
	font-size: 12px;
	letter-spacing: -0.2px;
	line-height: 1.5;
}

.site-footer .footer-subscribe-note a {
	color: var(--ags-field-ink);
	text-decoration: underline;
	text-decoration-color: rgba(144, 150, 154, 0.6);
	text-underline-offset: 3px;
}

.site-footer .footer-subscribe-note a:hover {
	text-decoration-color: currentColor;
}

/* ------------------------------------------------------------
 * Catalog: sorting (the filters are styled by the ags-catalog plugin)
 * ---------------------------------------------------------- */

.woocommerce-ordering select.orderby {
	--ags-field-own-h: 48px;
	--ags-field-font: 14px;
	width: auto;
	min-width: 240px;
	text-align: left;
}

/* ------------------------------------------------------------
 * File upload (Contact Form 7 drag and drop, the consultation page)
 * ---------------------------------------------------------- */

.codedropz-upload-handler {
	margin-bottom: 8px !important;
	border: 1px dashed var(--ags-field-border) !important;
	border-radius: var(--ags-field-area-radius) !important;
	background: var(--ags-field-fill);
	transition: border-color 0.2s, background-color 0.2s;
}

.codedropz-upload-handler.codedropz-dragover,
.codedropz-upload-handler:hover {
	border-color: var(--ags-field-ink) !important;
}

.codedropz-upload-inner h3 {
	margin: 0 0 4px !important;
	color: var(--ags-field-ink) !important;
	font-family: "Neue Haas Unica", sans-serif !important;
	font-size: 15px !important;
	font-weight: 400 !important;
}

.codedropz-upload-inner span {
	color: var(--ags-field-placeholder);
	font-size: 13px;
}

.codedropz-upload-inner .cd-upload-btn {
	color: var(--ags-field-ink) !important;
	font-size: 14px;
	text-decoration: underline;
	text-decoration-color: var(--ags-field-border);
	text-underline-offset: 4px;
}

.dnd-upload-counter {
	color: var(--ags-field-placeholder);
}

/* ------------------------------------------------------------
 * Spacing the older templates left out
 * ---------------------------------------------------------- */

/* Checkout's login form: "Remember me" sits above the button, not on it (My Account lays its
   own form out in css/account.css) */
.woocommerce-checkout .woocommerce-form-login .woocommerce-form-login__rememberme {
	margin: 0 0 20px !important;
}

/* Checkout: the "call me back" box, spaced like the other rows */
#ags_callback_requested_field .woocommerce-input-wrapper > label.checkbox {
	margin: 0 0 24px !important;
}

/* A box is optional by nature: no "(необов'язково)" beside it */
.woocommerce form .form-row label.checkbox .optional {
	display: none;
}

/* The consultation and collaboration buttons kept an old font */
.wpcf7 input.wpcf7-submit.consultation__form-submit-button {
	font-family: "Neue Haas Unica", sans-serif !important;
}
