/**
 * Cart drawer & cart page styling.
 * Responsive, accessible, brand-compliant.
 */

/* ================================================================
   CART DRAWER (MINICART)
   ================================================================ */

.zoi-cart-drawer {
	position: fixed;
	top: 0;
	right: 0;
	width: 100%;
	height: 100%;
	z-index: 1000;
	pointer-events: none;
	display: flex;
	align-items: flex-end;
	/*
	 * The panel must start flush to the right edge. Without this it began at
	 * x=0, so `translateX(100%)` moved it only its own width and it sat
	 * visible mid-viewport on wide screens instead of hiding off-screen.
	 */
	justify-content: flex-end;
	/* Never intercept scroll or clicks while closed. */
	overflow: hidden;
}

.zoi-cart-drawer--open {
	pointer-events: auto;
}

.zoi-cart-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity 0.3s ease-out;
	pointer-events: none;
}

.zoi-cart-drawer--open .zoi-cart-drawer__overlay {
	opacity: 1;
	pointer-events: auto;
}

.zoi-cart-drawer__panel {
	position: relative;
	width: 100%;
	height: 100%;
	max-width: 450px;
	background: #f4eee3;
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.3s ease-out;
	box-shadow: -10px 0 40px rgba(43, 32, 24, 0.15);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.zoi-cart-drawer--open .zoi-cart-drawer__panel {
	transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
	.zoi-cart-drawer__overlay,
	.zoi-cart-drawer__panel {
		transition: none;
	}
}

@media (max-width: 767px) {
	.zoi-cart-drawer__panel {
		max-width: 100%;
		height: 100vh;
	}
}

/* Header */
.zoi-cart-drawer__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1.5rem;
	border-bottom: 1px solid #e0ddd4;
	flex-shrink: 0;
}

.zoi-cart-drawer__title {
	font-size: 1.4rem;
	font-weight: 500;
	margin: 0;
	color: #2b2018;
	font-family: 'Cormorant Garamond', serif;
}

.zoi-cart-drawer__close {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border: none;
	background: transparent;
	cursor: pointer;
	color: #2b2018;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s ease-out;
	border-radius: 2px;
}

.zoi-cart-drawer__close:hover,
.zoi-cart-drawer__close:focus {
	outline: 2px solid #9a6d3f;
	outline-offset: 2px;
}

/* Items list */
.zoi-cart-drawer__items {
	/*
	 * `flex: 1` alone left this with whatever the fixed sections below did not
	 * take — coupon, totals and actions together claimed ~570px of a 90vh
	 * panel, squeezing the item list to 151px and clipping a 134px row. A
	 * minimum keeps at least two items readable; the list scrolls beyond that.
	 */
	flex: 1 1 auto;
	min-height: 45vh;
	overflow-y: auto;
	padding: 1.25rem 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.zoi-cart-drawer__loading {
	color: #5f554a;
	text-align: center;
	margin: auto;
}

.zoi-cart-drawer__empty {
	color: #5f554a;
	text-align: center;
	padding: 3rem 1rem;
	margin: auto;
}

/* Cart item */
.zoi-cart-item {
	display: grid;
	/* Image fixed, name takes the slack, controls only as wide as needed. */
	grid-template-columns: 64px minmax(0, 1fr) auto;
	gap: 0.85rem;
	align-items: start;
	padding: 0.85rem;
	border: 1px solid #e0ddd4;
	background: white;
	border-radius: 2px;
}

.zoi-cart-item__image {
	width: 80px;
	height: 80px;
	object-fit: cover;
	background: #f0ebe3;
	border-radius: 2px;
}

.zoi-cart-item__details {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	min-width: 0;
}

.zoi-cart-item__name {
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.35;
	color: #2b2018;
	margin: 0;
	/*
	 * Was `white-space: nowrap` with an ellipsis, which truncated almost every
	 * product to "Gold Jhumka Ea…". Wraps to two lines instead, so the name is
	 * actually readable, and clamps rather than pushing the row taller.
	 */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.zoi-cart-item__attributes {
	font-size: 0.85rem;
	color: #5f554a;
	margin: 0;
}

.zoi-cart-item__price {
	font-size: 0.9rem;
	font-weight: 600;
	color: #2b2018;
	margin: 0;
}

.zoi-cart-item__actions {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	align-items: flex-end;
}

.zoi-cart-item__qty-control {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	border: 1px solid #d4c5b9;
	border-radius: 2px;
	padding: 0.25rem;
	background: white;
}

.zoi-cart-item__qty-btn {
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	cursor: pointer;
	color: #2b2018;
	font-weight: 600;
	font-size: 1.2rem;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease-out;
	border-radius: 2px;
}

.zoi-cart-item__qty-btn:hover,
.zoi-cart-item__qty-btn:focus {
	background: #f0ebe3;
	outline: 2px solid #9a6d3f;
	outline-offset: -2px;
}

.zoi-cart-item__qty {
	width: 32px;
	height: 32px;
	border: none;
	border-left: 1px solid #d4c5b9;
	border-right: 1px solid #d4c5b9;
	background: white;
	color: #2b2018;
	font-size: 0.9rem;
	text-align: center;
	padding: 0;
	font-family: 'Archivo', sans-serif;
	cursor: text;
}

.zoi-cart-item__qty:focus {
	outline: 2px solid #9a6d3f;
	outline-offset: -2px;
}

.zoi-cart-item__remove {
	font-size: 0.85rem;
	color: #9a6d3f;
	border: none;
	background: transparent;
	cursor: pointer;
	text-decoration: underline;
	transition: color 0.2s ease-out;
	padding: 0.25rem;
	border-radius: 2px;
}

.zoi-cart-item__remove:hover,
.zoi-cart-item__remove:focus {
	color: #2b2018;
	outline: 2px solid #9a6d3f;
	outline-offset: 2px;
}

/* Coupon section */
.zoi-cart-drawer__coupon-section {
	padding: 1rem 1.5rem;
	border-top: 1px solid #e0ddd4;
	flex-shrink: 0;
}

.zoi-cart-drawer__coupon-label {
	display: block;
	font-size: 0.9rem;
	font-weight: 600;
	color: #2b2018;
	margin-bottom: 0.5rem;
}

.zoi-cart-drawer__coupon-input-group {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.zoi-cart-drawer__coupon-input {
	flex: 1;
	padding: 0.75rem;
	font-size: 0.9rem;
	border: 1px solid #d4c5b9;
	border-radius: 2px;
	background: white;
	color: #2b2018;
	font-family: 'Archivo', sans-serif;
}

.zoi-cart-drawer__coupon-input:focus {
	outline: 2px solid #9a6d3f;
	outline-offset: -2px;
}

.zoi-cart-drawer__coupon-btn {
	padding: 0.75rem 1.5rem;
	font-size: 0.9rem;
	font-weight: 600;
	background: #2b2018;
	color: #f4eee3;
	border: none;
	border-radius: 2px;
	cursor: pointer;
	transition: background 0.2s ease-out;
	font-family: 'Archivo', sans-serif;
}

.zoi-cart-drawer__coupon-btn:hover,
.zoi-cart-drawer__coupon-btn:focus {
	background: #1a0f09;
	outline: 2px solid #9a6d3f;
	outline-offset: 2px;
}

.zoi-cart-drawer__coupon-feedback {
	font-size: 0.85rem;
	min-height: 1.4rem;
	margin-top: 0.5rem;
}

.zoi-cart-drawer__coupon-feedback--success {
	color: #2b7a0b;
}

.zoi-cart-drawer__coupon-feedback--error {
	color: #c41e1e;
}

/* Totals */
.zoi-cart-drawer__totals {
	padding: 1rem 1.5rem;
	border-top: 1px solid #e0ddd4;
	flex-shrink: 0;
}

.zoi-cart-drawer__total-row {
	display: flex;
	justify-content: space-between;
	padding: 0.5rem 0;
	font-size: 0.95rem;
	color: #5f554a;
}

.zoi-cart-drawer__total-row--final {
	border-top: 1px solid #e0ddd4;
	padding-top: 1rem;
	margin-top: 1rem;
	font-weight: 600;
	color: #2b2018;
	font-size: 1.1rem;
}

.zoi-cart-drawer__total-label {
	flex: 1;
}

.zoi-cart-drawer__total-value {
	text-align: right;
	font-weight: 600;
}

/* Actions */
.zoi-cart-drawer__actions {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	padding: 1rem 1.5rem 1.25rem;
	border-top: 1px solid #e0ddd4;
	flex-shrink: 0;
}

.zoi-cart-drawer__btn {
	padding: 1rem;
	font-size: 0.95rem;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	border-radius: 2px;
	transition: all 0.2s ease-out;
	display: block;
	border: none;
	cursor: pointer;
	font-family: 'Archivo', sans-serif;
}

.zoi-cart-drawer__btn--primary {
	background: #2b2018;
	color: #f4eee3;
}

.zoi-cart-drawer__btn--primary:hover,
.zoi-cart-drawer__btn--primary:focus {
	background: #1a0f09;
	outline: 2px solid #9a6d3f;
	outline-offset: 2px;
}

.zoi-cart-drawer__btn--secondary {
	background: transparent;
	color: #2b2018;
	border: 2px solid #2b2018;
}

.zoi-cart-drawer__btn--secondary:hover,
.zoi-cart-drawer__btn--secondary:focus {
	background: #2b2018;
	color: #f4eee3;
	outline: 2px solid #9a6d3f;
	outline-offset: 2px;
}

.zoi-cart-drawer__btn--disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ================================================================
   CART PAGE (FULL PAGE)
   ================================================================ */

.zoi-cart-page {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 3rem;
	max-width: 1200px;
	margin: 0 auto;
	padding: 2rem;
}

@media (max-width: 768px) {
	.zoi-cart-page {
		grid-template-columns: 1fr;
		gap: 2rem;
	}
}

.zoi-cart-page__items {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.zoi-cart-page__item {
	display: grid;
	grid-template-columns: 120px 1fr auto;
	gap: 1.5rem;
	padding: 1.5rem;
	border: 1px solid #e0ddd4;
	background: white;
	border-radius: 2px;
}

.zoi-cart-page__item-image {
	width: 120px;
	height: 160px;
	object-fit: cover;
	background: #f0ebe3;
}

.zoi-cart-page__item-info {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.zoi-cart-page__item-name {
	font-size: 1rem;
	font-weight: 600;
	color: #2b2018;
	margin: 0;
}

.zoi-cart-page__item-attributes {
	font-size: 0.9rem;
	color: #5f554a;
	margin: 0;
}

.zoi-cart-page__item-price {
	font-size: 1rem;
	font-weight: 600;
	color: #2b2018;
}

.zoi-cart-page__item-actions {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	align-items: flex-end;
	text-align: right;
}

.zoi-cart-page__empty {
	text-align: center;
	padding: 3rem;
	color: #5f554a;
}

.zoi-cart-page__empty-link {
	display: inline-block;
	margin-top: 1rem;
	padding: 0.75rem 1.5rem;
	background: #2b2018;
	color: #f4eee3;
	text-decoration: none;
	border-radius: 2px;
	transition: background 0.2s ease-out;
}

.zoi-cart-page__empty-link:hover {
	background: #1a0f09;
}

.zoi-cart-page__summary {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	background: #f9f7f4;
	padding: 2rem;
	border-radius: 2px;
	height: fit-content;
	position: sticky;
	top: 2rem;
}

.zoi-cart-page__summary-title {
	font-size: 1.1rem;
	font-weight: 600;
	color: #2b2018;
	margin: 0;
}

.zoi-cart-page__summary-row {
	display: flex;
	justify-content: space-between;
	font-size: 0.95rem;
	color: #5f554a;
}

.zoi-cart-page__summary-row--total {
	border-top: 1px solid #e0ddd4;
	padding-top: 1rem;
	font-weight: 600;
	color: #2b2018;
	font-size: 1.1rem;
}

/* ================================================================
   ACCESSIBILITY
   ================================================================ */

/* Focus indicators */
.zoi-cart-drawer__close:focus-visible,
.zoi-cart-drawer__coupon-input:focus-visible,
.zoi-cart-drawer__coupon-btn:focus-visible,
.zoi-cart-item__qty-btn:focus-visible,
.zoi-cart-item__remove:focus-visible,
.zoi-cart-drawer__btn:focus-visible {
	outline: 2px solid #9a6d3f;
	outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
	.zoi-cart-drawer__panel {
		border-left: 3px solid #2b2018;
	}

	.zoi-cart-item {
		border-width: 2px;
	}
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
	.zoi-cart-drawer__overlay,
	.zoi-cart-drawer__panel,
	.zoi-cart-drawer__btn,
	.zoi-cart-item__remove {
		transition: none;
	}
}
