/**
 * Checkout module — Shared component styles.
 *
 * Loaded on all WooCommerce pages. Contains sidebar item cards,
 * quantity controls, and promo code components that may also
 * be used on the cart page in the future.
 *
 * @package Woo_Specialist
 */

/* =========================================================================
   Sidebar — Dark theme
   ========================================================================= */

.wsp-sidebar {
	color: var(--wsp-color-white);
}

.wsp-sidebar__items {
	display: flex;
	flex-direction: column;
	gap: var(--wsp-space-md);
	margin-bottom: var(--wsp-space-lg);
}

.wsp-sidebar__item {
	display: flex;
	align-items: center;
	gap: var(--wsp-space-md);
}

.wsp-sidebar__item-thumb {
	position: relative;
	flex-shrink: 0;
	width: 64px;
	height: 64px;
	border-radius: var(--wsp-radius-sm);
	overflow: hidden;
	background: var(--wsp-color-white);
}

.wsp-sidebar__item-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wsp-sidebar__item-badge {
	position: absolute;
	top: -6px;
	right: -6px;
	min-width: 20px;
	height: 20px;
	border-radius: 10px;
	background: var(--wsp-color-text);
	color: var(--wsp-color-white);
	font-size: 11px;
	font-weight: var(--wsp-font-weight-semibold);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 5px;
}

.wsp-sidebar__item-info {
	flex: 1;
	min-width: 0;
}

.wsp-sidebar__item-name {
	font-size: var(--wsp-font-size-sm);
	font-weight: var(--wsp-font-weight-medium);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wsp-sidebar__item-controls {
	display: flex;
	align-items: center;
	gap: var(--wsp-space-xs);
	margin-top: 4px;
}

.wsp-sidebar__qty-btn {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.3);
	background: transparent;
	color: var(--wsp-color-white);
	font-size: 13px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: border-color var(--wsp-transition-fast);
}

.wsp-sidebar__qty-btn:hover {
	border-color: var(--wsp-color-white);
}

.wsp-sidebar__qty-val {
	font-size: 13px;
	min-width: 16px;
	text-align: center;
	color: var(--wsp-color-white);
}

.wsp-sidebar__remove-btn {
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.4);
	font-size: 16px;
	cursor: pointer;
	padding: 0 0 0 var(--wsp-space-xs);
	line-height: 1;
	transition: color var(--wsp-transition-fast);
}

.wsp-sidebar__remove-btn:hover {
	color: var(--wsp-color-error);
}

.wsp-sidebar__item-price {
	font-size: var(--wsp-font-size-sm);
	font-weight: var(--wsp-font-weight-medium);
	white-space: nowrap;
}

/* =========================================================================
   Sidebar — Promo code
   ========================================================================= */

.wsp-sidebar__promo {
	border-top: 1px solid rgba(255, 255, 255, 0.15);
	border-bottom: 1px solid rgba(255, 255, 255, 0.15);
	padding: var(--wsp-space-md) 0;
	margin-bottom: var(--wsp-space-md);
}

.wsp-sidebar__promo-toggle {
	background: none;
	border: none;
	color: var(--wsp-color-white);
	font-size: var(--wsp-font-size-sm);
	font-weight: var(--wsp-font-weight-medium);
	cursor: pointer;
	padding: 0;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.wsp-sidebar__promo-form {
	margin-top: var(--wsp-space-sm);
}

.wsp-sidebar__promo-row {
	display: flex;
	gap: var(--wsp-space-sm);
}

.wsp-sidebar__promo-input {
	flex: 1;
	padding: var(--wsp-space-sm) var(--wsp-space-md);
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: var(--wsp-radius-sm);
	background: transparent;
	color: var(--wsp-color-white);
	font-size: var(--wsp-font-size-sm);
}

.wsp-sidebar__promo-input::placeholder {
	color: rgba(255, 255, 255, 0.5);
}

.wsp-sidebar__promo-btn {
	background: var(--wsp-color-white);
	color: var(--wsp-color-text);
	border: none;
	font-size: var(--wsp-font-size-sm);
	padding: var(--wsp-space-sm) var(--wsp-space-md);
}

.wsp-sidebar__promo-message {
	font-size: 12px;
	margin-top: var(--wsp-space-xs);
	min-height: 0;
	transition: opacity var(--wsp-transition-fast);
}

.wsp-sidebar__promo-message--success {
	color: var(--wsp-color-success);
}

.wsp-sidebar__promo-message--error {
	color: var(--wsp-color-error);
}

.wsp-sidebar__promo-btn:disabled {
	opacity: 0.6;
	cursor: wait;
}

/* =========================================================================
   Sidebar — Totals
   ========================================================================= */

.wsp-sidebar__totals {
	display: flex;
	flex-direction: column;
	gap: var(--wsp-space-sm);
}

.wsp-sidebar__row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: var(--wsp-font-size-sm);
}

.wsp-sidebar__row-label {
	color: rgba(255, 255, 255, 0.7);
}

.wsp-sidebar__row-value {
	font-weight: var(--wsp-font-weight-medium);
}

.wsp-sidebar__row--discount .wsp-sidebar__row-value {
	color: var(--wsp-color-success);
	display: flex;
	align-items: center;
	gap: var(--wsp-space-xs);
}

.wsp-sidebar__coupon-remove {
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.5);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	padding: 0 2px;
	transition: color var(--wsp-transition-fast);
}

.wsp-sidebar__coupon-remove:hover {
	color: var(--wsp-color-error);
}

.wsp-sidebar__divider {
	height: 1px;
	background: rgba(255, 255, 255, 0.15);
	margin: var(--wsp-space-sm) 0;
}

.wsp-sidebar__row--total {
	font-size: var(--wsp-font-size-base);
}

.wsp-sidebar__row--total .wsp-sidebar__row-label {
	color: var(--wsp-color-white);
	font-weight: var(--wsp-font-weight-semibold);
}

.wsp-sidebar__row--total .wsp-sidebar__row-value {
	font-size: var(--wsp-font-size-lg);
	font-weight: var(--wsp-font-weight-semibold);
}

/* =========================================================================
   Thank You page
   ========================================================================= */

.wsp-thankyou {
	max-width: 680px;
	margin: 0 auto;
	padding: var(--wsp-space-2xl) var(--wsp-space-lg);
}

.wsp-thankyou__header {
	text-align: center;
	margin-bottom: var(--wsp-space-2xl);
}

.wsp-thankyou__checkmark {
	color: var(--wsp-color-success);
	margin-bottom: var(--wsp-space-md);
}

.wsp-thankyou__checkmark svg {
	animation: wspCheckDraw 600ms ease-out forwards;
}

@keyframes wspCheckDraw {
	from { opacity: 0; transform: scale(0.8); }
	to { opacity: 1; transform: scale(1); }
}

.wsp-thankyou__order-num {
	font-size: var(--wsp-font-size-sm);
	color: var(--wsp-color-text-muted);
	margin: 0 0 var(--wsp-space-xs);
}

.wsp-thankyou__title {
	font-size: var(--wsp-font-size-xl);
	font-weight: var(--wsp-font-weight-semibold);
	margin: 0 0 var(--wsp-space-sm);
}

.wsp-thankyou__subtitle {
	font-size: var(--wsp-font-size-sm);
	color: var(--wsp-color-text-muted);
	margin: 0;
}

.wsp-thankyou__details {
	margin-bottom: var(--wsp-space-2xl);
}

.wsp-thankyou__detail-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--wsp-space-lg);
	border: 1px solid var(--wsp-color-border-light);
	border-radius: var(--wsp-radius-md);
	padding: var(--wsp-space-lg);
}

.wsp-thankyou__detail h3 {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--wsp-color-text-muted);
	margin: 0 0 var(--wsp-space-xs);
	font-weight: var(--wsp-font-weight-medium);
}

.wsp-thankyou__detail p {
	font-size: var(--wsp-font-size-sm);
	margin: 0;
}

.wsp-thankyou__items {
	margin-bottom: var(--wsp-space-2xl);
}

.wsp-thankyou__items h2 {
	font-size: var(--wsp-font-size-base);
	font-weight: var(--wsp-font-weight-semibold);
	margin: 0 0 var(--wsp-space-md);
}

.wsp-thankyou__table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--wsp-font-size-sm);
}

.wsp-thankyou__table th,
.wsp-thankyou__table td {
	padding: var(--wsp-space-sm) 0;
	border-bottom: 1px solid var(--wsp-color-border-light);
	text-align: left;
}

.wsp-thankyou__table thead th {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--wsp-color-text-muted);
	font-weight: var(--wsp-font-weight-medium);
}

.wsp-thankyou__table-right {
	text-align: right !important;
}

.wsp-thankyou__qty {
	color: var(--wsp-color-text-muted);
	margin-left: var(--wsp-space-xs);
}

.wsp-thankyou__notes {
	margin-bottom: var(--wsp-space-2xl);
	padding: var(--wsp-space-md) var(--wsp-space-lg);
	background: var(--wsp-color-bg-alt);
	border-radius: var(--wsp-radius-md);
}

.wsp-thankyou__notes h3 {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--wsp-color-text-muted);
	margin: 0 0 var(--wsp-space-xs);
	font-weight: var(--wsp-font-weight-medium);
}

.wsp-thankyou__notes p {
	font-size: var(--wsp-font-size-sm);
	margin: 0;
	white-space: pre-wrap;
}

.wsp-thankyou__table tbody td {
	vertical-align: middle;
}

.wsp-thankyou__table tbody td img {
	vertical-align: middle;
}

.wsp-thankyou__total td {
	font-weight: var(--wsp-font-weight-semibold);
	font-size: var(--wsp-font-size-base);
	border-bottom: none;
	padding-top: var(--wsp-space-md);
}

.wsp-thankyou__actions {
	display: flex;
	gap: var(--wsp-space-md);
	justify-content: center;
}

@media (max-width: 640px) {
	.wsp-thankyou__detail-grid {
		grid-template-columns: 1fr;
	}

	.wsp-thankyou__actions {
		flex-direction: column;
		align-items: stretch;
		text-align: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wsp-thankyou__checkmark svg {
		animation: none;
	}
}

/* =========================================================================
   Cart step (Step 1) — Light-theme cart item cards
   ========================================================================= */

.wsp-cart-items {
	display: flex;
	flex-direction: column;
	gap: var(--wsp-space-md);
	margin-bottom: var(--wsp-space-xl);
}

/* Override dark-sidebar item styles when card is on the light cart step. */
.wsp-cart-item.wsp-sidebar__item {
	display: grid;
	grid-template-columns: 96px 1fr auto;
	gap: var(--wsp-space-md);
	align-items: start;
	padding: var(--wsp-space-md);
	background: var(--wsp-color-white);
	border: 1px solid var(--wsp-color-border-light);
	border-radius: var(--wsp-radius-md);
	margin: 0;
}

.wsp-cart-item__thumb {
	width: 96px;
	height: 96px;
	border-radius: var(--wsp-radius-sm);
	overflow: hidden;
	background: var(--wsp-color-bg-muted);
	flex-shrink: 0;
}

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

.wsp-cart-item__info {
	display: flex;
	flex-direction: column;
	gap: var(--wsp-space-xs);
	min-width: 0;
}

.wsp-cart-item__name {
	font-size: var(--wsp-font-size-md);
	font-weight: var(--wsp-font-weight-semibold);
	color: var(--wsp-color-text);
	text-decoration: none;
	line-height: 1.3;
}

a.wsp-cart-item__name:hover {
	color: var(--wsp-color-accent);
}

.wsp-cart-item__variations {
	font-size: var(--wsp-font-size-sm);
	color: var(--wsp-color-text-muted);
}

.wsp-cart-item__variations p {
	margin: 0;
}

.wsp-cart-item__unit-price {
	font-size: var(--wsp-font-size-sm);
	color: var(--wsp-color-text-muted);
}

.wsp-cart-item__controls {
	display: flex;
	align-items: center;
	gap: var(--wsp-space-sm);
	margin-top: var(--wsp-space-xs);
}

/* Light-theme overrides for qty/remove buttons inside cart items. */
.wsp-cart-item .wsp-sidebar__qty-btn {
	width: 28px;
	height: 28px;
	border: 1px solid var(--wsp-color-border);
	color: var(--wsp-color-text);
	font-size: 16px;
}

.wsp-cart-item .wsp-sidebar__qty-btn:hover {
	border-color: var(--wsp-color-text);
}

.wsp-cart-item .wsp-sidebar__qty-val {
	font-size: var(--wsp-font-size-md);
	color: var(--wsp-color-text);
	min-width: 20px;
}

.wsp-cart-item .wsp-sidebar__remove-btn {
	color: var(--wsp-color-text-muted);
	font-size: var(--wsp-font-size-sm);
	padding: 0 0 0 var(--wsp-space-sm);
	margin-left: auto;
	text-decoration: underline;
}

.wsp-cart-item .wsp-sidebar__remove-btn:hover {
	color: var(--wsp-color-error);
}

.wsp-cart-item__line-total {
	font-size: var(--wsp-font-size-md);
	font-weight: var(--wsp-font-weight-semibold);
	color: var(--wsp-color-text);
	white-space: nowrap;
	align-self: start;
}

/* Cart step — promo + totals (light theme overrides for sidebar classes). */
.wsp-cart__promo {
	margin: var(--wsp-space-xl) 0;
	padding: var(--wsp-space-md);
	background: var(--wsp-color-bg-muted);
	border-radius: var(--wsp-radius-md);
}

.wsp-cart__promo .wsp-sidebar__promo-toggle {
	color: var(--wsp-color-text);
}

.wsp-cart__promo .wsp-sidebar__promo-toggle:hover {
	color: var(--wsp-color-accent);
}

.wsp-cart__totals {
	border-top: 1px solid var(--wsp-color-border-light);
	padding-top: var(--wsp-space-lg);
	margin-bottom: var(--wsp-space-xl);
}

.wsp-cart__totals .wsp-sidebar__row {
	color: var(--wsp-color-text);
}

.wsp-cart__totals .wsp-sidebar__row-label,
.wsp-cart__totals .wsp-sidebar__row-value {
	color: var(--wsp-color-text);
}

.wsp-cart__totals .wsp-sidebar__row--total .wsp-sidebar__row-value {
	color: var(--wsp-color-text);
}

.wsp-cart__totals .wsp-sidebar__divider {
	background: var(--wsp-color-border-light);
}

.wsp-cart-empty {
	padding: var(--wsp-space-2xl) 0;
	text-align: center;
}

.wsp-cart-empty p {
	margin-bottom: var(--wsp-space-lg);
	font-size: var(--wsp-font-size-md);
	color: var(--wsp-color-text-muted);
}

/* Mobile: stack cart item layout vertically. */
@media (max-width: 640px) {
	.wsp-cart-item.wsp-sidebar__item {
		grid-template-columns: 80px 1fr;
		grid-template-areas:
			"thumb info"
			"total total";
		row-gap: var(--wsp-space-sm);
	}

	.wsp-cart-item__thumb {
		grid-area: thumb;
		width: 80px;
		height: 80px;
	}

	.wsp-cart-item__info {
		grid-area: info;
	}

	.wsp-cart-item__line-total {
		grid-area: total;
		text-align: right;
		padding-top: var(--wsp-space-xs);
		border-top: 1px solid var(--wsp-color-border-light);
	}
}
