/**
 * Sunparts Rackbeat Commerce — front-end styles.
 *
 * Styling for the custom B2B login form, store selector and active-store
 * switcher. Tuned to match the Sunparts storefront (hello-elementor):
 * futura-pt typography (inherited from the theme), green CTA (#1BB65C),
 * Sunparts yellow accent (#FDB735) and the site's neutral borders (#D9D9D9).
 *
 * Scoped under .sunparts-auth so it never leaks into the rest of the theme,
 * plus a small block for the quantity +/- inputs at the end.
 */

.sunparts-auth {
	--sp-green: #1bb65c;
	--sp-green-dark: #159a4d;
	--sp-yellow: #fdb735;
	--sp-ink: #000;
	--sp-muted: #6b6b6b;
	--sp-border: #d9d9d9;
	--sp-bg-soft: #fbf4ec;
	--sp-radius: 6px;

	max-width: 420px;
	margin: 3rem auto;
	padding: 2rem 2rem 2.25rem;
	background: #fff;
	border: 1px solid var(--sp-border);
	border-radius: var(--sp-radius);
	box-shadow: 0 2px 18px rgba(0, 0, 0, 0.06);
	box-sizing: border-box;
}

/* A slightly wider card for the store selector list. */
.sunparts-auth--wide {
	max-width: 520px;
}

.sunparts-auth__intro {
	margin: 0 0 1.5rem;
	text-align: center;
}

.sunparts-auth__intro h1,
.sunparts-auth__intro h2 {
	margin: 0 0 0.35rem;
	font-size: 1.6rem;
	line-height: 1.2;
	color: var(--sp-ink);
}

.sunparts-auth__intro p {
	margin: 0;
	color: var(--sp-muted);
	font-size: 0.95rem;
}

/* Top accent bar — Sunparts green. */
.sunparts-auth::before {
	content: "";
	display: block;
	height: 4px;
	width: 56px;
	margin: 0 auto 1.5rem;
	background: var(--sp-green);
	border-radius: 4px;
}

/* --- Fields ------------------------------------------------------------- */

.sunparts-login__field,
.sunparts-auth .form-row {
	margin: 0 0 1.1rem;
}

.sunparts-login__field label {
	display: block;
	margin-bottom: 0.35rem;
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--sp-ink);
}

.sunparts-login__field input,
.sunparts-auth input[type="email"],
.sunparts-auth input[type="password"],
.sunparts-auth input[type="text"] {
	width: 100%;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--sp-border);
	border-radius: var(--sp-radius);
	font-size: 1rem;
	line-height: 1.3;
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sunparts-login__field input:focus,
.sunparts-auth input:focus {
	outline: none;
	border-color: var(--sp-green);
	box-shadow: 0 0 0 3px rgba(27, 182, 92, 0.15);
}

/* --- Buttons ------------------------------------------------------------ */

.sunparts-auth .button,
.sunparts-auth button[type="submit"] {
	display: inline-block;
	width: 100%;
	padding: 0.8rem 1.25rem;
	background: var(--sp-green);
	color: #fff;
	border: none;
	border-radius: var(--sp-radius);
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	cursor: pointer;
	text-align: center;
	transition: background-color 0.15s ease;
}

.sunparts-auth .button:hover,
.sunparts-auth button[type="submit"]:hover {
	background: var(--sp-green-dark);
}

.sunparts-login__actions,
.sunparts-store-selector__actions {
	margin: 1.4rem 0 0;
}

/* --- Messages ----------------------------------------------------------- */

.sunparts-login__message {
	margin: 0 0 1.25rem;
	padding: 0.8rem 1rem;
	border-radius: var(--sp-radius);
	font-size: 0.92rem;
	line-height: 1.4;
}

.sunparts-login__message.is-error {
	background: #fdecec;
	border: 1px solid #f3b6b6;
	color: #8a1f1f;
}

.sunparts-login__message.is-notice {
	background: var(--sp-bg-soft);
	border: 1px solid var(--sp-yellow);
	color: #6b4e00;
}

/* --- Secondary links (forgot password etc.) ---------------------------- */

.sunparts-auth__links {
	margin: 1.1rem 0 0;
	text-align: center;
	font-size: 0.9rem;
}

.sunparts-auth__links a {
	color: var(--sp-green-dark);
	text-decoration: none;
}

.sunparts-auth__links a:hover {
	text-decoration: underline;
}

/* --- Store selector ----------------------------------------------------- */

.sunparts-store-selector h2 {
	margin: 0 0 1.1rem;
	font-size: 1.3rem;
	text-align: center;
}

.sunparts-store-selector__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.sunparts-store-selector__item {
	margin: 0 0 0.6rem;
}

.sunparts-store-selector__item label {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.85rem 1rem;
	border: 1px solid var(--sp-border);
	border-radius: var(--sp-radius);
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.sunparts-store-selector__item label:hover {
	border-color: var(--sp-green);
	background: #f6fbf8;
}

.sunparts-store-selector__item input[type="radio"] {
	accent-color: var(--sp-green);
	margin: 0;
	flex: 0 0 auto;
}

.sunparts-store-selector__name {
	font-weight: 600;
	color: var(--sp-ink);
}

.sunparts-store-selector__market {
	color: var(--sp-muted);
	font-size: 0.88rem;
}

/* --- Checkout: Rackbeat address selector ------------------------------- */

/* Hide the standard "ship to a different address" toggle + shipping fields —
   delivery addresses come from Rackbeat via the selector below. */
.woocommerce-shipping-fields {
	display: none;
}

.sunparts-address-selector {
	margin: 1.25rem 0 1.5rem;
}

.sunparts-address-summary {
	margin: 0.6rem 0 0.4rem;
	padding: 0.8rem 1rem;
	background: #fbf4ec;
	border: 1px solid #d9d9d9;
	border-radius: 6px;
	color: #000;
	font-size: 0.95rem;
	line-height: 1.4;
	min-height: 1.2em;
}

.sunparts-address-summary:empty {
	display: none;
}

/* --- Active-store switcher (header / account) -------------------------- */

.sunparts-active-store {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.92rem;
}

.sunparts-active-store__current {
	margin: 0;
}

.sunparts-active-store__switch {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
}

.sunparts-active-store__switch select {
	padding: 0.45rem 0.6rem;
	border: 1px solid var(--sp-border);
	border-radius: var(--sp-radius);
}

.sunparts-active-store__switch .button {
	width: auto;
	padding: 0.5rem 1rem;
	font-size: 0.9rem;
}

.sunparts-active-store__switch .description {
	flex-basis: 100%;
	color: var(--sp-muted);
}

/* --- My-account: switch-store endpoint --------------------------------- */

/* Rendered outside the .sunparts-auth scope, so the palette is re-declared
   locally to keep the brand tokens available here. */
.sunparts-account-stores {
	--sp-green: #1bb65c;
	--sp-green-dark: #159a4d;
	--sp-yellow: #fdb735;
	--sp-ink: #000;
	--sp-muted: #6b6b6b;
	--sp-border: #d9d9d9;

	max-width: 640px;
}

.sunparts-account-stores__active {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.4rem 0.6rem;
	margin: 0 0 1.4rem;
	padding-bottom: 1.1rem;
	border-bottom: 1px solid var(--sp-border);
}

.sunparts-account-stores__active-label {
	color: var(--sp-muted);
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.sunparts-account-stores__active strong {
	color: var(--sp-ink);
	font-size: 1.1rem;
	font-weight: 700;
}

.sunparts-store-cards {
	list-style: none;
	margin: 0 0 1.25rem;
	padding: 0;
	display: grid;
	gap: 0.75rem;
}

.sunparts-store-cards__item {
	margin: 0;
}

.sunparts-store-cards__item label {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	padding: 1rem 1.15rem;
	background: #fff;
	border: 1px solid var(--sp-border);
	border-radius: 8px;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.sunparts-store-cards__item label:hover {
	border-color: var(--sp-green);
	background: #f6fbf8;
}

.sunparts-store-cards__item.is-active label {
	border-color: var(--sp-green);
	background: #f6fbf8;
	box-shadow: inset 0 0 0 1px var(--sp-green);
}

.sunparts-store-cards__item input[type="radio"] {
	width: 1.15rem;
	height: 1.15rem;
	margin: 0;
	flex: 0 0 auto;
	accent-color: var(--sp-green);
}

.sunparts-store-cards__body {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	flex: 1 1 auto;
	min-width: 0;
}

.sunparts-store-cards__name {
	font-weight: 600;
	font-size: 1rem;
	line-height: 1.25;
	color: var(--sp-ink);
}

.sunparts-store-cards__meta {
	color: var(--sp-muted);
	font-size: 0.85rem;
}

.sunparts-store-cards__badge {
	flex: 0 0 auto;
	padding: 0.22rem 0.65rem;
	background: var(--sp-green);
	color: #fff;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	border-radius: 999px;
}

.sunparts-account-stores__note {
	margin: 0 0 1.4rem;
	padding: 0.75rem 1rem;
	background: #fbf4ec;
	border: 1px solid var(--sp-yellow);
	border-radius: var(--sp-radius, 6px);
	color: #6b4e00;
	font-size: 0.88rem;
	line-height: 1.4;
}

.sunparts-account-stores__actions {
	margin: 0;
}

.sunparts-account-stores__submit {
	display: inline-block;
	width: auto;
	min-width: 200px;
	padding: 0.8rem 1.5rem;
	background: var(--sp-green);
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	cursor: pointer;
	text-align: center;
	transition: background-color 0.15s ease;
}

.sunparts-account-stores__submit:hover,
.sunparts-account-stores__submit:focus {
	background: var(--sp-green-dark);
	color: #fff;
}

.sunparts-account-stores__single {
	margin: 0;
	color: var(--sp-muted);
}

/*
 * Quantity +/- buttons (SUNP-36, assets/js/quantity-buttons.js).
 *
 * On the single product page and in the shop/category listings the +/-
 * buttons are the only control, so the browser's native spinner arrows are
 * hidden on the inputs the script has enhanced ([data-sunparts-qty]). The
 * cart keeps the native arrows: the Elementor kit CSS hides the injected
 * buttons there.
 */
body:not(.woocommerce-cart) .quantity input[type="number"][data-sunparts-qty] {
	-moz-appearance: textfield;
	appearance: textfield;
}

body:not(.woocommerce-cart) .quantity input[type="number"][data-sunparts-qty]::-webkit-inner-spin-button,
body:not(.woocommerce-cart) .quantity input[type="number"][data-sunparts-qty]::-webkit-outer-spin-button {
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
}

/*
 * Shop/category listing cards: keep "- [qty] +" and "Add to cart" on one
 * compact row. The kit CSS sizes the +/- buttons for the single product page
 * (wide pills with 10px margins), which in a narrow loop card pushes the
 * button onto three lines and, with flex's default stretch, makes the input
 * as tall as the wrapped button.
 */
.e-loop-add-to-cart-form .e-atc-qty-button-holder {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.e-loop-add-to-cart-form .quantity {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	margin: 0;
}

.e-loop-add-to-cart-form .quantity input.qty {
	width: 52px !important;
	height: 40px;
	margin: 0;
	padding: 0 4px;
	text-align: center;
}

.e-loop-add-to-cart-form .quantity button.quantity-button {
	width: 36px !important;
	min-width: 36px;
	height: 40px;
	margin: 0 4px !important;
	padding: 0 !important;
	line-height: 1;
}

.e-loop-add-to-cart-form .add_to_cart_button {
	flex: 1 1 auto;
	min-width: 110px;
	text-align: center;
	white-space: nowrap;
}

/*
 * No hover/focus effect on the +/- buttons. The kit's global button style
 * adds a solid border on hover with a transition, which flashes around the
 * small round buttons. Keep the resting look in every state; keyboard focus
 * still gets a visible outline.
 */
.quantity button.quantity-button,
.quantity button.quantity-button:hover,
.quantity button.quantity-button:focus,
.quantity button.quantity-button:active {
	border: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
	transition: none !important;
	background-color: var(--e-global-color-635fb9d, #fafafa) !important;
	color: var(--e-global-color-text, #000) !important;
}

.quantity button.quantity-button:focus-visible {
	outline: 2px solid var(--e-global-color-text, #000) !important;
	outline-offset: 2px;
}

/*
 * After an AJAX add-to-cart WooCommerce appends a "View cart" link next to
 * the button, which grows the listing card and shifts the grid. The header
 * cart icon already reflects the addition, so hide the link in loop cards.
 */
.e-loop-add-to-cart-form-container a.added_to_cart {
	display: none !important;
}
