/**
 * Product quick-view styles.
 *
 * Desktop: centered modal. Mobile: bottom sheet.
 * Brand: primary rgb(22,163,74), secondary #fbbc34.
 * Font inherits from the active theme.
 */

/* --------------------------------------------------------------------------
 * CSS custom properties (Khaloghli brand tokens)
 * -------------------------------------------------------------------------- */
.kh-qv-root {
	--kh-qv-primary: rgb(22, 163, 74);
	--kh-qv-primary-hover: rgb(18, 140, 64);
	--kh-qv-secondary: rgb(22, 163, 74);
	--kh-qv-bg: #ffffff;
	--kh-qv-media-bg: #f3f3f3;
	--kh-qv-text: #1a1a1a;
	--kh-qv-muted: #8a8a8a;
	--kh-qv-border: #ececec;
	--kh-qv-backdrop: rgba(0, 0, 0, 0.45);
	--kh-qv-radius-panel: 20px;
	--kh-qv-radius-btn: 12px;
	--kh-qv-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	--kh-qv-z: 100050;
	font-family: inherit;
}

/* --------------------------------------------------------------------------
 * Root overlay
 * -------------------------------------------------------------------------- */
.kh-qv-root {
	position: fixed;
	inset: 0;
	z-index: var(--kh-qv-z);
	display: flex;
	align-items: flex-end;
	justify-content: center;
	pointer-events: none;
}

.kh-qv-root:not([hidden]) {
	pointer-events: auto;
}

.kh-qv-root[hidden] {
	display: none !important;
}

/* Dimmed backdrop */
.kh-qv-backdrop {
	position: absolute;
	inset: 0;
	background: var(--kh-qv-backdrop);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.kh-qv-root.is-open .kh-qv-backdrop {
	opacity: 1;
}

/* Body scroll lock while open */
body.kh-qv-open {
	overflow: hidden;
}

/* --------------------------------------------------------------------------
 * Panel (mobile bottom sheet by default)
 * -------------------------------------------------------------------------- */
.kh-qv-panel {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 100%;
	max-height: min(92vh, 920px);
	background: var(--kh-qv-bg);
	border-radius: var(--kh-qv-radius-panel) var(--kh-qv-radius-panel) 0 0;
	box-shadow: var(--kh-qv-shadow);
	display: flex;
	flex-direction: column;
	transform: translateY(110%);
	transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
	outline: none;
	overflow: hidden;
}

.kh-qv-root.is-open .kh-qv-panel {
	transform: translateY(0);
}

.kh-qv-panel-inner {
	display: flex;
	flex-direction: column;
	min-height: 0;
	flex: 1;
	position: relative;
}

.kh-qv-body {
	display: flex;
	flex-direction: column;
	min-height: 0;
	flex: 1;
	overflow: hidden;
}

.kh-qv-content {
	display: flex;
	flex-direction: column;
	min-height: 0;
	flex: 1;
	height: 100%;
}

/* --------------------------------------------------------------------------
 * Loading state
 * -------------------------------------------------------------------------- */
.kh-qv-loading {
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	min-height: 280px;
	padding: 32px;
	color: var(--kh-qv-muted);
	font-size: 14px;
}

.kh-qv-root.is-loading .kh-qv-loading {
	display: flex;
}

.kh-qv-root.is-loading .kh-qv-body {
	display: none;
}

.kh-qv-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid #e5e5e5;
	border-top-color: var(--kh-qv-primary);
	border-radius: 50%;
	animation: kh-qv-spin 0.7s linear infinite;
}

@keyframes kh-qv-spin {
	to {
		transform: rotate(360deg);
	}
}

/* --------------------------------------------------------------------------
 * Media / image area
 * -------------------------------------------------------------------------- */
.kh-qv-media {
	position: relative;
	flex: 0 0 auto;
	background: var(--kh-qv-media-bg);
}

.kh-qv-image-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 220px;
	max-height: 42vh;
	padding: 28px 48px 20px;
}

.kh-qv-image {
	display: block;
	max-width: 100%;
	max-height: min(36vh, 320px);
	width: auto;
	height: auto;
	object-fit: contain;
}

/* Circular floating icon buttons */
.kh-qv-icon-btn {
	position: absolute;
	top: 14px;
	z-index: 2;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
	color: var(--kh-qv-text);
	text-decoration: none;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kh-qv-icon-btn:hover,
.kh-qv-icon-btn:focus-visible {
	transform: scale(1.05);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
	outline: none;
}

.kh-qv-close {
	inset-inline-end: 14px;
}

.kh-qv-wishlist {
	position: absolute;
	top: 14px;
	inset-inline-start: 14px;
	z-index: 2;
	margin: 0;
}

.kh-qv-wishlist .kh-qv-icon-btn {
	position: static;
}

.kh-qv-icon-x,
.kh-qv-icon-heart {
	display: block;
	width: 18px;
	height: 18px;
	background-position: center;
	background-repeat: no-repeat;
	background-size: contain;
}

/* Simple geometric close (X) via CSS borders */
.kh-qv-icon-x {
	position: relative;
}

.kh-qv-icon-x::before,
.kh-qv-icon-x::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 16px;
	height: 2px;
	background: #222;
	border-radius: 1px;
}

.kh-qv-icon-x::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.kh-qv-icon-x::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

/* Heart outline via SVG data URI */
.kh-qv-icon-heart {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23222222' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.6l-1-1a5.5 5.5 0 0 0-7.8 7.8l1 1L12 21l7.8-7.6 1-1a5.5 5.5 0 0 0 0-7.8z'/%3E%3C/svg%3E");
}

.kh-qv-wishlist-link.added .kh-qv-icon-heart {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23e74c3c' stroke='%23e74c3c' stroke-width='2'%3E%3Cpath d='M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.6l-1-1a5.5 5.5 0 0 0-7.8 7.8l1 1L12 21l7.8-7.6 1-1a5.5 5.5 0 0 0 0-7.8z'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
 * Info block
 * -------------------------------------------------------------------------- */
.kh-qv-info {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px 20px 12px;
	-webkit-overflow-scrolling: touch;
}

.kh-qv-title {
	margin: 0 0 8px;
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.45;
	color: var(--kh-qv-text);
	font-family: inherit;
}

.kh-qv-promo {
	margin: 0 0 14px;
	font-size: 0.86rem;
	line-height: 1.5;
	color: var(--kh-qv-muted);
	font-family: inherit;
}

.kh-qv-cats {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	padding-top: 12px;
	border-top: 1px solid var(--kh-qv-border);
	font-size: 0.82rem;
}

.kh-qv-cat-link {
	color: var(--kh-qv-primary);
	text-decoration: none;
	font-weight: 500;
	font-family: inherit;
}

.kh-qv-cat-link:hover,
.kh-qv-cat-link:focus-visible {
	text-decoration: underline;
	outline: none;
}

.kh-qv-cat-sep {
	color: var(--kh-qv-primary);
	opacity: 0.7;
}

.kh-qv-variations {
	margin-top: 16px;
}

.kh-qv-variations-label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.85rem;
	color: var(--kh-qv-text);
	font-family: inherit;
}

.kh-qv-variation-select {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--kh-qv-border);
	border-radius: 10px;
	background: #fff;
	font-family: inherit;
	font-size: 0.9rem;
	color: var(--kh-qv-text);
}

/* --------------------------------------------------------------------------
 * Sticky footer
 * -------------------------------------------------------------------------- */
.kh-qv-footer {
	flex: 0 0 auto;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--kh-qv-border);
	background: var(--kh-qv-bg);
}

/* In RTL flex-start is on the right: button first = CTA on the right */
.kh-qv-add {
	flex: 1 1 auto;
	max-width: 58%;
	min-height: 48px;
	border: 0;
	border-radius: var(--kh-qv-radius-btn);
	background: var(--kh-qv-primary);
	color: #fff;
	font-family: inherit;
	font-size: 0.95rem;
	font-weight: 700;
	cursor: pointer;
	padding: 12px 16px;
	transition: background 0.15s ease, opacity 0.15s ease;
}

.kh-qv-add:hover:not(:disabled),
.kh-qv-add:focus-visible:not(:disabled) {
	background: var(--kh-qv-primary-hover);
	outline: none;
}

.kh-qv-add:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.kh-qv-add.is-loading {
	opacity: 0.7;
	pointer-events: none;
}

.kh-qv-price-block {
	flex: 0 0 auto;
	text-align: start;
	min-width: 0;
}

.kh-qv-price-row {
	display: flex;
	align-items: baseline;
	gap: 4px;
	justify-content: flex-start;
}

.kh-qv-price {
	font-size: 1.15rem;
	font-weight: 800;
	color: var(--kh-qv-text);
	font-family: inherit;
	line-height: 1.2;
}

.kh-qv-currency {
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--kh-qv-text);
	font-family: inherit;
}

.kh-qv-sale-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 4px;
	justify-content: flex-start;
}

.kh-qv-regular {
	font-size: 0.8rem;
	color: var(--kh-qv-muted);
	text-decoration: line-through;
	font-family: inherit;
}

.kh-qv-discount {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	padding: 2px 6px;
	border-radius: 4px;
	background: var(--kh-qv-primary);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 700;
	font-family: inherit;
	line-height: 1.3;
}

.kh-qv-hidden {
	display: none !important;
}

/* --------------------------------------------------------------------------
 * Desktop: centered modal
 * -------------------------------------------------------------------------- */
@media (min-width: 768px) {
	.kh-qv-root {
		align-items: center;
		padding: 24px;
	}

	.kh-qv-panel {
		width: min(520px, 92vw);
		max-height: min(88vh, 860px);
		border-radius: var(--kh-qv-radius-panel);
		transform: translateY(24px) scale(0.98);
		opacity: 0;
		transition: transform 0.28s ease, opacity 0.28s ease;
	}

	.kh-qv-root.is-open .kh-qv-panel {
		transform: translateY(0) scale(1);
		opacity: 1;
	}

	.kh-qv-image-wrap {
		min-height: 280px;
		max-height: 360px;
		padding: 36px 56px 24px;
	}

	.kh-qv-image {
		max-height: 300px;
	}

	.kh-qv-title {
		font-size: 1.25rem;
	}

	.kh-qv-add {
		max-width: 240px;
		flex: 0 0 auto;
	}
}
