/**
 * Sign in with Apple button (Edwiser Bridge Pro).
 *
 * Apple Human Interface Guidelines: black background, white Apple logo, white title.
 *
 * Size, radius and width are NOT set here for the three themed surfaces. The Apple button uses
 * the Google button's markup (img.eb-sso-social-login-icon + span.eb-sso-gp-lbl inside
 * ul.eb-sso-cont-login-btns), so each surface's existing rules shape it exactly like Google:
 *   - Edwiser account page (.eb-social-section, inline CSS in form-login.php): 50 px circle that
 *     widens to 200 px and reveals the title on hover/focus;
 *   - login modal (.mp-authm-social, mp-auth-modal.css): full width, 40 px / 46 px on touch,
 *     radius 10 px;
 *   - checkout panel (.mp-co-social, mp-checkout.css): full width, 44 px, radius 10 px.
 * This file only changes colours, plus the logo size (see "Logo size" below), with selectors
 * specific enough to win over all three.
 *
 * wp-login.php has no surface styling (only sso-public-css.css), so it is sized below to the
 * Google button's height there (2.3em image + 2 px padding, square corners).
 *
 * Popup flow (sso-apple-popup.js, A1.5): the inline error above the buttons. The certificate-name
 * step is the full-page form served by /apple/callback (A1.6), styled inline there.
 */

/* ── Colours, every surface ───────────────────────────────────────────────────────────────── */

ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"],
ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"]:visited {
	background: #000 !important;
	border-color: #000 !important;
	color: #fff !important;
}

ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"]:hover,
ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"]:focus,
ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"]:active {
	background: #000 !important;
	border-color: #000 !important;
	color: #fff !important;
	box-shadow: 0 3px 12px rgba(0, 0, 0, .28) !important;
}

ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"]:focus-visible {
	outline: 2px solid #114d27 !important;
	outline-offset: 2px !important;
}

ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"] .eb-sso-apple-lbl {
	color: #fff !important;
}

ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"] img.eb-sso-apple-icon {
	object-fit: contain !important;
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
}

/* ── Logo size ────────────────────────────────────────────────────────────────────────────────
 * apple-logo.svg is Apple's official logo-only file: a 56 x 56 viewBox whose central 44 x 44
 * square is the button area, with the logo inside it at Apple's proportions (19 units tall), and
 * 6 units of clear space around that square. Shown in Google's 19-22 px icon box as is, the logo
 * would be about 7 px tall. So:
 *  - the image is sized so that the 44-unit square spans the button's height: the logo keeps
 *    exactly Apple's padding inside the button (logo height = 19/44 of the button height);
 *  - negative margins bring its layout box back to the Google icon's box, so the logo sits where
 *    the Google "G" sits and the title starts at the same place;
 *  - what overflows the box is the file's own transparent padding (clipped on the round
 *    account-page button, which has overflow: hidden); it never takes clicks.
 * Per surface: --eb-apple-btn = button height there, --eb-apple-box = Google icon size there.
 * ------------------------------------------------------------------------------------------- */

ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"] > img.eb-sso-apple-icon {
	--eb-apple-img: calc(var(--eb-apple-btn, 44px) * 56 / 44);
	width: var(--eb-apple-img) !important;
	height: var(--eb-apple-img) !important;
	min-width: 0 !important;
	max-width: none !important;
	min-height: 0 !important;
	max-height: none !important;
	flex: 0 0 auto !important;
	margin: calc((var(--eb-apple-box, 20px) - var(--eb-apple-img)) / 2) !important;
	padding: 0 !important;
	pointer-events: none !important;
}

/* Edwiser account page: 50 px round button, 22 px Google icon. */
.eb-social-section ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"] > img.eb-sso-apple-icon {
	--eb-apple-btn: 50px;
	--eb-apple-box: 22px;
}

/* Login modal: 40 px button (46 px on touch and up to 768 px wide), 20 px Google icon. */
.mp-authm-social ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"] > img.eb-sso-apple-icon {
	--eb-apple-btn: 40px;
	--eb-apple-box: 20px;
}

@media (hover: none), (pointer: coarse), (max-width: 768px) {
	.mp-authm-social ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"] > img.eb-sso-apple-icon {
		--eb-apple-btn: 46px;
	}
}

/* Checkout panel: 44 px button at every width, 19 px Google icon. */
.mp-co-social ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"] > img.eb-sso-apple-icon {
	--eb-apple-btn: 44px;
	--eb-apple-box: 19px;
}

/* No hover lift on touch screens (it sticks after the tap), as the modal does for Google. */
@media (hover: none), (pointer: coarse) {
	ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"]:hover {
		box-shadow: 0 1px 2px rgba(0, 0, 0, .04) !important;
	}
}

/* ── wp-login.php ─────────────────────────────────────────────────────────────────────────── */

body.login ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"] {
	display: inline-flex !important;
	align-items: center !important;
	gap: 8px !important;
	height: 2.3em !important;
	padding: 2px 14px !important;
	box-sizing: content-box !important;
	border-radius: 0 !important;
	text-decoration: none !important;
	line-height: 1 !important;
}

/* Button content is 2.3em tall; the logo keeps a 1.4em layout box (see "Logo size"). */
body.login ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"] > img.eb-sso-apple-icon {
	--eb-apple-btn: 2.3em;
	--eb-apple-box: 1.4em;
}

body.login ul.eb-sso-cont-login-btns li a.eb-sso-apple-btn[data-eb-sso-provider="apple"] .eb-sso-apple-lbl {
	font-size: 14px !important;
	font-weight: 600 !important;
}

/* ── Popup flow (sso-apple-popup.js): inline error ───────────────────────────────────────────
 * Inserted just above the provider buttons with the surface's own error class (.mp-authm-error
 * in the modal, .wdm-flash-error at checkout and on the account page), whose !important rules
 * win. These plain rules only apply where a surface has none (e.g. the bare shortcode).
 * ------------------------------------------------------------------------------------------- */

.eb-sso-apple-error {
	margin: 0 0 14px;
	padding: 11px 13px;
	border: 1px solid #f0c2c2;
	border-radius: 8px;
	background: #fdf2f2;
	color: #8a1f1f;
	font-size: 13px;
	line-height: 1.5;
	text-align: left;
}

/* ── Error notice printed above the button (only where the account page notice did not run) ── */

ul.eb-sso-cont-login-btns li.eb-sso-apple-notice {
	display: block !important;
	flex: 0 0 100% !important;
	width: 100% !important;
	box-sizing: border-box !important;
	list-style: none !important;
	margin: 0 0 8px !important;
	padding: 10px 12px !important;
	border-left: 4px solid #d63638 !important;
	border-radius: 4px !important;
	background: #fcf0f1 !important;
	color: #1d2327 !important;
	font-size: 14px !important;
	line-height: 1.45 !important;
	text-align: left !important;
	white-space: normal !important;
}
