/**
 * Literature Order Frontend Styles
 *
 * Additional styles for cart and checkout customizations.
 *
 * @package TMW_LiteratureOrder
 * @since 1.0.0
 */

/* ==========================================================================
   Cart Page Customizations
   ========================================================================== */

.tmw-literature-order-active .cart-subtotal,
.tmw-literature-order-active .order-total,
.tmw-literature-order-active .product-price,
.tmw-literature-order-active .product-subtotal {
	display: none !important;
}

/* Quantity Label in Cart */
.tmw-qty-label {
	display: inline-block;
	padding: var(--space-xs) var(--space-sm);
	background-color: var(--color-gray-100);
	border-radius: var(--radius-sm);
	font-size: var(--font-size-small);
	font-weight: var(--font-weight-medium);
}

/* ==========================================================================
   Checkout Page Customizations
   ========================================================================== */

.tmw-literature-order-active .woocommerce-checkout-review-order-table .product-total,
.tmw-literature-order-active .woocommerce-checkout-review-order-table tfoot {
	display: none !important;
}

/* Hide "Use same address for billing" checkbox - not needed for RFQ/literature orders */
.wc-block-checkout__use-address-for-billing {
	display: none !important;
}

/* Hide shipping options section - not applicable for free literature orders */
.wc-block-checkout__shipping-option {
	display: none !important;
}

/* Hide order summary pricing sections - not applicable for free literature orders */
.wp-block-woocommerce-checkout-order-summary-totals-block,
.wp-block-woocommerce-checkout-order-summary-subtotal-block,
.wc-block-components-totals-wrapper:has(.wc-block-components-totals-footer-item) {
	display: none !important;
}

/* Hide individual product prices in order summary */
.wc-block-components-order-summary-item__individual-prices,
.wc-block-components-order-summary-item__total-price {
	display: none !important;
}

/* Hide $0.00 price in mobile order summary toggle button */
.wc-block-components-checkout-order-summary__title .wc-block-components-formatted-money-amount {
	display: none !important;
}

/* Hide shipping row */
.tmw-literature-order-active .woocommerce-shipping-totals {
	visibility: collapse;
}

/* ==========================================================================
   RFQ Payment Gateway Styles
   ========================================================================== */

/* Hide the payment method radio since there's only one option */
.tmw-literature-order-active .wc_payment_method input.input-radio {
	display: none;
}

/* Style the payment method label as a title */
.tmw-literature-order-active .wc_payment_method > label {
	display: block;
	font-size: var(--font-size-lead);
	font-weight: var(--font-weight-semibold);
	color: var(--color-text-primary);
	margin-bottom: var(--space-sm);
	padding: 0;
	cursor: default;
}

/* Style the payment box (description) */
.tmw-literature-order-active .payment_box {
	background-color: var(--color-gray-50);
	border: 1px solid var(--color-gray-200);
	border-radius: var(--radius-md);
	padding: var(--space-md);
	margin-top: var(--space-sm);
	font-size: var(--font-size-small);
	line-height: var(--line-height-relaxed);
}

.tmw-literature-order-active .payment_box::before {
	display: none; /* Remove the default arrow */
}

.tmw-literature-order-active .payment_box p {
	margin: 0;
}

/* Payment methods list styling */
.tmw-literature-order-active .wc_payment_methods {
	list-style: none;
	padding: 0;
	margin: 0 0 var(--space-lg);
	border: none;
	background: transparent;
}

.tmw-literature-order-active .wc_payment_method {
	padding: var(--space-md);
	background-color: var(--color-white);
	border: 1px solid var(--color-gray-200);
	border-radius: var(--radius-md);
}

/* Order Button */
.tmw-literature-order-active #place_order {
	background-color: var(--color-primary);
	border-color: var(--color-primary);
	width: 100%;
	padding: var(--space-md) var(--space-lg);
	font-size: var(--font-size-base);
	font-weight: var(--font-weight-semibold);
}

.tmw-literature-order-active #place_order:hover {
	background-color: var(--color-primary-dark);
	border-color: var(--color-primary-dark);
}

/* ==========================================================================
   Order Received / Thank You Page
   ========================================================================== */

.tmw-literature-order-received {
	max-width: 800px;
}

.tmw-literature-order-received .woocommerce-thankyou-order-received {
	font-size: var(--font-size-lead);
	padding: var(--space-lg);
	background-color: var(--color-success-50);
	border: 1px solid var(--color-success-200);
	border-radius: var(--radius-md);
	margin-bottom: var(--space-xl);
}

.tmw-literature-order-received .woocommerce-order-overview {
	list-style: none;
	padding: 0;
	margin: 0 0 var(--space-xl);
	display: grid;
	gap: var(--space-md);
}

.tmw-literature-order-received .woocommerce-order-overview li {
	padding: var(--space-md);
	background-color: var(--color-gray-50);
	border-radius: var(--radius-sm);
}

.tmw-literature-order-received .woocommerce-order-overview li strong {
	display: block;
	margin-top: var(--space-xs);
	font-size: var(--font-size-lead);
}

.tmw-literature-order-received__actions {
	margin-top: var(--space-xl);
	padding-top: var(--space-xl);
	border-top: 1px solid var(--color-gray-200);
}

.tmw-literature-order-received__actions .button {
	display: inline-block;
}

/* Hide payment, total, and billing address from order received page */
.tmw-literature-order-active .woocommerce-order-overview__payment-method,
.tmw-literature-order-active .woocommerce-order-overview__total,
.tmw-literature-order-active .woocommerce-column--billing-address {
	display: none !important;
}

/* Hide Total line from WooCommerce Blocks order confirmation summary */
.wc-block-order-confirmation-summary-list-item:has(.woocommerce-Price-amount) {
	display: none !important;
}

/* Hide Total row from WooCommerce Blocks order confirmation totals table */
.wc-block-order-confirmation-totals__total {
	display: none !important;
}

/* Replace "Product" with "Literature" in order confirmation totals table header */
th.wc-block-order-confirmation-totals__product {
	font-size: 0; /* Hide original text */
}

th.wc-block-order-confirmation-totals__product::after {
	content: "Literature";
	font-size: var(--font-size-base);
}

/* Order item thumbnails in order details */
.wc-block-order-confirmation-totals tbody td {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	flex-wrap: nowrap;
}

.tmw-order-item-with-thumbnail {
	display: contents;
}

.tmw-order-item-thumbnail-wrapper {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
}

.tmw-order-item-thumbnail-wrapper img.tmw-order-item-thumbnail {
	width: 40px;
	height: 40px;
	object-fit: cover;
	border-radius: var(--radius-sm);
	border: 1px solid var(--color-gray-200);
}

.tmw-order-item-name {
	flex-shrink: 0;
}

.wc-block-order-confirmation-totals tbody td strong {
	flex-shrink: 0;
	white-space: nowrap;
}

/* ==========================================================================
   WooCommerce Notices
   ========================================================================== */

.tmw-literature-order-active .woocommerce-message,
.tmw-literature-order-active .woocommerce-info {
	border-left-color: var(--color-primary);
}

.tmw-literature-order-active .woocommerce-message::before,
.tmw-literature-order-active .woocommerce-info::before {
	color: var(--color-primary);
}

/* ==========================================================================
   Empty Cart
   ========================================================================== */

.tmw-literature-order-active .cart-empty {
	text-align: center;
	padding: var(--space-xl);
	background-color: var(--color-gray-50);
	border-radius: var(--radius-md);
}

.tmw-literature-order-active .cart-empty a {
	color: var(--color-primary);
	font-weight: var(--font-weight-medium);
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (width <= 767px) {
	.tmw-literature-order-active .woocommerce-cart-form__cart-item {
		display: flex;
		flex-wrap: wrap;
		padding: var(--space-md);
		border-bottom: 1px solid var(--color-gray-200);
	}

	.tmw-literature-order-active .woocommerce-cart-form__cart-item .product-thumbnail {
		width: 80px;
	}

	.tmw-literature-order-active .woocommerce-cart-form__cart-item .product-name {
		flex: 1;
		padding-left: var(--space-md);
	}

	.tmw-qty-label {
		font-size: var(--font-size-xs);
	}
}
