/* ==========================================================================
   Fulfillment Picker — Checkout UI
   Matches the berry-box design system tokens.
   ========================================================================== */

/* ==========================================================================
   Checkout Page Overrides
   ========================================================================== */

/* Hide WooCommerce's built-in shipping rate radio buttons — our fulfillment picker replaces them.
   We hide only the radio options, not the container, so WC internals stay intact. */
.wc-block-components-shipping-rates-control .wc-block-components-radio-control {
	display: none !important;
}

.wc-block-components-shipping-rates-control__no-results {
	display: none !important;
}

/* Remove top gap on checkout page. */
.wp-block-woocommerce-checkout.alignwide.wc-block-checkout {
	padding-top: 0 !important;
}

/* Ensure the Stackable column wrapping the checkout can grow */
.stk-block-column:has(.wp-block-woocommerce-checkout) {
	overflow: visible !important;
}

.stk-block-column:has(.wp-block-woocommerce-checkout) .stk-column-wrapper {
	overflow: visible !important;
}

.wc-block-components-notices {
	margin-top: 0 !important;
}

/* Sticky order summary sidebar.
   The parent .wc-block-components-sidebar-layout is display:flex row-reverse.
   Default align-items:stretch makes the sidebar match the main column height,
   which prevents sticky from working. flex-start lets it be shorter. */
.wc-block-components-sidebar-layout.wc-block-checkout {
	align-items: flex-start !important;
}

.wc-block-components-sidebar.wc-block-checkout__sidebar {
	position: -webkit-sticky !important;
	position: sticky !important;
	top: 20px !important;
}

/* On mobile the sidebar drops below the form — sticky just pins the order
   summary to the top of the viewport and steals screen space. Disable it. */
@media (max-width: 782px) {
	.wc-block-components-sidebar.wc-block-checkout__sidebar {
		position: static !important;
		top: auto !important;
	}
}

.wp-block-woocommerce-checkout .wc-block-components-notice-banner:first-child {
	margin-top: 0 !important;
}


/* Green banner headings for all checkout sections */
.wc-block-components-checkout-step {
	padding-top: 0 !important;
	margin-top: 0 !important;
}

.wc-block-components-checkout-step__heading-container {
	background: #33a64f !important;
	margin: 0 -1.25rem 1rem !important;
	padding: 10px 1.25rem !important;
	border-radius: 0 8px 8px 0;
	margin-left: -1.5rem !important;
	padding-left: 1.5rem !important;
}

/* Kill the white gap above the first section */
.wc-block-checkout__main > form {
	padding-top: 0 !important;
}

.wc-block-checkout__main > form > div:first-child,
.wc-block-checkout__main > form > fieldset:first-child {
	margin-top: 0 !important;
	padding-top: 0 !important;
}

/* Collapse any notices container gap at the top */
.wc-block-checkout__main .wc-block-components-notices:first-child:empty,
.wc-block-checkout__main .wc-block-components-notices__snackbar:first-child {
	margin: 0 !important;
	padding: 0 !important;
}

.wc-block-components-checkout-step__title {
	color: #fff !important;
	font-family: 'Marck Script', cursive !important;
	font-size: 30px !important;
	font-weight: 400 !important;
	margin: 0 !important;
	text-transform: capitalize !important;
}

/* Consistent spacing under all heading containers */
.wc-block-components-checkout-step__content {
	margin-top: 1rem !important;
}

/* "Shipping options" heading → "Fulfillment" */
#shipping-option .wc-block-components-checkout-step__title {
	font-size: 0 !important;
}

#shipping-option .wc-block-components-checkout-step__title::after {
	content: "Fulfillment";
	font-size: 30px;
	font-family: 'Marck Script', cursive;
	font-weight: 400;
	color: #fff;
}

/* Hide the screen-reader legend too (it still says "Shipping options") */
#shipping-option > legend {
	display: none;
}

/* Reorder checkout sections: move Fulfillment above address */
.wc-block-checkout__form {
	display: flex !important;
	flex-direction: column !important;
}

#contact-fields { order: 1 !important; }
#shipping-option { order: 2 !important; }
#shipping-fields { order: 3 !important; }
#billing-fields { order: 4 !important; }
#payment-method { order: 5 !important; }
.wc-block-checkout__order-notes { order: 6 !important; }
.wc-block-checkout__terms { order: 7 !important; }
.wc-block-checkout__actions { order: 8 !important; }

/* Catch-all: empty WC block placeholders and notices stay near top */
.wc-block-checkout__form > [data-block-name] { order: 0 !important; }
.wc-block-checkout__form > div:first-child { order: 0 !important; }

/* Hide address sections until a fulfillment method is chosen */
.wc-block-checkout__form:not([data-fulfillment-type]) #shipping-fields,
.wc-block-checkout__form:not([data-fulfillment-type]) #billing-fields,
.wc-block-checkout__form:not([data-fulfillment-type]) .wc-block-checkout__use-address-for-billing {
	display: none !important;
}

/* Rename "Shipping address" based on fulfillment type.
   JS toggles data-fulfillment-type on the form. */
.wc-block-checkout__form[data-fulfillment-type="delivery"] #shipping-fields .wc-block-components-checkout-step__title {
	font-size: 0 !important;
}
.wc-block-checkout__form[data-fulfillment-type="delivery"] #shipping-fields .wc-block-components-checkout-step__title::after {
	content: "Delivery Address";
	font-size: 30px;
	font-family: 'Marck Script', cursive;
	font-weight: 400;
	color: #fff;
}

/* For pickup: hide shipping address, show billing instead */
.wc-block-checkout__form[data-fulfillment-type="pickup"] #shipping-fields {
	display: none !important;
}

/* Ensure "Use same address for billing" checkbox is hidden for pickup
   since we're showing billing directly */
.wc-block-checkout__form[data-fulfillment-type="pickup"] .wc-block-checkout__use-address-for-billing {
	display: none !important;
}

/* Visually disable Place Order button until fulfillment is selected */
.wc-block-components-checkout-place-order-button.bbq-btn-disabled {
	opacity: 0.4 !important;
	cursor: not-allowed !important;
	pointer-events: none !important;
}

/* Hide the "Cannot read properties..." error in order meta slot */
.wc-block-components-order-meta {
	display: none !important;
}

/* Hide product description in order summary — only show name, berry selections, and price */
.wc-block-components-product-metadata__description {
	display: none !important;
}

/* Coupon panel — force content visible when aria-expanded=false */
.wc-block-components-totals-coupon .wc-block-components-panel__button {
	pointer-events: none;
}

/* Hide the toggle arrow icon on the coupon panel */
.wc-block-components-totals-coupon .wc-block-components-panel__button-icon {
	display: none !important;
}

/* Style the "Add coupons" text as a label instead of a toggle */
.wc-block-components-totals-coupon .wc-block-components-panel__button {
	cursor: default !important;
	font-weight: 600;
}

/* Coupon input + button same height */
.wc-block-components-totals-coupon__content .wc-block-components-text-input,
.wc-block-components-totals-coupon__content .wc-block-components-text-input input[type="text"] {
	height: 48px !important;
	box-sizing: border-box !important;
}

.wc-block-components-totals-coupon__content .wc-block-components-button {
	height: 48px !important;
	box-sizing: border-box !important;
	flex: 0 0 auto !important;
	width: auto !important;
}

.wc-block-components-totals-coupon__content .wc-block-components-text-input {
	flex: 1 !important;
	margin: 0 !important;
}

.wc-block-components-totals-coupon__content form {
	display: flex !important;
	align-items: center !important;
	gap: 8px;
	width: 100%;
}

.bbq-fulfillment {
	--bbq-red: #bb417c;
	--bbq-chocolate: #553024;
	--bbq-green: #33a64f;
	--bbq-green-light: #e8f5e9;
	--bbq-cream: #fff8f0;
	--bbq-gray-50: #fafafa;
	--bbq-gray-100: #f5f5f5;
	--bbq-gray-200: #eeeeee;
	--bbq-gray-300: #e0e0e0;
	--bbq-gray-400: #bdbdbd;
	--bbq-gray-500: #9e9e9e;
	--bbq-gray-600: #757575;
	--bbq-radius: 12px;
	--bbq-radius-sm: 8px;
	--bbq-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
	--bbq-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
	--bbq-transition: 0.2s ease;

	font-family:
		"Karla",
		-apple-system,
		BlinkMacSystemFont,
		sans-serif;
	color: var(--bbq-chocolate);
	margin-top: 12px;
	padding: 1.5rem;
	background: #fff;
	border: 1px solid var(--bbq-gray-200);
	border-radius: var(--bbq-radius);
	box-shadow: var(--bbq-shadow);
}

/* ---------- Title ---------- */

.bbq-fulfillment__title {
	font-size: 1.25rem;
	font-weight: 700;
	margin: 0 0 1.25rem;
	color: var(--bbq-chocolate);
}

/* ---------- Type Selector (Pickup / Delivery) ---------- */

.bbq-fulfillment__type-selector {
	display: flex;
	gap: 0.75rem;
	margin-bottom: 1.5rem;
}

.bbq-fulfillment__type-btn {
	flex: 1;
	padding: 0.875rem 1rem;
	border: 2px solid var(--bbq-gray-300);
	border-radius: var(--bbq-radius-sm);
	background: #fff;
	color: var(--bbq-chocolate);
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: all var(--bbq-transition);
	text-align: center;
}

.bbq-fulfillment__type-btn:hover {
	border-color: var(--bbq-green);
	color: var(--bbq-green);
}

.bbq-fulfillment__type-btn--active {
	border-color: var(--bbq-green);
	background: var(--bbq-green-light);
	color: var(--bbq-green);
}

.bbq-fulfillment__type-btn--disabled {
	opacity: 0.4;
	cursor: not-allowed !important;
	border-color: var(--bbq-gray-300);
	color: var(--bbq-gray-500);
}

.bbq-fulfillment__type-btn--disabled:hover {
	border-color: var(--bbq-gray-300);
	color: var(--bbq-gray-500);
}

.bbq-fulfillment__delivery-unavailable {
	background: #fff3e0;
	color: #e65100;
	padding: 0.625rem 1rem;
	border-radius: var(--bbq-radius-sm);
	font-size: 0.875rem;
	margin-bottom: 1rem;
	text-align: center;
}

/* ---------- Delivery Fee Notice ---------- */

.bbq-fulfillment__delivery-fee {
	background: var(--bbq-green-light);
	color: var(--bbq-green);
	padding: 0.625rem 1rem;
	border-radius: var(--bbq-radius-sm);
	font-size: 0.9375rem;
	font-weight: 500;
	margin-bottom: 1rem;
	text-align: center;
}

.bbq-fulfillment__delivery-fee strong {
	font-weight: 700;
}

/* ---------- Error / Loading / No Slots ---------- */

.bbq-fulfillment__no-slots {
	background: #fff3e0;
	color: #e65100;
	padding: 1rem 1.25rem;
	border-radius: var(--bbq-radius-sm);
	font-size: 0.9375rem;
	line-height: 1.5;
	margin-bottom: 1rem;
	text-align: center;
}

.bbq-fulfillment__error {
	background: #fdecea;
	color: #b71c1c;
	padding: 0.75rem 1rem;
	border-radius: var(--bbq-radius-sm);
	font-size: 0.9375rem;
	margin-bottom: 1rem;
}

.bbq-fulfillment__loading {
	color: var(--bbq-gray-600);
	font-size: 0.9375rem;
	padding: 1rem 0;
}

/* ---------- Calendar ---------- */

.bbq-fulfillment__calendar {
	margin-bottom: 1.5rem;
}

.bbq-fulfillment__calendar h4 {
	font-size: 1rem;
	font-weight: 700;
	margin: 0 0 0.75rem;
	color: var(--bbq-chocolate);
}

.bbq-cal {
	border: 1px solid var(--bbq-gray-200);
	border-radius: var(--bbq-radius);
	overflow: hidden;
}

.bbq-cal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1rem;
	background: var(--bbq-gray-50);
	border-bottom: 1px solid var(--bbq-gray-200);
}

.bbq-cal__month {
	font-weight: 700;
	font-size: 1rem;
	color: var(--bbq-chocolate);
}

.bbq-cal__nav {
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--bbq-gray-300);
	border-radius: 50%;
	background: #fff;
	color: var(--bbq-chocolate);
	font-size: 1.25rem;
	cursor: pointer;
	transition: all var(--bbq-transition);
	padding: 0;
	line-height: 1;
}

.bbq-cal__nav:hover:not(:disabled) {
	border-color: var(--bbq-green);
	color: var(--bbq-green);
}

.bbq-cal__nav:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

.bbq-cal__weekdays {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	border-bottom: 1px solid var(--bbq-gray-200);
}

.bbq-cal__weekday {
	text-align: center;
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--bbq-gray-500);
	padding: 0.5rem 0;
}

.bbq-cal__grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	padding: 0.25rem;
	gap: 2px;
}

.bbq-cal__cell {
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.875rem;
	font-weight: 500;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: all var(--bbq-transition);
	background: none;
	padding: 0;
	color: var(--bbq-chocolate);
}

.bbq-cal__cell--blank {
	cursor: default;
}

.bbq-cal__cell--available {
	font-weight: 700;
	color: var(--bbq-green);
	cursor: pointer;
}

.bbq-cal__cell--available:hover {
	background: var(--bbq-green-light);
}

.bbq-cal__cell--unavailable {
	color: var(--bbq-gray-400);
	cursor: not-allowed;
}

.bbq-cal__cell--today {
	border: 2px dashed var(--bbq-chocolate);
}

.bbq-cal__cell--selected {
	background: var(--bbq-green) !important;
	color: #fff !important;
	border: none !important;
}

.bbq-fulfillment__selected-date {
	text-align: center;
	font-weight: 700;
	font-size: 0.9375rem;
	color: var(--bbq-green);
	margin: 0.75rem 0 0;
}

/* ---------- Time Grid ---------- */

.bbq-fulfillment__times {
	margin-bottom: 1rem;
}

.bbq-fulfillment__times h4 {
	font-size: 1rem;
	font-weight: 700;
	margin: 0 0 0.75rem;
	color: var(--bbq-chocolate);
}

.bbq-fulfillment__time-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 0.5rem;
}

.bbq-fulfillment__time-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
	padding: 0.75rem 0.75rem;
	border: 1.5px solid var(--bbq-gray-300);
	border-radius: var(--bbq-radius-sm);
	background: #fff;
	cursor: pointer;
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--bbq-chocolate);
	transition: all var(--bbq-transition);
}

.bbq-fulfillment__time-btn:hover {
	border-color: var(--bbq-green);
	box-shadow: var(--bbq-shadow);
}

.bbq-fulfillment__time-btn--active {
	border-color: var(--bbq-green);
	background: var(--bbq-green-light);
	color: var(--bbq-green);
}

.bbq-fulfillment__time-remaining {
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--bbq-gray-500);
}

.bbq-fulfillment__time-btn--active .bbq-fulfillment__time-remaining {
	color: var(--bbq-green);
}

/* ---------- Order Summary ---------- */

.bbq-fulfillment__summary {
	background: var(--bbq-green-light);
	color: var(--bbq-green);
	padding: 1rem 1.25rem;
	border-radius: var(--bbq-radius-sm);
	text-align: center;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.5;
	margin-top: 1rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 500px) {
	.bbq-fulfillment {
		padding: 1rem;
	}

	.bbq-fulfillment__date-grid {
		grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
	}

	.bbq-fulfillment__time-grid {
		grid-template-columns: 1fr 1fr;
	}
}

/* Delivery below-minimum state */
.bbq-fulfillment__type-btn--disabled,
.bbq-fulfillment__type-btn[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
	background: #f5f5f5;
}

.bbq-fulfillment__type-btn--disabled:hover {
	background: #f5f5f5;
	border-color: inherit;
}

.bbq-fulfillment__minimum-notice {
	margin: 12px 0 0;
	padding: 12px 16px;
	background: #fff4f7;
	border: 1px solid #BB417C;
	border-radius: 6px;
	color: #553024;
	font-size: 14px;
	line-height: 1.5;
}

.bbq-fulfillment__notes-notice {
	margin: 12px 0 16px;
	padding: 12px 16px;
	background: #fff8e1;
	border: 1px solid #F9A825;
	border-radius: 8px;
	color: #553024;
	font-size: 14px;
	line-height: 1.5;
}

.bbq-fulfillment__notes-notice strong {
	color: #BB417C;
	display: inline-block;
	margin-right: 4px;
}
