/* ==========================================================================
   CloudBulkSale - purchase interface, header cart, Telegram support,
   and the cart/checkout pages.
   Loaded after cbs.css and cbs-wc.css. Bump ?v= in parts/header.html.
   ========================================================================== */

/* ============================================ 1. PURCHASE INTERFACE
   Chartreuse stays the single primary action on the product page: Add to
   Cart owns it, and the Telegram card is a bordered secondary.
   ========================================================================== */

.cbs-panel__label {
	font-family: var(--cbs-font-display);
	font-size: 1.0625rem;
	font-weight: 700;
	color: var(--cbs-pearl);
	margin: var(--cbs-md) 0 var(--cbs-xs);
	letter-spacing: -0.01em;
}

.cbs-panel__hint {
	margin: 0 0 var(--cbs-sm);
	font-size: 0.8125rem;
	line-height: 1.5;
	color: var(--cbs-muted);
}

/* The native "Variant" label cell is replaced by .cbs-panel__label. */
.cbs-panel .variations th.label {
	display: none;
}

.cbs-panel .variations td.value {
	display: block;
	width: 100%;
}

/* ---- Select: the reported low-contrast bug ----
   A dark select inherits its colour into the popup on several platforms, which
   rendered pale text on the OS white option list. The control and every option
   now carry an explicit background AND colour, plus a dark color-scheme hint
   so Windows and Linux honour them. */
.cbs-panel select {
	width: 100%;
	appearance: none;
	color-scheme: dark;
	background-color: var(--cbs-plum);
	color: var(--cbs-pearl);
	border: 1px solid var(--cbs-stroke-muted);
	border-radius: var(--cbs-r-md);
	font-family: var(--cbs-font-body);
	font-size: 1rem;
	font-weight: 500;
	line-height: 1.3;
	padding: 15px 44px 15px 16px;
	cursor: pointer;
	background-image:
		linear-gradient(45deg, transparent 50%, var(--cbs-muted) 50%),
		linear-gradient(135deg, var(--cbs-muted) 50%, transparent 50%);
	background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
	background-size: 7px 7px, 7px 7px;
	background-repeat: no-repeat;
	transition: border-color 160ms var(--cbs-ease);
}

.cbs-panel select option {
	background-color: #1E1430;
	color: #F5F2EC;
}

.cbs-panel select:hover {
	border-color: var(--cbs-muted);
}

.cbs-panel select:focus-visible {
	outline: 2px solid var(--cbs-chartreuse);
	outline-offset: 2px;
	border-color: var(--cbs-chartreuse);
}

.cbs-panel.has-selection select {
	border-color: rgba(210, 240, 75, 0.55);
}

.cbs-panel .reset_variations {
	display: inline-block;
	font-size: 0.8125rem;
	color: var(--cbs-muted);
	margin: var(--cbs-xs) 0 0;
	text-decoration: underline;
}

.cbs-panel .reset_variations:hover {
	color: var(--cbs-chartreuse);
}

.cbs-panel:not(.has-selection) .reset_variations {
	display: none;
}

/* ---- Selected configuration summary ---- */
.cbs-chosen {
	display: none;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--cbs-sm);
	margin: var(--cbs-sm) 0 0;
	padding: var(--cbs-sm) var(--cbs-md);
	background: var(--cbs-raised);
	border: 1px solid var(--cbs-hairline);
	border-radius: var(--cbs-r-md);
}

.cbs-panel.has-selection .cbs-chosen {
	display: flex;
}

.cbs-chosen__label {
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--cbs-muted);
	flex: 0 0 auto;
}

.cbs-chosen__value {
	font-family: var(--cbs-font-mono);
	font-size: 0.875rem;
	color: var(--cbs-pearl);
	text-align: right;
}

/* ---- Price ---- */
.cbs-panel .woocommerce-variation-price {
	margin: var(--cbs-md) 0 0;
}

.cbs-panel .woocommerce-variation-price .price {
	font-family: var(--cbs-font-mono);
	font-size: 2rem;
	font-weight: 500;
	line-height: 1.05;
	color: var(--cbs-pearl);
}

.cbs-panel .woocommerce-variation-price .price del {
	display: none;
}

.cbs-panel .woocommerce-variation-description {
	display: none;
}

/* ---- Quantity ---- */
.cbs-panel .quantity {
	display: inline-flex;
	align-items: center;
	margin: 0;
}

.cbs-panel .quantity label {
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--cbs-muted);
	margin-right: var(--cbs-sm);
}

.cbs-panel .quantity input[type="number"],
.cbs-panel input.qty {
	width: 88px;
	color-scheme: dark;
	background: var(--cbs-plum);
	color: var(--cbs-pearl);
	border: 1px solid var(--cbs-stroke-muted);
	border-radius: var(--cbs-r-md);
	font-family: var(--cbs-font-mono);
	font-size: 1rem;
	text-align: center;
	padding: 14px 8px;
}

.cbs-panel input.qty:focus-visible {
	outline: 2px solid var(--cbs-chartreuse);
	outline-offset: 2px;
	border-color: var(--cbs-chartreuse);
}

/* ---- Add to cart ---- */
.cbs-panel .woocommerce-variation-add-to-cart,
.cbs-panel form.cart:not(.variations_form) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--cbs-sm);
	margin-top: var(--cbs-md);
}

.cbs-panel .single_add_to_cart_button {
	flex: 1 1 180px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	min-height: 52px;
	padding: 15px 28px;
	border: 1px solid transparent;
	border-radius: var(--cbs-r-pill);
	background: var(--cbs-chartreuse);
	color: var(--cbs-plum);
	font-family: var(--cbs-font-body);
	font-size: 0.9375rem;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	transition: background 160ms var(--cbs-ease), color 160ms var(--cbs-ease),
		transform 140ms var(--cbs-ease);
}

.cbs-panel .single_add_to_cart_button:hover:not(.disabled):not(.is-busy) {
	background: var(--cbs-pearl);
}

.cbs-panel .single_add_to_cart_button:active:not(.disabled) {
	transform: translateY(1px);
}

.cbs-panel .single_add_to_cart_button:focus-visible {
	outline: 2px solid var(--cbs-pearl);
	outline-offset: 3px;
}

/* WooCommerce marks the button .disabled until a valid variation is chosen.
   Show that honestly rather than letting someone click into a failure. */
.cbs-panel .single_add_to_cart_button.disabled,
.cbs-panel .single_add_to_cart_button[disabled] {
	background: var(--cbs-raised);
	color: var(--cbs-muted);
	border-color: var(--cbs-hairline);
	cursor: not-allowed;
}

.cbs-panel .single_add_to_cart_button.is-busy {
	color: transparent;
	position: relative;
	cursor: progress;
}

.cbs-panel .single_add_to_cart_button.is-busy::after {
	content: "";
	position: absolute;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(20, 13, 31, 0.35);
	border-top-color: var(--cbs-plum);
	border-radius: var(--cbs-r-pill);
	animation: cbs-spin 640ms linear infinite;
}

@keyframes cbs-spin {
	to { transform: rotate(360deg); }
}

/* ---- Feedback ---- */
.cbs-feedback {
	display: none;
	align-items: flex-start;
	gap: 10px;
	margin-top: var(--cbs-sm);
	padding: 12px var(--cbs-md);
	border-radius: var(--cbs-r-md);
	font-size: 0.875rem;
	line-height: 1.5;
	border: 1px solid var(--cbs-hairline);
	background: var(--cbs-raised);
	color: var(--cbs-pearl);
}

.cbs-feedback.is-shown {
	display: flex;
}

.cbs-feedback--ok {
	border-color: rgba(210, 240, 75, 0.5);
}

.cbs-feedback--err {
	border-color: rgba(255, 94, 58, 0.6);
}

.cbs-feedback__icon {
	flex: 0 0 auto;
	width: 17px;
	height: 17px;
	margin-top: 1px;
}

.cbs-feedback--ok .cbs-feedback__icon {
	color: var(--cbs-chartreuse);
}

.cbs-feedback--err .cbs-feedback__icon {
	color: var(--cbs-coral);
}

.cbs-feedback a {
	color: var(--cbs-chartreuse);
	text-decoration: underline;
	font-weight: 600;
}

/* WooCommerce's own notices, restyled rather than hidden. */
.cbs-panel .wc-no-matching-variations,
.cbs-panel .stock.out-of-stock {
	margin-top: var(--cbs-sm);
	padding: 12px var(--cbs-md);
	border: 1px solid rgba(255, 94, 58, 0.6);
	border-radius: var(--cbs-r-md);
	background: var(--cbs-raised);
	color: var(--cbs-pearl);
	font-size: 0.875rem;
}

/* ================================================ 2. HEADER CART */

.cbs-cart {
	position: relative;
	display: inline-grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border: 1px solid transparent;
	border-radius: var(--cbs-r-pill);
	color: var(--cbs-pearl);
	text-decoration: none;
	transition: border-color 160ms var(--cbs-ease), color 160ms var(--cbs-ease);
}

.cbs-cart:hover,
.cbs-cart:focus-visible {
	border-color: var(--cbs-hairline-strong);
	color: var(--cbs-chartreuse);
	text-decoration: none;
}

.cbs-cart svg {
	width: 19px;
	height: 19px;
}

.cbs-cart__count {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	box-sizing: border-box;
	display: none;
	place-items: center;
	border-radius: var(--cbs-r-pill);
	background: var(--cbs-chartreuse);
	color: var(--cbs-plum);
	font-family: var(--cbs-font-mono);
	font-size: 0.6875rem;
	font-weight: 700;
	line-height: 1;
}

/* Empty is the default state; the badge appears only once there is something
   in the cart, so an empty cart reads as empty at a glance. */
.cbs-cart.has-items .cbs-cart__count {
	display: grid;
}

.cbs-cart.has-items {
	color: var(--cbs-chartreuse);
}

/* ============================================ 3. TELEGRAM SUPPORT */

.cbs-tgbtn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 16px 9px 13px;
	border-radius: var(--cbs-r-pill);
	border: 1px solid var(--cbs-stroke-muted);
	background: none;
	color: var(--cbs-pearl);
	font-family: var(--cbs-font-body);
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	transition: border-color 160ms var(--cbs-ease), background 160ms var(--cbs-ease);
}

.cbs-tgbtn svg {
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
}

.cbs-tgbtn:hover,
.cbs-tgbtn:focus-visible {
	border-color: var(--cbs-chartreuse);
	background: rgba(210, 240, 75, 0.08);
	color: var(--cbs-pearl);
	text-decoration: none;
}

/* ---- Product support card ---- */
.cbs-tgcard {
	margin-top: var(--cbs-md);
	padding: var(--cbs-md);
	border: 1px solid var(--cbs-hairline);
	border-radius: var(--cbs-r-lg);
	background: var(--cbs-surface);
}

.cbs-tgcard__title {
	font-family: var(--cbs-font-display);
	font-size: 1rem;
	font-weight: 700;
	color: var(--cbs-pearl);
	margin: 0 0 var(--cbs-xs);
}

.cbs-tgcard__text {
	margin: 0 0 var(--cbs-sm);
	font-size: 0.875rem;
	line-height: 1.55;
	color: var(--cbs-muted);
}

.cbs-tgcard .cbs-tgbtn {
	width: 100%;
	justify-content: center;
}

/* ---- Footer support block ---- */
.cbs-footer__support p {
	margin: 0 0 var(--cbs-sm);
	font-size: 0.9375rem;
	line-height: 1.6;
	color: var(--cbs-muted);
	max-width: 34ch;
}

/* ---- Floating button ---- */
.cbs-fab {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 90;
	display: inline-grid;
	place-items: center;
	width: 52px;
	height: 52px;
	border-radius: var(--cbs-r-pill);
	background: var(--cbs-surface);
	border: 1px solid var(--cbs-hairline-strong);
	color: var(--cbs-chartreuse);
	text-decoration: none;
	box-shadow: var(--cbs-shadow);
	transition: transform 180ms var(--cbs-ease), border-color 180ms var(--cbs-ease);
}

.cbs-fab svg {
	width: 23px;
	height: 23px;
}

.cbs-fab:hover,
.cbs-fab:focus-visible {
	transform: translateY(-3px);
	border-color: var(--cbs-chartreuse);
	text-decoration: none;
}

.cbs-fab:focus-visible {
	outline: 2px solid var(--cbs-chartreuse);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.cbs-fab {
		transition: none;
	}

	.cbs-fab:hover,
	.cbs-fab:focus-visible {
		transform: none;
	}

	.cbs-panel .single_add_to_cart_button.is-busy::after {
		animation-duration: 2.4s;
	}
}

/* Keep the floating button clear of the purchase controls on phones. */
@media (max-width: 600px) {
	.cbs-fab {
		right: 16px;
		bottom: 16px;
		width: 48px;
		height: 48px;
	}

	.cbs-panel .woocommerce-variation-add-to-cart {
		padding-right: 60px;
	}

	.cbs-panel .single_add_to_cart_button {
		flex: 1 1 100%;
	}

	.cbs-panel .quantity,
	.cbs-panel .quantity input[type="number"] {
		width: 100%;
	}
}

/* ======================================= 4. CART AND CHECKOUT PAGES
   WooCommerce's cart and checkout blocks ship light-themed defaults. Bring
   them onto the plum ground so no white slab lands mid-site.
   ========================================================================== */

.wp-block-woocommerce-cart,
.wp-block-woocommerce-checkout,
.wc-block-components-sidebar-layout {
	color: var(--cbs-pearl);
}

.wc-block-components-product-name,
.wc-block-components-product-metadata,
.wc-block-cart-item__wrap,
.wc-block-components-totals-item__label,
.wc-block-components-totals-item__value,
.wc-block-components-order-summary-item__description,
.wc-block-components-title,
.wc-block-components-checkout-step__title,
.wc-block-components-checkout-step__description,
.wc-block-cart__empty-cart__title {
	color: var(--cbs-pearl);
}

.wc-block-components-product-name {
	text-decoration: none;
	font-weight: 600;
}

.wc-block-components-product-name:hover {
	color: var(--cbs-chartreuse);
}

.wc-block-cart-items,
.wc-block-cart-items__row,
.wc-block-components-totals-wrapper {
	border-color: var(--cbs-hairline) !important;
}

.wc-block-cart-items__header {
	color: var(--cbs-muted);
	border-bottom: 1px solid var(--cbs-hairline);
}

.wc-block-components-sidebar {
	background: var(--cbs-surface);
	border: 1px solid var(--cbs-hairline);
	border-radius: var(--cbs-r-lg);
	padding: var(--cbs-md);
}

.wc-block-components-button,
.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button {
	background: var(--cbs-chartreuse) !important;
	color: var(--cbs-plum) !important;
	border-radius: var(--cbs-r-pill) !important;
	font-family: var(--cbs-font-body) !important;
	font-weight: 700 !important;
	min-height: 52px;
}

.wc-block-components-button:hover,
.wc-block-cart__submit-button:hover {
	background: var(--cbs-pearl) !important;
}

.wc-block-components-text-input input,
.wc-block-components-textarea,
.wc-block-components-select select,
.wc-block-components-quantity-selector input {
	color-scheme: dark;
	background: var(--cbs-plum) !important;
	color: var(--cbs-pearl) !important;
	border-color: var(--cbs-stroke-muted) !important;
}

.wc-block-components-text-input label,
.wc-block-components-select label {
	color: var(--cbs-muted) !important;
}

.wc-block-components-quantity-selector {
	border-color: var(--cbs-stroke-muted) !important;
	background: var(--cbs-plum);
	border-radius: var(--cbs-r-md);
}

.wc-block-components-quantity-selector__button {
	color: var(--cbs-pearl) !important;
	background: none !important;
}

.wc-block-components-quantity-selector__button:hover {
	color: var(--cbs-chartreuse) !important;
}

.wc-block-components-product-price__value,
.wc-block-formatted-money-amount {
	font-family: var(--cbs-font-mono);
	color: var(--cbs-pearl);
}

.wc-block-components-notice-banner {
	background: var(--cbs-surface) !important;
	color: var(--cbs-pearl) !important;
	border-radius: var(--cbs-r-md);
}

/* The header Telegram pill folds into the drawer on small screens; the cart
   icon always stays reachable in the header. */
@media (max-width: 960px) {
	.cbs-tgbtn--header { display: none; }
}

@media (max-width: 420px) {
	.cbs-util { gap: 2px; }
}
