/* SHARED CHOOSER. Edit these variables for both Grid and Carousel. */
.bundle_form.wcbux-active {
	--wcbux-accent: #173c66;
	--wcbux-space: 1rem;
	--wcbux-navy: #173c66;
	--wcbux-gold: #bda87d;
	--wcbux-red: #a02b43;
	--wcbux-button-bg: #163257;
	--wcbux-blue: #163257;
	--wcbux-gold2: #c9a05c;
	display: flex;
	flex-direction: column;
	gap: 0;
}

body.et-db #page-container #et-boc .et-l .et_pb_section .et_pb_wc_add_to_cart_0_tb_body .button.wcbux-add,  /* Would like this not to be needed */
.wcbux-card-controls button.wcbux-add {
	color: #fff !important;
	background-color: var(--wcbux-button-bg) !important;
}

.bundle_form.wcbux-active > .wcbux-mount { order: 0; }
.bundle_form.wcbux-active > .bundled_products { order: 1; width: 100%; }
.bundle_form.wcbux-active > .bundle_data { order: 2; width: 100%; }
/* Bring the native price and purchase controls closer to the final coffee. */
.bundle_form.wcbux-active > .bundled_products { margin-bottom: 0 !important; }
.bundle_form.wcbux-active > .bundle_data { margin-top: 0.5rem; }

.wcbux-mount[hidden], .wcbux-detail-source[hidden] { display: none !important; }
.wcbux-mount { display: grid; gap: var(--wcbux-space, 1rem); }
.wcbux-heading { margin: 0 auto; font-size: 26px; }

/* Global Grind and other configured shared attributes. */
.wcbux-global-choices { display: grid; gap: 0.75rem; }
.wcbux-attribute { border: 0; padding: 0; margin: 0; min-width: 0; }
.wcbux-attribute legend { 
	font-weight: 700; 
	margin-bottom: 0.35rem; 
	display: none;
}
.wcbux-attribute-status { margin: 0 0 0.35rem; }
.wcbux-attribute-status:empty, .wcbux-error:empty { display: none; }
.wcbux-tiles { 
	display: flex; 
	flex-wrap: wrap; 
	gap: 0.45rem;
	align-items: center;
	justify-content: center;
}
.wcbux-tile {
	font: inherit;
	color: inherit;
	/* background: transparent; */
	background: white;
	border: 1px solid #999;
	border-radius: 0.4rem;
	padding: 0.5rem 0.75rem;
	cursor: pointer;
}
.wcbux-tiles button:hover {
	border: 1px solid #999;
	border-radius: 0.4rem;
}
.wcbux-tile[aria-pressed="true"] { 
	border: 2px solid currentColor !important; 
	/* outline-offset: -3px; */
	font-weight: 700; 
}
.wcbux-tile:disabled { opacity: 0.35; cursor: not-allowed; }
.wcbux-tile:focus-visible, .wcbux-remove:focus-visible, .wcbux-replace:focus-visible,
.wcbux-details-button:focus-visible { outline: 2px solid var(--wcbux-accent, #173c66); outline-offset: 3px; }


/* Selected coffee slots. The native quantity inputs remain the source of truth. */

/* Outer border around the selected coffee slots */
.bundle_form.wcbux-active .wcbux-slots {
    width: 100%;
    max-width: 100%;
    min-width: 0;

    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;

    box-sizing: border-box;

	margin: 0 auto;

	/*B background-color: var(--wcbux-gold); */
	background-color: var(--wcbux-gold2);
}


.wcbux-slots { 
	display: grid; 
	gap: 0.65rem; 
}
.wcbux-slots.wcbux-slots--count-1 { 
	grid-template-columns: repeat(1, minmax(0, 1fr)); 
}
.wcbux-slots.wcbux-slots--count-2 { 
	grid-template-columns: repeat(2, minmax(0, 1fr)); 
}
.wcbux-slots.wcbux-slots--count-4 { 
	grid-template-columns: repeat(4, minmax(0, 1fr)); 
}
/* Compact 1- and 2-slot bundles on desktop. */
.bundle_form.wcbux-active .wcbux-slots.wcbux-slots--count-1,
.bundle_form.wcbux-active .wcbux-slots.wcbux-slots--count-2 {
    width: initial;
    justify-self: center;
}
.wcbux-slot {
	position:relative; /* For the remove action */
	border: 1px solid #ccc;
	border-radius: 0.5rem;
	padding: 0.8rem;
	min-width: 0;
	overflow-wrap: anywhere;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.4rem;
	background-color: #fff;
}
.wcbux-slot-number { font-weight: 700; }
.wcbux-slot-content { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.wcbux-slot-content small { 
	line-height: 1.35; 
	/* display: none; */ /* For now, don't display the grind at all as it applies to all choices */
}
.wcbux-slot-content strong { 
	line-height: 1.2em; /* the product title */
}
.wcbux-empty { opacity: 0.7; }
.wcbux-remove, .wcbux-replace, .wcbux-details-button, .wcbux-fallback {
	font: inherit;
	color: inherit;
	background: transparent;
	border: 0;
	padding: 0;
	text-decoration: underline;
	cursor: pointer;
}
.wcbux-remove {
	position: absolute;
	top: 5px;
	right: 5px;
}
.wcbux-replace {
	display: none;
}
.wcbux-fallback {
	display: none;
}
.wcbux-progress { 
	margin: 0; 
	font-weight: 600; 
	line-height: 1.2em; 
	padding-bottom: 0;
}
.wcbux-error { 
	margin: 0; 
	color: #a00000; 
	display: none;
}
.wcbux-fallback { justify-self: start; }

/* Shared card controls. The existing Product Bundles card markup is retained. */
.bundle_form.wcbux-active .bundled_item_cart_content {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	clip-path: inset(50%);
	opacity: 0;
	pointer-events: none;
}
.bundle_form.wcbux-active .bundled_product { position: relative; }
.bundle_form.wcbux-active .bundled_product.wcbux-clickable { cursor: pointer; }
.bundle_form.wcbux-active .bundled_product.wcbux-clickable:hover { border-color: var(--wcbux-accent); }
.bundle_form.wcbux-active .bundled_product.wcbux-clickable:focus-visible { outline: 2px solid var(--wcbux-accent); outline-offset: 3px; }
.bundle_form.wcbux-active .bundled_product .details { 
	display: flex; 
	flex-direction: column; 
	min-width: 0; 
	text-align: left;
}
.bundle_form.wcbux-active .bundled_product_excerpt {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.wcbux-card-controls { 
	display: flex; 
	align-items: center; 
	flex-wrap: wrap; 
	gap: 0.6rem; 
	margin-top: auto; 
	padding-top: 0rem; 
}
.wcbux-count { font-weight: 600; white-space: nowrap; }
.wcbux-details-button { font-size: 0.9em; }

/* This dialog belongs to the chooser's Replace action, not to product Details. */
.wcbux-replace-dialog { max-width: min(92vw, 38rem); max-height: 80vh; overflow: auto; border: 1px solid #777; border-radius: 0.5rem; padding: 1.25rem; }
.wcbux-replace-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.wcbux-replace-dialog h2 { margin-top: 0; }
.wcbux-replace-dialog .wcbux-replace-option { display: block; width: 100%; margin: 0.4rem 0; text-align: left; }
.wcbux-replace-dialog .wcbux-cancel { margin-top: 0.6rem; }
/* Stable modal button dimensions across theme and Divi hover styles. */
.wcbux-replace-dialog button.wcbux-replace-option,
.wcbux-replace-dialog button.wcbux-cancel,
.wcbux-grind-dialog button.wcbux-grind-button {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0.65rem 0;
    padding: 0.65rem 0.9rem;
    border: 1px solid #163257 !important;
    border-radius: 5px !important;
    background: #163257 !important;
    color: #fff !important;
    font: inherit !important;
    line-height: 1.4 !important;
    letter-spacing: normal !important;
    text-align: center;
    text-decoration: none !important;
    transform: none !important;
    cursor: pointer;
}
.wcbux-replace-dialog button.wcbux-replace-option:hover,
.wcbux-grind-dialog button.wcbux-grind-button:hover {
    background: #173c66 !important;
    color: #fff !important;
    padding: 0.65rem 0.9rem !important;
    border-width: 1px !important;
}
.wcbux-replace-dialog button.wcbux-cancel {
    margin-top: 0.85rem;
    background: #fff !important;
    color: #163257 !important;
}
.wcbux-replace-dialog button.wcbux-cancel:hover {
    background: #f5f5f5 !important;
    color: #163257 !important;
    padding: 0.65rem 0.9rem !important;
    border-width: 1px !important;
}
.wcbux-replace-dialog button.wcbux-replace-option::after,
.wcbux-replace-dialog button.wcbux-cancel::after,
.wcbux-grind-dialog button.wcbux-grind-button::after {
    display: none !important;
    content: none !important;
}
.wcbux-grind-dialog button.wcbux-grind-button {
    max-width: 13rem;
    margin: 0 auto;
}


@media (max-width: 620px) {
	.wcbux-slots { grid-template-columns: minmax(0, 1fr); }
}

.bundled_product_excerpt.product_excerpt p {
	line-height: 1.2em;
}


/* Grind tiles with images from AK Visual Variations */

.wcbux-tile--has-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;

    gap: 8px;
    width: 150px;
    padding: 8px;
    box-sizing: border-box;

    text-align: center;
    border-color: transparent;
}

.wcbux-tile--has-image img {
    display: block;

    width: 110px;
    height: 110px;

    object-fit: contain;
}

.wcbux-tile--has-image span {
    font-size: 14px;
	line-height: 1.2;
	min-height: 35px;
}
/* At narrower desktop/tablet widths, centre rows of no more than three Grind tiles. */
@media (min-width: 621px) and (max-width: 980px) {
    .bundle_form.wcbux-active .wcbux-tiles {
        max-width: calc(3 * 150px + 2 * 0.45rem);
        margin-inline: auto;
    }
}

/* Two Grind image tiles per row on portrait-sized phones. */
@media (max-width: 620px) {
    .bundle_form.wcbux-active .wcbux-tiles {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
    }
    .bundle_form.wcbux-active .wcbux-tile--has-image {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    .bundle_form.wcbux-active .wcbux-tile--has-image img {
        width: min(100%, 100px);
        height: auto;
        aspect-ratio: 1;
    }
}


/* Highlight selected Grind */

.wcbux-tile--has-image[aria-pressed="true"] {
    /* border-color: #173c66; */
}

/* Tablet/mobile: full-width containers, at most two slots per row. */
@media (max-width: 820px) {
    .bundle_form.wcbux-active .wcbux-slots {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }
    .bundle_form.wcbux-active .wcbux-slots.wcbux-slots--count-1,
    .bundle_form.wcbux-active .wcbux-slots.wcbux-slots--count-2 {
        width: 100%;
        justify-self: stretch;
    }
    .bundle_form.wcbux-active .wcbux-slots.wcbux-slots--count-1 {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Small mobiles: one slot per row */
@media (max-width: 420px) {
    .bundle_form.wcbux-active .wcbux-slots {
        grid-template-columns: 1fr;
    }
}

/* Coffee card informational attributes */

.wcbux-card-attribute {
    display: none;
}

.bundle_form.wcbux-active .wcbux-card-attribute {
    display: block;
    margin: 0.25rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
	padding-bottom: 0;
}

.bundle_form.wcbux-active .wcbux-card-attribute strong {
	display: inline-block !important;
}

.wcbux-card-attribute strong {
    color: var(--wcbux-navy);
}


.bundle_form.wcbux-active ul.products::before {
	content: none;
}


.bundle_form.wcbux-active .bundle_button .pl-qty-minus,
.bundle_form.wcbux-active .bundle_button .pl-qty-plus { 
	display: none;
}

.bundle_form.wcbux-active .bundled_product_title_link {
	display: none;
}

.short-description p { 
	padding-bottom: 0 !important;
}

.bundle_error .woocommerce-info {
	display: none;
}

.bundle_form.wcbux-active button {
	border-radius: 5px !important;
}
	
/* Coffee choices are inactive until Grind is selected. */
/* Cards remain clickable before Grind is chosen so we can explain the next step. */

/* Coffee price, below informational attributes. */
.wcbux-card-price {
    display: none;
}

.bundle_form.wcbux-active .wcbux-card-price {
    display: block;
    margin: 0.6rem 0;
    color: var(--wcbux-navy, #173c66);
    font-size: 1rem;
    font-weight: 600;
}

.wcbux-card-price del {
    color: #888;
    font-weight: 400;
    margin-right: 0.35rem;
}

.wcbux-card-price ins {
    color: var(--wcbux-navy, #173c66);
    text-decoration: none;
}

/* Draw a clean cross instead of the text X on selection slots */
button.wcbux-remove {
	position:absolute;
}
button.wcbux-remove::before,
button.wcbux-remove::after {
	content: "" !important;
	display: block !important;
	position: absolute;
	top: 50%;
	left: 50%;
	width: 11px;
	height: 1.5px;
	padding: 0 !important;
	background: #a02b43;
	border: 0 !important;
	transform: translate(-50%, -50%) rotate(45deg);
}

button.wcbux-remove::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

button.wcbux-remove:hover {
	background: #a02b43 !important;
}

button.wcbux-remove:hover::before,
button.wcbux-remove:hover::after {
	background: #fff;
}

.wcbux-view-grid li.bundled_product.wcbux-selected {
	border: solid 2px #c9a05c;
}

.wcbux-card-controls .button.wcbux-add {
	margin:0 auto;
	width:90%;
}


/* Modal dialogs prevent scrolling the underlying shop page. */
html:has(.wcbux-detail-dialog[open], .wcbux-replace-dialog[open], .wcbux-grind-dialog[open]) { overflow: hidden; }
.wcbux-grind-dialog { width: min(90vw, 28rem); border: 0; border-radius: 0.5rem; padding: 1.5rem; text-align: center; }
.wcbux-grind-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.wcbux-grind-dialog p { margin: 0 0 1.2rem; }
/* Grind button uses the same stable styles as the replacement modal. */

/* Native live bundle total, not the individual coffee card prices. */
.bundle_form.wcbux-active > .bundle_data .bundle_price .price {
    font-size: 1.45rem;
    line-height: 1.4;
	margin-bottom: 0;
}
.bundle_form.wcbux-active > .bundle_data .wcbux-delivery-note {
    display: block;
    font-size: 1rem;
    line-height: 1rem;
    font-weight: 400;
    margin-top: 0;
	padding-bottom: 15px;
{
}
