/* TROTIX COD — product page order card. Mobile-first. Uses the theme tokens, with provisional fallbacks. */
.trotix-order {
	--tc-primary: var(--wp--preset--color--primary, #FF6A00);
	--tc-black: var(--wp--preset--color--black, #111111);
	--tc-white: var(--wp--preset--color--white, #FFFFFF);
	--tc-light: var(--wp--preset--color--gray-light, #F5F5F5);
	--tc-steel: var(--wp--preset--color--gray-steel, #666666);
	--tc-danger: var(--wp--preset--color--danger, #D93025);
	--tc-success: var(--wp--preset--color--success-text, #1B7A35);
	--tc-line: #d9d9d9;
	--tc-r: 14px;

	margin: 1rem 0 1.5rem; padding: 1rem;
	border: 2px solid var(--tc-primary); border-radius: 18px; background: var(--tc-white);
}

/* ---------- Fields ---------- */
.trotix-order__grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: .75rem; }
.trotix-field { position: relative; margin-bottom: .75rem; min-width: 0; }
.trotix-order__grid .trotix-field { margin-bottom: 0; }
.trotix-field[hidden] { display: none; }
.trotix-order input[type="text"], .trotix-order input[type="tel"], .trotix-order select, .trotix-order textarea {
	width: 100%; min-height: 54px; padding: .6rem .9rem; font: inherit; font-size: 1rem; color: var(--tc-black);
	background: var(--tc-white); border: 1px solid var(--tc-line); border-radius: var(--tc-r);
	box-sizing: border-box;
}
.trotix-order input[type="tel"] { direction: ltr; text-align: end; }
.trotix-order input::placeholder { color: var(--tc-steel); opacity: 1; }
.trotix-field--icon input { padding-inline-end: 2.6rem; }
.trotix-field__icon { position: absolute; inset-inline-end: .85rem; top: 27px; transform: translateY(-50%); pointer-events: none; font-size: 1.1rem; }
.trotix-order select { appearance: none; -webkit-appearance: none; padding-inline-end: 2.4rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23111111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-size: 12px 8px; background-position: right 14px center; }
[dir="rtl"] .trotix-order select { background-position: left 14px center; padding-inline-end: .9rem; padding-inline-start: 2.4rem; }
.trotix-order select:disabled { background-color: var(--tc-light); color: var(--tc-steel); }
.trotix-order input:focus-visible, .trotix-order select:focus-visible, .trotix-order textarea:focus-visible { outline: 3px solid var(--tc-black); outline-offset: 1px; }
.trotix-order [aria-invalid="true"] { border-color: var(--tc-danger); }
.trotix-error { display: block; min-height: 0; color: var(--tc-danger); font-size: .8125rem; margin-top: .25rem; }
.trotix-error:empty { display: none; }
.trotix-error--global { font-weight: 600; margin: .75rem 0 0; }
.trotix-hp { position: absolute !important; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Delivery type (segmented) ---------- */
.trotix-delivery { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 0 .75rem; border: 1px solid var(--tc-line); border-radius: var(--tc-r); overflow: hidden; }
.trotix-seg { margin: 0; cursor: pointer; }
.trotix-seg input { position: absolute; opacity: 0; pointer-events: none; }
.trotix-seg span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: .4rem .5rem; font-weight: 600; font-size: .9375rem; text-align: center; background: var(--tc-white); }
.trotix-seg input:checked + span { background: var(--tc-black); color: var(--tc-white); }
.trotix-seg input:focus-visible + span { outline: 3px solid var(--tc-primary); outline-offset: -3px; }

/* ---------- Delivery price row ---------- */
.trotix-fee { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem .25rem 1rem; font-weight: 700; }
.trotix-fee__value { font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.trotix-badge { display: inline-block; padding: .2rem .7rem; border-radius: 999px; background: var(--tc-primary); color: var(--tc-black); font-size: .8125rem; font-weight: 700; direction: rtl; }

/* ---------- Native WooCommerce form inside the card ---------- */
.trotix-order form.cart { display: block; margin: 0; }
.trotix-order table.variations { width: 100%; margin: 0 0 .75rem; border: 0; border-collapse: collapse; }
.trotix-order table.variations, .trotix-order table.variations tbody { display: block; width: 100%; }
.trotix-order table.variations tr, .trotix-order table.variations th, .trotix-order table.variations td { display: block; padding: 0; border: 0; text-align: start; }
.trotix-order table.variations th label { font-weight: 800; font-size: 1.0625rem; display: block; margin: .25rem 0 .5rem; }
.trotix-order .reset_variations,
.trotix-order .woocommerce-variation-price,
.trotix-order .woocommerce-variation-availability,
.trotix-order .woocommerce-variation-description { display: none !important; }
.trotix-select-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; pointer-events: none; }

.trotix-order table.variations td, .trotix-order table.variations td.value { width: 100% !important; }
.trotix-pills { display: flex; flex-wrap: wrap; gap: .6rem; width: 100%; }
.trotix-pill {
	flex: 1 1 calc(50% - .6rem); min-height: 52px; padding: .4rem 1rem; border-radius: 999px; cursor: pointer;
	font: inherit; font-weight: 700; color: var(--tc-black); background: var(--tc-white); border: 2px solid var(--tc-line);
}
.trotix-pill:hover { border-color: var(--tc-black); }
.trotix-pill.is-selected { background: var(--tc-primary); border-color: var(--tc-black); color: var(--tc-black); }
.trotix-pill:disabled { opacity: .45; cursor: not-allowed; text-decoration: line-through; }
.trotix-pill:focus-visible { outline: 3px solid var(--tc-black); outline-offset: 2px; }

/* Row: [ − 1 + ] [ ORDER NOW ] */
.trotix-order form.cart:not(.variations_form),
.trotix-order .woocommerce-variation-add-to-cart {
	display: grid; grid-template-columns: auto 1fr; gap: .75rem; align-items: stretch; margin-top: .75rem;
}
.trotix-order form.variations_form { display: block; }
.trotix-order .quantity.trotix-qty { grid-column: 1; grid-row: 1; display: inline-flex; flex-direction: row; align-items: center; gap: .5rem; margin: 0; }
.trotix-order .quantity.trotix-qty input.qty { width: 44px; min-height: 52px; padding: 0; text-align: center; border: 0; background: transparent; font-weight: 800; font-size: 1.125rem; -moz-appearance: textfield; }
.trotix-order .quantity.trotix-qty input.qty::-webkit-outer-spin-button, .trotix-order .quantity.trotix-qty input.qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.trotix-step { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--tc-line); background: var(--tc-white); color: var(--tc-black); font-size: 1.5rem; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.trotix-step:active { background: var(--tc-light); }
.trotix-order .trotix-order-now,
.trotix-order button.single_add_to_cart_button { min-height: 54px; width: 100%; white-space: normal; border-radius: var(--tc-r); font-weight: 800; font-size: 1.0625rem; cursor: pointer; }
.trotix-order .trotix-order-now { grid-column: 2; grid-row: 1; background: var(--tc-primary) !important; color: var(--tc-black) !important; border: 2px solid var(--tc-primary) !important; }
.trotix-order .trotix-order-now:hover { background: var(--tc-black) !important; color: var(--tc-white) !important; border-color: var(--tc-black) !important; }
.trotix-order .trotix-order-now:disabled { opacity: .6; cursor: wait; }
/* Secondary action: add to cart (quiet) */
.trotix-order button.single_add_to_cart_button {
	grid-column: 1 / -1 !important; grid-row: 2 !important; min-height: 46px; font-size: .9375rem; font-weight: 700;
	background: transparent !important; color: var(--tc-black) !important; border: 2px solid var(--tc-line) !important;
}
.trotix-order button.single_add_to_cart_button:hover { border-color: var(--tc-black) !important; }

/* ---------- Summary ---------- */
.trotix-summary { margin-top: 1rem; border: 1px solid var(--tc-line); border-radius: var(--tc-r); overflow: hidden; background: var(--tc-white); }
.trotix-summary > summary { cursor: pointer; padding: .9rem 1rem; font-weight: 800; list-style: none; display: flex; align-items: center; gap: .5rem; background: var(--tc-light); }
.trotix-summary > summary::-webkit-details-marker { display: none; }
.trotix-summary__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1rem; border-top: 1px solid var(--tc-line); }
.trotix-summary__item img { border-radius: 50%; object-fit: cover; flex: none; }
.trotix-summary__name { flex: 1; font-weight: 700; }
.trotix-qtybadge { display: inline-block; margin-inline-start: .35rem; padding: .05rem .5rem; border-radius: 999px; background: var(--tc-primary); color: var(--tc-black); font-size: .8125rem; font-weight: 800; }
.trotix-summary__amount { font-weight: 800; direction: ltr; unicode-bidi: isolate; }
.trotix-summary__total { font-size: 1.1875rem; font-weight: 800; }

.trotix-success { margin-top: 1rem; padding: 1rem; border-radius: var(--tc-r); background: var(--tc-light); border-inline-start: 5px solid var(--tc-success); }
.trotix-success[hidden] { display: none; }
.trotix-order.is-done > .trotix-order__grid, .trotix-order.is-done > .trotix-delivery, .trotix-order.is-done > .trotix-field, .trotix-order.is-done > .trotix-fee,
.trotix-order.is-done form.cart { display: none !important; }

/* ---------- Sticky bottom bar + compact header (mobile) ---------- */
.trotix-sticky, .trotix-minihead { display: none; }
@media (max-width: 782px) {
	body.single-product { padding-bottom: 88px; }
	body.single-product .trotix-bottomnav { display: none !important; }
	.trotix-sticky {
		position: fixed; inset-inline: 0; bottom: 0; z-index: 70; display: flex; align-items: center; gap: .75rem;
		padding: .6rem .75rem calc(.6rem + env(safe-area-inset-bottom)); background: var(--wp--preset--color--white, #fff);
		border-top: 1px solid var(--wp--preset--color--gray-light, #f0f0f0); box-shadow: 0 -4px 14px rgba(0, 0, 0, .08);
	}
	.trotix-sticky[hidden] { display: none; }
	.trotix-sticky__wa { flex: none; width: 54px; height: 54px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: #1E8E3E; color: #fff; }
	.trotix-sticky__order { flex: 1; min-height: 54px; border-radius: 14px; font-weight: 800; font-size: 1.125rem; cursor: pointer;
		background: var(--wp--preset--color--primary, #FF6A00) !important; color: var(--wp--preset--color--black, #111) !important; border: 0 !important; }
	.trotix-minihead:not([hidden]) {
		position: fixed; inset-inline: 0; top: 0; z-index: 65; display: block; padding: .6rem 1rem; background: var(--wp--preset--color--white, #fff);
		border-bottom: 1px solid var(--wp--preset--color--gray-light, #f0f0f0); box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
	}
	body.admin-bar .trotix-minihead:not([hidden]) { top: 46px; }
	.trotix-minihead__text { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
	.trotix-minihead__text strong { font-size: .9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
	.trotix-minihead__text span { font-weight: 800; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
}
/* On desktop the main button is enough; no sticky bar. */
.trotix-order .trotix-order-now { transition: background .15s, color .15s; }

.screen-reader-text { border: 0; clip: rect(1px, 1px, 1px, 1px); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }

/* ---------- Inline WhatsApp button: row 2 = [Add to cart][WhatsApp] ---------- */
.trotix-order .trotix-wa { grid-column: 3; grid-row: 2; display: inline-flex; align-items: center; justify-content: center; width: 54px; min-height: 46px; border-radius: var(--tc-r); background: #1E8E3E; color: #fff; text-decoration: none; }
.trotix-order .trotix-wa:hover { background: var(--tc-black); }
.trotix-order .trotix-order-now { grid-column: 2 / -1; }
.trotix-order form.cart:has(.trotix-wa) button.single_add_to_cart_button { grid-column: 1 / 3 !important; }
.trotix-order form.cart:not(.variations_form):has(.trotix-wa),
.trotix-order .woocommerce-variation-add-to-cart:has(.trotix-wa) { grid-template-columns: auto 1fr auto; }
/* Blocksy quantity stepper */
.trotix-order .quantity[data-type] { grid-column: 1; grid-row: 1; margin: 0; }
.trotix-order .quantity[data-type] input.qty { min-height: 52px; }

/* ---------- Blocksy compatibility: Blocksy wraps qty + buttons in .ct-cart-actions (flex) → make THAT our grid ---------- */
.trotix-order form.cart:not(.variations_form),
.trotix-order form.cart .woocommerce-variation-add-to-cart { display: block !important; }
.trotix-order .ct-cart-actions {
	display: grid !important; grid-template-columns: auto 1fr auto !important; gap: .75rem !important;
	align-items: stretch !important; width: 100%; margin: 0;
}
.trotix-order .ct-cart-actions .quantity { grid-column: 1 !important; grid-row: 1 !important; margin: 0 !important; height: auto !important; }
.trotix-order .ct-cart-actions .quantity input.qty { height: 52px !important; min-height: 52px; }
.trotix-order .ct-cart-actions .trotix-order-now { grid-column: 2 / -1 !important; grid-row: 1 !important; }
.trotix-order .ct-cart-actions button.single_add_to_cart_button { grid-column: 1 / 3 !important; grid-row: 2 !important; width: 100% !important; height: auto !important; min-height: 46px; margin: 0 !important; }
.trotix-order .ct-cart-actions .trotix-wa { grid-column: 3 !important; grid-row: 2 !important; }
