/**
 * WooCommerce Cart, Mini-Cart Drawer, Checkout, and My Account styles.
 *
 * Also styles WooCommerce Cart/Checkout Blocks to match the theme design tokens.
 *
 * @package Oldlib
 */

.ol-surface-tinted {
	background-color: var(--ol-color-surface-alt, #fafaf9);
}

/* Mini-Cart Drawer */
body.admin-bar #ol-mini-cart-drawer .ol-drawer__panel {
	top: 32px;
	height: calc(100% - 32px);
}

@media (max-width: 782px) {
	body.admin-bar #ol-mini-cart-drawer .ol-drawer__panel {
		top: 46px;
		height: calc(100% - 46px);
	}
}

.ol-mini-cart-panel {
	width: min(92vw, 400px);
	display: flex;
	flex-direction: column;
	background-color: var(--ol-color-bg);
	padding: 0;
}

.ol-mini-cart__head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	min-height: 64px;
	background-color: var(--ol-color-primary);
	color: #ffffff;
}

.ol-mini-cart__head .ol-icon-btn {
	color: #ffffff;
	width: 36px;
	height: 36px;
	border-radius: var(--ol-radius-full);
	background-color: rgba(255, 255, 255, 0.12);
}

.ol-mini-cart__head .ol-icon-btn:hover {
	background-color: rgba(255, 255, 255, 0.22);
}

.ol-mini-cart__title {
	margin: 0;
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.2;
	color: #ffffff;
}

.ol-mini-cart__body {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
	padding: 0;
}

.ol-mini-cart__list {
	flex: 1 1 auto;
	overflow-y: auto;
	list-style: none;
	margin: 0;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.ol-mini-cart__item {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	padding-block-end: 16px;
	border-bottom: 1px solid var(--ol-color-border-light, #f3f4f6);
}

.ol-mini-cart__item:last-child {
	border-bottom: 0;
	padding-block-end: 0;
}

.ol-mini-cart__thumb {
	flex: 0 0 56px;
	width: 56px;
	aspect-ratio: 2 / 3;
	border-radius: var(--ol-radius-lg);
	overflow: hidden;
	background-color: var(--ol-color-surface-muted, #f5f5f4);
	border: 1px solid var(--ol-color-border-light, #f3f4f6);
}

.ol-mini-cart__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ol-mini-cart__info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.ol-mini-cart__name {
	font-size: 0.9375rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--ol-color-heading);
	text-decoration: none;
}

.ol-mini-cart__name:hover {
	color: var(--ol-color-accent);
}

.ol-mini-cart__qty {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	border: 0;
	background: transparent;
	padding: 0;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--ol-color-text-muted);
}

.ol-mini-cart__qty .amount {
	font-weight: 700;
	color: var(--ol-color-heading);
}

.ol-mini-cart__remove {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	border-radius: var(--ol-radius-md);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--ol-color-text-subtle, #6b7280);
	text-decoration: none;
}

.ol-mini-cart__remove:hover {
	background-color: var(--ol-color-danger-soft, #fef2f2);
	color: var(--ol-color-danger, #dc2626);
}

.ol-mini-cart__foot {
	flex: 0 0 auto;
	padding: 18px 20px 22px;
	background-color: var(--ol-color-surface);
	border-top: 1px solid var(--ol-color-border);
}

.ol-mini-cart__total {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin: 0 0 14px;
	font-size: 1rem;
	font-weight: 700;
	color: var(--ol-color-heading);
}

.ol-mini-cart__buttons {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin: 0;
}

.ol-mini-cart__buttons .button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 8px 14px;
	border-radius: var(--ol-radius-xl);
	font-size: 0.875rem;
	font-weight: 700;
	text-decoration: none;
	border: 1px solid var(--ol-color-secondary);
	color: var(--ol-color-secondary);
	background-color: var(--ol-color-bg);
}

.ol-mini-cart__buttons .button:hover {
	background-color: var(--ol-color-accent-soft);
}

.ol-mini-cart__buttons .button.checkout {
	background-color: var(--ol-color-primary);
	border-color: var(--ol-color-primary);
	color: #ffffff;
}

.ol-mini-cart__buttons .button.checkout:hover {
	background-color: var(--ol-color-primary-hover);
}

.ol-mini-cart__empty {
	text-align: center;
	padding: 48px 24px;
}

/* Cart Page (8/4 Split) */
.ol-cart-layout {
	display: grid;
	gap: var(--ol-space-6);
	margin-block: var(--ol-space-6) var(--ol-space-10);
	align-items: start;
}

@media (min-width: 1024px) {
	.ol-cart-layout {
		grid-template-columns: 8fr 4fr;
		gap: var(--ol-space-8);
	}
}

.ol-cart-list {
	display: flex;
	flex-direction: column;
	gap: var(--ol-space-4);
}

.ol-cart-card {
	display: flex;
	gap: var(--ol-space-4);
	background-color: var(--ol-color-bg);
	border: 1px solid var(--ol-color-border);
	border-radius: var(--ol-radius-3xl);
	padding: var(--ol-space-4);
	box-shadow: var(--ol-shadow-xs);
}

.ol-cart-card__thumb {
	flex: 0 0 76px;
	width: 76px;
	aspect-ratio: 2 / 3;
	border-radius: var(--ol-radius-xl);
	overflow: hidden;
	background-color: var(--ol-color-surface-muted, #f5f5f4);
}

.ol-cart-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ol-cart-card__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: var(--ol-space-3);
}

.ol-cart-card__top,
.ol-cart-card__bottom {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: var(--ol-space-3);
}

.ol-cart-card__title {
	font-size: 1rem;
	font-weight: 700;
	color: var(--ol-color-heading);
	text-decoration: none;
}

.ol-cart-card__unit-price {
	margin-block-start: 4px;
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--ol-color-heading);
}

.ol-cart-card__remove {
	width: 34px;
	height: 34px;
	border-radius: var(--ol-radius-lg);
	border: 1px solid var(--ol-color-border);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--ol-color-text-subtle, #6b7280);
}

.ol-cart-card__remove:hover {
	border-color: var(--ol-color-danger, #ef4444);
	color: var(--ol-color-danger, #ef4444);
}

.ol-cart-card__subtotal {
	text-align: end;
}

.ol-cart-card__subtotal-label {
	display: block;
	font-size: 0.6875rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--ol-color-text-subtle, #6b7280);
}

.ol-cart-actions {
	margin-block-start: var(--ol-space-5);
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: var(--ol-space-4);
}

.ol-coupon-row {
	display: flex;
	gap: var(--ol-space-2);
}

.ol-cart-actions__right {
	display: flex;
	align-items: center;
	gap: var(--ol-space-4);
}

.ol-link-back {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ol-color-accent);
	text-decoration: none;
}

.ol-cart-summary-col .cart_totals {
	position: sticky;
	top: 96px;
	background-color: var(--ol-color-bg);
	border: 1px solid var(--ol-color-border);
	border-radius: var(--ol-radius-3xl);
	padding: var(--ol-space-6);
	box-shadow: var(--ol-shadow-xs);
}

.ol-cart-summary-col .cart_totals h2 {
	margin: 0 0 var(--ol-space-4);
	font-size: 1.125rem;
	font-weight: 800;
}

.ol-cart-summary-col table.shop_table {
	width: 100%;
	border-collapse: collapse;
	margin-block-end: var(--ol-space-5);
}

.ol-cart-summary-col table.shop_table th,
.ol-cart-summary-col table.shop_table td {
	padding-block: var(--ol-space-3);
	border-bottom: 1px solid var(--ol-color-border-light, #f3f4f6);
	font-size: 0.9375rem;
}

.ol-cart-summary-col table.shop_table th {
	text-align: start;
	color: var(--ol-color-text-muted);
	font-weight: 500;
}

.ol-cart-summary-col table.shop_table td {
	text-align: end;
	font-weight: 700;
}

.wc-proceed-to-checkout .checkout-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 48px;
	border-radius: var(--ol-radius-xl);
	background-color: var(--ol-color-primary);
	color: #ffffff;
	font-weight: 700;
	text-decoration: none;
}

.wc-proceed-to-checkout .checkout-button:hover {
	background-color: var(--ol-color-primary-hover);
}

/* Checkout Page (7/5 Split) */
.ol-checkout-layout {
	display: grid;
	gap: var(--ol-space-6);
	margin-block: var(--ol-space-6) var(--ol-space-12);
	align-items: start;
}

@media (min-width: 1024px) {
	.ol-checkout-layout {
		grid-template-columns: 7fr 5fr;
		gap: var(--ol-space-8);
	}
}

.ol-checkout-card {
	background-color: var(--ol-color-bg);
	border: 1px solid var(--ol-color-border);
	border-radius: var(--ol-radius-3xl);
	padding: clamp(1.25rem, 3vw, 2rem);
	box-shadow: var(--ol-shadow-xs);
}

.ol-checkout-card--sticky {
	position: sticky;
	top: 96px;
}

.ol-checkout-card__title {
	margin: 0 0 var(--ol-space-4);
	font-size: 1.125rem;
	font-weight: 800;
}

.woocommerce-billing-fields__field-wrapper,
.woocommerce-shipping-fields__field-wrapper {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--ol-space-4);
}

@media (min-width: 480px) {
	.woocommerce-billing-fields__field-wrapper,
	.woocommerce-shipping-fields__field-wrapper {
		grid-template-columns: 1fr 1fr;
	}
	.form-row-wide {
		grid-column: 1 / -1;
	}
}

.woocommerce-checkout .form-row {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.woocommerce-checkout .form-row label {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--ol-color-heading);
}

.woocommerce-checkout .input-text,
.woocommerce-checkout select,
.woocommerce-checkout textarea {
	width: 100%;
	min-height: 44px;
	padding: 10px 14px;
	border-radius: var(--ol-radius-xl);
	border: 1px solid var(--ol-color-border);
	background-color: var(--ol-color-surface-alt, #fafaf9);
	font-size: 0.875rem;
}

.woocommerce-checkout-review-order-table {
	width: 100%;
	border-collapse: collapse;
	margin-block-end: var(--ol-space-5);
	font-size: 0.875rem;
}

.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td {
	padding-block: var(--ol-space-3);
	border-bottom: 1px solid var(--ol-color-border-light, #f3f4f6);
}

.woocommerce-checkout-review-order-table th {
	text-align: start;
}

.woocommerce-checkout-review-order-table td {
	text-align: end;
}

/* Payment Methods (Razorpay / UPI / COD safe styling) */
.wc_payment_methods {
	list-style: none;
	margin: 0 0 var(--ol-space-5);
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--ol-space-3);
}

.wc_payment_method {
	padding: var(--ol-space-4);
	border: 1px solid var(--ol-color-border);
	border-radius: var(--ol-radius-2xl);
	background-color: var(--ol-color-surface-alt, #fafaf9);
}

.wc_payment_method .payment_box {
	margin-block-start: var(--ol-space-3);
	padding-block-start: var(--ol-space-3);
	border-top: 1px solid var(--ol-color-border);
	font-size: 0.8125rem;
	color: var(--ol-color-text-muted);
}

#place_order {
	width: 100%;
	min-height: 48px;
	border: 0;
	border-radius: var(--ol-radius-xl);
	background-color: var(--ol-color-primary);
	color: #ffffff;
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
}

#place_order:hover {
	background-color: var(--ol-color-primary-hover);
}

/* My Account Login & Dashboard */
.ol-auth-wrap {
	margin-inline: auto;
	margin-block: var(--ol-space-8);
	display: grid;
	gap: var(--ol-space-6);
}

.ol-auth-wrap--single {
	max-width: 448px;
}

.ol-auth-wrap--split {
	max-width: 920px;
}

@media (min-width: 768px) {
	.ol-auth-wrap--split {
		grid-template-columns: 1fr 1fr;
	}
}

.ol-auth-card {
	background-color: var(--ol-color-bg);
	border: 1px solid var(--ol-color-border);
	border-radius: var(--ol-radius-3xl);
	padding: clamp(1.5rem, 4vw, 2.25rem);
	box-shadow: var(--ol-shadow-xl);
}

.ol-auth-card__title {
	margin: 0 0 var(--ol-space-2);
	font-size: 1.5rem;
	font-weight: 800;
	color: var(--ol-color-heading);
}

.ol-auth-card__sub {
	margin: 0 0 var(--ol-space-5);
	font-size: 0.875rem;
	color: var(--ol-color-text-muted);
}

.ol-auth-tabs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px;
	padding: 4px;
	margin-block-end: var(--ol-space-6);
	background-color: var(--ol-color-surface-muted, #f5f5f4);
	border-radius: var(--ol-radius-xl);
}

.ol-auth-tabs__btn {
	min-height: 40px;
	border: 0;
	border-radius: var(--ol-radius-lg);
	background: transparent;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ol-color-text-muted);
	cursor: pointer;
	transition: background-color var(--ol-dur-fast, 200ms) ease, color var(--ol-dur-fast, 200ms) ease;
}

.ol-auth-tabs__btn.is-active {
	background-color: var(--ol-color-bg);
	color: var(--ol-color-primary);
	font-weight: 700;
	box-shadow: var(--ol-shadow-xs);
}

.ol-auth-card__switch {
	margin: var(--ol-space-5) 0 0;
	padding-block-start: var(--ol-space-4);
	border-top: 1px solid var(--ol-color-border-light, #f3f4f6);
	text-align: center;
	font-size: 0.875rem;
	color: var(--ol-color-text-muted);
}

.ol-auth-card__switch-btn {
	border: 0;
	background: transparent;
	padding: 0 4px;
	font-size: inherit;
	font-weight: 700;
	color: var(--ol-color-accent);
	cursor: pointer;
	text-decoration: underline;
}

.ol-auth-card__note {
	font-size: 0.8125rem;
	color: var(--ol-color-text-muted);
}

.ol-auth-card__remember {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.875rem;
}

.woocommerce-account .woocommerce {
	display: grid;
	gap: var(--ol-space-6);
}

@media (min-width: 768px) {
	.woocommerce-account.logged-in .woocommerce {
		grid-template-columns: 240px minmax(0, 1fr);
		align-items: start;
	}
}

.woocommerce-MyAccount-navigation ul {
	list-style: none;
	margin: 0;
	padding: var(--ol-space-3);
	background-color: var(--ol-color-bg);
	border: 1px solid var(--ol-color-border);
	border-radius: var(--ol-radius-2xl);
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.woocommerce-MyAccount-navigation li a {
	display: block;
	padding: 10px 14px;
	border-radius: var(--ol-radius-xl);
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ol-color-text-muted);
	text-decoration: none;
}

.woocommerce-MyAccount-navigation li.is-active a,
.woocommerce-MyAccount-navigation li a:hover {
	background-color: var(--ol-color-primary);
	color: #ffffff;
}

.woocommerce-MyAccount-content {
	background-color: var(--ol-color-bg);
	border: 1px solid var(--ol-color-border);
	border-radius: var(--ol-radius-2xl);
	padding: var(--ol-space-6);
}

/* Password toggle alignment in My Account */
.password-input {
	position: relative;
	display: block;
}

.password-input .show-password-input {
	position: absolute;
	inset-inline-end: 12px;
	top: 50%;
	transform: translateY(-50%);
	width: 28px;
	height: 28px;
	border: 0;
	background: transparent;
	color: var(--ol-color-text-subtle, #6b7280);
	cursor: pointer;
	padding: 0;
}

/* WooCommerce Cart & Checkout Blocks theme alignment */
.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button,
.wc-block-components-button.contained {
	background-color: var(--ol-color-primary) !important;
	color: #ffffff !important;
	border-radius: var(--ol-radius-xl) !important;
	text-decoration: none !important;
	font-weight: 700 !important;
}

.wc-block-cart__submit-button:hover,
.wc-block-components-checkout-place-order-button:hover {
	background-color: var(--ol-color-primary-hover) !important;
}

.wc-block-components-select select,
.wc-blocks-components-select__select {
	appearance: none !important;
	background-image: none !important;
}

/* Order Received table mobile readability */
.woocommerce-table--order-details {
	width: 100%;
	border-collapse: collapse;
}

.woocommerce-table--order-details th,
.woocommerce-table--order-details td {
	padding: var(--ol-space-3) var(--ol-space-2);
	border-bottom: 1px solid var(--ol-color-border-light, #f3f4f6);
}

.woocommerce-table--order-details td:last-child,
.woocommerce-table--order-details th:last-child {
	text-align: end;
	white-space: nowrap;
}
