/**
 * WooCommerce Blocks Customization Styles
 * 
 * Styles for Cart and Checkout blocks (WooCommerce 8.3+)
 */

/* =====================================================================
   Hide ALL WooCommerce Block Components
   Critical: Hide the complete WooCommerce Blocks structure to avoid CSS conflicts
   IMPORTANT: Only apply to CART page, not checkout!
   ===================================================================== */

/* Hide WooCommerce's flex layout system that conflicts with our grid - CART ONLY */
.woocommerce-cart .wc-block-components-sidebar-layout,
.woocommerce-cart .wc-block-components-sidebar,
.woocommerce-cart .wc-block-components-main,
.woocommerce-cart .wp-block-woocommerce-cart-items-block,
.woocommerce-cart .wp-block-woocommerce-cart-order-summary-block,
.woocommerce-cart .wp-block-woocommerce-filled-cart-block,
.woocommerce-cart .wc-block-cart__main,
.woocommerce-cart .wc-block-cart__sidebar,
.woocommerce-cart .wc-block-components-notices__snackbar,
.woocommerce-cart .wc-block-components-notice-snackbar-list,
.woocommerce-cart .wc-block-components-sidebar-layout.wc-block-cart,
.woocommerce-cart .wp-block-woocommerce-cart > div[style*="display: none"],
.woocommerce-cart .wp-block-woocommerce-cart > div:empty {
	display: none !important;
}

/* Keep parent container and reset to block layout - CART ONLY */
.woocommerce-cart .wp-block-woocommerce-cart,
.woocommerce-cart .wp-block-woocommerce-cart.alignwide {
	display: block !important; /* Reset to simple block, grid will be applied in media query */
	max-width: 1400px !important;
	padding: 2rem 1rem !important;
	margin: 0 auto !important;
	width: 100% !important;
	box-sizing: border-box !important;
}

/* Remove any extra spacing from alignwide class - CART ONLY */
.woocommerce-cart .wp-block-woocommerce-cart.alignwide {
	padding-left: 1rem !important;
	padding-right: 1rem !important;
}

/* =====================================================================
   Custom Cart Items Container
   ===================================================================== */

.wss-cart-items-container {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.wss-cart-items-header {
	font-size: 1.5rem;
	font-weight: 700;
	margin-bottom: 1rem;
	color: #000;
}

/* =====================================================================
   Cart Item Cards - Wide Single Column Layout
   ===================================================================== */

.wss-cart-item-card {
	display: flex;
	align-items: flex-start;
	gap: 1.5rem;
	padding: 2rem;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 4px;
	width: 100%;
	box-sizing: border-box;
	text-align: left;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.wss-cart-item-image {
	flex-shrink: 0;
	width: 150px;
}

.wss-cart-item-image img {
	width: 100%;
	height: auto;
	border-radius: 4px;
	display: block;
}

.wss-cart-item-image a {
	display: block;
	text-decoration: none;
}

.wss-cart-item-details {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.wss-cart-item-name {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.4;
}

.wss-cart-item-name a {
	color: #000;
	text-decoration: none;
}

.wss-cart-item-name a:hover {
	text-decoration: underline;
}

.wss-cart-item-billing-period {
	font-size: 0.95rem;
	color: rgba(0, 0, 0, 0.7);
	margin-top: -0.5rem;
}

.wss-cart-item-pricing {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	font-size: 1rem;
}

.wss-cart-item-today,
.wss-cart-item-recurring,
.wss-cart-item-price {
	color: #000;
}

.wss-cart-item-today strong,
.wss-cart-item-recurring strong {
	font-weight: 600;
	color: rgba(0, 0, 0, 0.8);
}

.wss-cart-item-actions {
	margin-top: auto;
	padding-top: 1rem;
	border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.wss-cart-item-remove {
	color: rgba(0, 0, 0, 0.6);
	text-decoration: none;
	font-size: 0.9rem;
	transition: color 0.2s;
}

.wss-cart-item-remove:hover {
	color: #d32f2f;
	text-decoration: underline;
}

/* =====================================================================
   Replacement Order Summary
   ===================================================================== */

#wss-replacement-order-summary {
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 4px;
	padding: 2rem;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Match WooCommerce blocks styling */
#wss-replacement-order-summary .wc-block-components-totals-wrapper {
	border: none;
	padding: 0;
}

#wss-replacement-order-summary .wc-block-components-totals {
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
	padding-bottom: 1rem;
	margin-bottom: 1.5rem;
}

#wss-replacement-order-summary .wc-block-components-totals-item {
	display: flex;
	justify-content: space-between;
	padding: 0.75rem 0;
	font-size: 1rem;
	text-align: left;
}

#wss-replacement-order-summary .wc-block-components-totals-item__label {
	font-weight: 400;
	color: rgba(0, 0, 0, 0.7);
}

#wss-replacement-order-summary .wc-block-components-totals-item__value {
	font-weight: 600;
	color: #000;
}

#wss-replacement-order-summary .wc-block-components-totals-footer {
	border-top: 2px solid rgba(0, 0, 0, 0.1);
	padding-top: 1rem;
	margin-top: 1rem;
}

#wss-replacement-order-summary .wc-block-components-totals-footer-item {
	display: flex;
	justify-content: space-between;
	padding: 0.75rem 0;
	font-size: 1.1rem;
	text-align: left;
}

#wss-replacement-order-summary .wc-block-components-totals-footer-item__label {
	font-weight: 700;
	color: #000;
}

#wss-replacement-order-summary .wc-block-components-totals-footer-item__value {
	font-weight: 700;
	font-size: 1.25rem;
	color: #000;
}

/* Total Due Today Box */
.wss-total-today-box {
	margin: 2rem 0;
	padding: 2rem;
	background: rgba(0, 0, 0, 0.03);
	border: 2px solid rgba(0, 0, 0, 0.1);
	border-radius: 4px;
	text-align: left;
	box-sizing: border-box;
}

.wss-total-today-box h2 {
	margin-top: 0;
	margin-bottom: 1rem;
	font-size: 1.5rem;
	font-weight: 700;
}

.wss-total-amount-large {
	font-size: 1.75rem;
	font-weight: 700;
	margin: 1rem 0;
	color: #000;
}

.wss-total-description {
	margin-top: 1rem;
	margin-bottom: 0;
	font-size: 1rem;
	line-height: 1.6;
}

/* Subscription Billing Schedule */
.wss-subscription-billing-schedule {
	margin-top: 2rem;
	padding: 2rem;
	background: rgba(0, 0, 0, 0.02);
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 4px;
	text-align: left;
	box-sizing: border-box;
}

.wss-subscription-billing-schedule h3 {
	margin-top: 0;
	margin-bottom: 1.5rem;
	font-size: 1.25rem;
	font-weight: 700;
}

.wss-billing-items {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.wss-billing-item {
	padding: 1.5rem;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 4px;
}

.wss-billing-item h4 {
	margin-top: 0;
	margin-bottom: 1rem;
	font-size: 1.1rem;
	font-weight: 600;
}

.wss-billing-details {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.wss-billing-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	padding: 0.5rem 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
	text-align: left;
}

.wss-billing-row:last-child {
	border-bottom: none;
}

.wss-billing-label {
	font-weight: 600;
	color: rgba(0, 0, 0, 0.7);
}

.wss-billing-amount {
	font-weight: 600;
	font-size: 1.1rem;
	color: #000;
}

.wss-billing-text {
	color: rgba(0, 0, 0, 0.8);
}

/* =====================================================================
   Checkout Button
   ===================================================================== */

#wss-replacement-order-summary .wp-block-woocommerce-cart-proceed-to-checkout-block {
	margin-top: 2rem;
	padding-top: 2rem;
	border-top: 2px solid rgba(0, 0, 0, 0.1);
}

#wss-replacement-order-summary .wss-checkout-button,
#wss-replacement-order-summary .wc-block-cart__submit-button {
	width: 100%;
	padding: 1.25rem 2rem;
	font-size: 1.25rem;
	font-weight: 700;
	background: #000;
	color: #fff;
	border: none;
	border-radius: 4px;
	text-align: center;
	text-decoration: none;
	display: block;
	cursor: pointer;
	transition: background 0.2s;
	box-sizing: border-box;
}

#wss-replacement-order-summary .wss-checkout-button:hover,
#wss-replacement-order-summary .wc-block-cart__submit-button:hover {
	background: #333;
	color: #fff;
	text-decoration: none;
}

/* =====================================================================
   Cart Layout - Sidebar Style
   ===================================================================== */

/* Desktop layout: Grid with cart items on left, summary on right - CART ONLY */
@media (min-width: 768px) {
	.woocommerce-cart .wp-block-woocommerce-cart,
	.woocommerce-cart .wp-block-woocommerce-cart.alignwide {
		display: grid !important; /* Apply grid only on desktop */
		grid-template-columns: 1fr 1fr !important; /* 50/50 split - only 2 columns */
		gap: 3rem !important;
		align-items: start !important;
		grid-auto-flow: row !important; /* Force row flow, not column */
		max-width: 100% !important;
		box-sizing: border-box !important;
		overflow: hidden !important; /* Prevent hidden elements from creating space */
	}

	.woocommerce-cart .wss-cart-items-container {
		grid-column: 1 !important;
		grid-row: 1 !important;
		width: 100% !important;
	}

	.woocommerce-cart #wss-replacement-order-summary {
		grid-column: 2 !important;
		grid-row: 1 !important;
		position: sticky !important;
		top: 2rem !important;
		width: 100% !important;
	}
}

/* =====================================================================
   Hide Coupon Field
   ===================================================================== */

.wp-block-woocommerce-cart-order-summary-coupon-form-block,
.wc-block-components-totals-coupon,
.wc-block-cart__apply-coupon-button {
	display: none !important;
}

/* =====================================================================
   Responsive Design
   ===================================================================== */

@media (max-width: 767px) {
	/* Mobile: Stack everything vertically */
	.wp-block-woocommerce-cart {
		display: block !important;
		padding: 1rem !important;
	}

	.wss-cart-items-container {
		width: 100%;
		margin-bottom: 2rem;
	}

	#wss-replacement-order-summary {
		width: 100%;
		position: static !important;
	}

	/* Stack image above details on mobile */
	.wss-cart-item-card {
		flex-direction: column;
	}

	.wss-cart-item-image {
		width: 100%;
		max-width: 200px;
		margin: 0 auto;
	}

	.wss-total-amount-large {
		font-size: 2rem;
	}
	
	.wss-billing-row {
		flex-direction: column;
		gap: 0.25rem;
	}
	
	.wss-billing-label,
	.wss-billing-amount {
		width: 100%;
	}
}

/* =====================================================================
   Ensure Left Alignment Throughout
   ===================================================================== */

.wss-cart-items-container,
.wss-cart-item-card,
.wss-cart-item-details,
.wss-cart-item-pricing,
#wss-replacement-order-summary,
.wss-total-today-box,
.wss-subscription-billing-schedule {
	text-align: left !important;
}
