/**
 * DAF Marketplace — Cart Popup Styles
 * File Name: cart-popup.css
 * Location: /wp-content/plugins/daf-marketplace/assets/front/cart-popup.css
 *
 * Purpose:
 * - Provides premium popup styling for DAF Marketplace cart actions.
 * - Keeps popup UI plugin-owned, lightweight, and theme-independent.
 * - Styles the reusable PHP-rendered add-to-cart popup shell.
 *
 * Related Files:
 * - /wp-content/plugins/daf-marketplace/includes/frontend/class-dafmp-frontend.php
 * - /wp-content/plugins/daf-marketplace/assets/front/front.js
 *
 * Notes:
 * - Scoped only to DAF Marketplace popup classes.
 * - Popup visibility is controlled by runtime state, not forced by CSS alone.
 * - No theme-specific selectors or dependencies.
 * - Optimized for a slimmer, cleaner, premium compact layout.
 * - Buttons intentionally use a flat visual system with no shadow or blur styling.
 */

.dafmp-cart-popup-overlay,
.dafmp-cart-popup-overlay * {
	box-sizing: border-box;
}

.dafmp-cart-popup-overlay[hidden],
.dafmp-cart-popup [hidden] {
	display: none !important;
}

html.dafmp-cart-popup-open,
body.dafmp-cart-popup-open {
	overflow: hidden;
}

.dafmp-cart-popup-overlay {
	--dafmp-popup-surface: #ffffff;
	--dafmp-popup-surface-soft: #f8fafc;
	--dafmp-popup-surface-soft-alt: #f1f5f9;
	--dafmp-popup-border: #dbe3ee;
	--dafmp-popup-border-strong: #c7d2e0;
	--dafmp-popup-text: #0f172a;
	--dafmp-popup-text-soft: #475569;
	--dafmp-popup-text-muted: #64748b;
	--dafmp-popup-primary: #2563eb;
	--dafmp-popup-primary-hover: #1d4ed8;
	--dafmp-popup-success: #22a447;
	--dafmp-popup-success-dark: #1d7f37;
	--dafmp-popup-shadow: 0 26px 56px rgba(15, 23, 42, 0.18);
	--dafmp-popup-radius-xl: 20px;
	--dafmp-popup-radius-lg: 14px;
	--dafmp-popup-radius-md: 11px;
	--dafmp-popup-radius-sm: 9px;
	--dafmp-popup-overlay-bg: rgba(2, 6, 23, 0.64);

	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 12px;
	background:
		radial-gradient(circle at top left, rgba(34, 197, 94, 0.06), transparent 18%),
		radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.05), transparent 22%),
		var(--dafmp-popup-overlay-bg);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.18s ease, visibility 0.18s ease;
}

.dafmp-cart-popup-overlay.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.dafmp-cart-popup {
	position: relative;
	width: min(100%, 505px);
	max-height: min(468px, calc(100vh - 24px));
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid rgba(219, 227, 238, 0.95);
	border-radius: var(--dafmp-popup-radius-xl);
	background:
		linear-gradient(180deg, rgba(249, 251, 253, 0.96) 0%, rgba(255, 255, 255, 1) 84px),
		var(--dafmp-popup-surface);
	box-shadow: var(--dafmp-popup-shadow);
	color: var(--dafmp-popup-text);
	transform: translateY(10px) scale(0.988);
	transition: transform 0.18s ease;
}

.dafmp-cart-popup-overlay.is-open .dafmp-cart-popup {
	transform: translateY(0) scale(1);
}

.dafmp-cart-popup-overlay.is-busy .dafmp-cart-popup {
	cursor: progress;
}

.dafmp-cart-popup__close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid var(--dafmp-popup-border);
	border-radius: 999px;
	background: #f8fafc;
	color: var(--dafmp-popup-text-soft);
	font-size: 19px;
	line-height: 1;
	cursor: pointer;
	box-shadow: none;
	transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.dafmp-cart-popup__close:hover,
.dafmp-cart-popup__close:focus-visible {
	border-color: var(--dafmp-popup-border-strong);
	background: #ffffff;
	color: var(--dafmp-popup-text);
	outline: none;
}

.dafmp-cart-popup__header {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: center;
	gap: 10px;
	padding: 16px 48px 0 16px;
}

.dafmp-cart-popup__badge {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 999px;
	border: 1px solid rgba(134, 239, 172, 0.38);
	background: linear-gradient(180deg, #f3fcf5 0%, #ebf8ef 100%);
}

.dafmp-cart-popup__badge::before,
.dafmp-cart-popup__badge::after {
	display: none;
	content: "";
}

.dafmp-cart-popup__badge-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 999px;
	background: linear-gradient(180deg, #28b44a 0%, #1f9a3e 100%);
	color: #ffffff;
	font-size: 14px;
	font-weight: 800;
	line-height: 1;
	box-shadow: none;
}

.dafmp-cart-popup__header-text {
	min-width: 0;
}

.dafmp-cart-popup__eyebrow {
	margin: 0 0 2px;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--dafmp-popup-success-dark);
}

.dafmp-cart-popup__title {
	margin: 0;
	font-size: clamp(1.28rem, 1.45vw, 1.72rem);
	line-height: 1.04;
	font-weight: 800;
	letter-spacing: -0.03em;
	color: var(--dafmp-popup-text);
}

.dafmp-cart-popup__message {
	display: -webkit-box;
	margin: 5px 0 0;
	max-width: 100%;
	overflow: hidden;
	font-size: 12px;
	line-height: 1.4;
	color: var(--dafmp-popup-text-muted);
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 1;
	line-clamp: 1;
}

.dafmp-cart-popup__body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px 16px 12px;
	overflow: hidden;
}

.dafmp-cart-popup__product {
	display: grid;
	grid-template-columns: 88px minmax(0, 1fr);
	gap: 11px;
	align-items: center;
	padding: 9px;
	border: 1px solid var(--dafmp-popup-border);
	border-radius: 15px;
	background: #ffffff;
	box-shadow: none;
}

.dafmp-cart-popup__product-media {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
}

.dafmp-cart-popup__product-image,
.dafmp-cart-popup__product-image-placeholder {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: 12px;
	border: 1px solid var(--dafmp-popup-border);
	background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.dafmp-cart-popup__product-image {
	object-fit: cover;
	box-shadow: none;
}

.dafmp-cart-popup__product-image-placeholder {
	position: relative;
	overflow: hidden;
}

.dafmp-cart-popup__product-image-placeholder::before,
.dafmp-cart-popup__product-image-placeholder::after {
	content: "";
	position: absolute;
	border-radius: 999px;
	opacity: 0.55;
}

.dafmp-cart-popup__product-image-placeholder::before {
	top: 15%;
	left: 14%;
	width: 34%;
	height: 34%;
	background: rgba(59, 130, 246, 0.08);
}

.dafmp-cart-popup__product-image-placeholder::after {
	right: 10%;
	bottom: 14%;
	width: 24%;
	height: 24%;
	background: rgba(34, 197, 94, 0.08);
}

.dafmp-cart-popup__product-image:not([hidden]) + .dafmp-cart-popup__product-image-placeholder {
	display: none;
}

.dafmp-cart-popup__product-content {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.dafmp-cart-popup__product-top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px;
	min-width: 0;
}

.dafmp-cart-popup__product-copy {
	min-width: 0;
	flex: 1 1 auto;
}

.dafmp-cart-popup__product-title {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	font-size: clamp(0.98rem, 1.15vw, 1.2rem);
	line-height: 1.12;
	font-weight: 800;
	letter-spacing: -0.02em;
	color: var(--dafmp-popup-text);
	word-break: break-word;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

.dafmp-cart-popup__product-meta {
	display: -webkit-box;
	margin: 3px 0 0;
	overflow: hidden;
	font-size: 11px;
	line-height: 1.32;
	font-weight: 700;
	color: var(--dafmp-popup-text-muted);
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 1;
	line-clamp: 1;
}

.dafmp-cart-popup__product-description {
	display: -webkit-box;
	margin: 4px 0 0;
	overflow: hidden;
	font-size: 12px;
	line-height: 1.38;
	color: var(--dafmp-popup-text-soft);
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 1;
	line-clamp: 1;
}

.dafmp-cart-popup__product-price {
	flex: 0 0 auto;
	font-size: clamp(1rem, 1.2vw, 1.22rem);
	line-height: 1;
	font-weight: 800;
	letter-spacing: -0.03em;
	color: var(--dafmp-popup-text);
	white-space: nowrap;
}

.dafmp-cart-popup__product-bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	flex-wrap: wrap;
}

.dafmp-cart-popup__quantity {
	display: inline-flex;
	align-items: center;
	gap: 0;
	padding: 2px;
	border: 1px solid var(--dafmp-popup-border);
	border-radius: 10px;
	background: #ffffff;
	box-shadow: none;
}

.dafmp-cart-popup__qty-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--dafmp-popup-text-soft);
	font-size: 18px;
	line-height: 1;
	font-weight: 500;
	cursor: pointer;
	box-shadow: none;
	transition: background-color 0.18s ease, color 0.18s ease;
}

.dafmp-cart-popup__qty-button:hover,
.dafmp-cart-popup__qty-button:focus-visible {
	background: var(--dafmp-popup-surface-soft);
	color: var(--dafmp-popup-text);
	outline: none;
}

.dafmp-cart-popup__qty-input {
	width: 38px;
	height: 30px;
	padding: 0 4px;
	border: 0;
	background: transparent;
	color: var(--dafmp-popup-text);
	font-size: 13px;
	line-height: 1;
	font-weight: 800;
	text-align: center;
	appearance: textfield;
	-moz-appearance: textfield;
}

.dafmp-cart-popup__qty-input::-webkit-outer-spin-button,
.dafmp-cart-popup__qty-input::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

.dafmp-cart-popup__qty-input:focus {
	outline: none;
}

.dafmp-cart-popup__product-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.dafmp-cart-popup__notice,
.dafmp-cart-popup__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 9px 11px;
	border-radius: 11px;
}

.dafmp-cart-popup__notice {
	border: 1px solid rgba(187, 247, 208, 0.92);
	background: linear-gradient(180deg, rgba(242, 252, 244, 0.98) 0%, rgba(236, 248, 239, 1) 100%);
}

.dafmp-cart-popup__notice-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 999px;
	background: linear-gradient(180deg, #28b44a 0%, #1f9a3e 100%);
	color: #ffffff;
	font-size: 12px;
	font-weight: 800;
	line-height: 1;
	box-shadow: none;
}

.dafmp-cart-popup__notice-text {
	flex: 1 1 auto;
	font-size: 12px;
	line-height: 1.35;
	font-weight: 800;
	color: var(--dafmp-popup-success-dark);
}

.dafmp-cart-popup__summary {
	border: 1px solid var(--dafmp-popup-border);
	background: #f8fafc;
}

.dafmp-cart-popup__summary-label {
	font-size: 11px;
	line-height: 1.3;
	font-weight: 800;
	color: var(--dafmp-popup-text-soft);
}

.dafmp-cart-popup__summary-value {
	font-size: 0.95rem;
	line-height: 1.2;
	font-weight: 800;
	letter-spacing: -0.02em;
	color: var(--dafmp-popup-text);
	text-align: right;
	white-space: nowrap;
}

.dafmp-cart-popup__status {
	margin: 0;
	padding: 9px 11px;
	border-radius: 11px;
	border: 1px solid var(--dafmp-popup-border);
	background: var(--dafmp-popup-surface-soft);
	font-size: 11px;
	line-height: 1.38;
	color: var(--dafmp-popup-text-soft);
}

.dafmp-cart-popup-overlay.is-busy .dafmp-cart-popup__status {
	border-color: rgba(191, 219, 254, 0.95);
	background: rgba(239, 246, 255, 0.95);
	color: var(--dafmp-popup-primary);
}

.dafmp-cart-popup__footer {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	padding: 0 16px 16px;
}

.dafmp-cart-popup__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	width: 100%;
	padding: 0 12px;
	border: 1px solid var(--dafmp-popup-border);
	border-radius: 11px;
	text-decoration: none;
	font-size: 13px;
	line-height: 1.2;
	font-weight: 800;
	letter-spacing: -0.01em;
	cursor: pointer;
	box-shadow: none;
	transition:
		border-color 0.18s ease,
		background-color 0.18s ease,
		color 0.18s ease;
}

.dafmp-cart-popup__button:hover,
.dafmp-cart-popup__button:focus-visible {
	outline: none;
}

.dafmp-cart-popup__button--secondary {
	background: #ffffff;
	border-color: #bfd4fb;
	color: var(--dafmp-popup-primary);
	box-shadow: none;
}

.dafmp-cart-popup__button--secondary:hover,
.dafmp-cart-popup__button--secondary:focus-visible {
	background: #f5f9ff;
	border-color: #93c5fd;
	color: var(--dafmp-popup-primary-hover);
}

.dafmp-cart-popup__button--primary {
	background: #2faa42;
	border-color: #2faa42;
	color: #ffffff;
	box-shadow: none;
}

.dafmp-cart-popup__button--primary:hover,
.dafmp-cart-popup__button--primary:focus-visible {
	background: #26973a;
	border-color: #26973a;
	color: #ffffff;
}

@media (max-width: 991px) {
	.dafmp-cart-popup-overlay {
		padding: 10px;
	}

	.dafmp-cart-popup {
		width: min(100%, 480px);
		max-height: min(456px, calc(100vh - 20px));
	}

	.dafmp-cart-popup__header {
		padding: 15px 46px 0 15px;
	}

	.dafmp-cart-popup__body {
		padding: 11px 15px 11px;
	}

	.dafmp-cart-popup__footer {
		padding: 0 15px 15px;
	}

	.dafmp-cart-popup__product {
		grid-template-columns: 82px minmax(0, 1fr);
		gap: 10px;
		padding: 8px;
	}
}

@media (max-width: 767px) {
	.dafmp-cart-popup-overlay {
		align-items: flex-end;
		padding: 0;
		background:
			linear-gradient(180deg, rgba(2, 6, 23, 0.14) 0%, rgba(2, 6, 23, 0.68) 100%),
			var(--dafmp-popup-overlay-bg);
	}

	.dafmp-cart-popup {
		width: 100%;
		max-height: calc(100vh - 2px);
		border-right: 0;
		border-bottom: 0;
		border-left: 0;
		border-radius: 18px 18px 0 0;
	}

	.dafmp-cart-popup__close {
		top: 10px;
		right: 10px;
		width: 34px;
		height: 34px;
		font-size: 18px;
	}

	.dafmp-cart-popup__header {
		grid-template-columns: auto minmax(0, 1fr);
		align-items: center;
		gap: 9px;
		padding: 14px 46px 0 14px;
	}

	.dafmp-cart-popup__badge {
		width: 40px;
		height: 40px;
	}

	.dafmp-cart-popup__badge-icon {
		width: 23px;
		height: 23px;
		font-size: 13px;
	}

	.dafmp-cart-popup__title {
		font-size: 1.18rem;
	}

	.dafmp-cart-popup__message {
		margin-top: 4px;
		font-size: 11px;
		line-height: 1.36;
	}

	.dafmp-cart-popup__body {
		gap: 7px;
		padding: 11px 14px 11px;
	}

	.dafmp-cart-popup__product {
		grid-template-columns: 76px minmax(0, 1fr);
		gap: 9px;
		padding: 8px;
		border-radius: 13px;
	}

	.dafmp-cart-popup__product-image,
	.dafmp-cart-popup__product-image-placeholder {
		border-radius: 10px;
	}

	.dafmp-cart-popup__product-content {
		gap: 5px;
	}

	.dafmp-cart-popup__product-top {
		gap: 7px;
	}

	.dafmp-cart-popup__product-title {
		font-size: 0.94rem;
	}

	.dafmp-cart-popup__product-meta {
		font-size: 10px;
	}

	.dafmp-cart-popup__product-description {
		font-size: 11px;
		line-height: 1.35;
		-webkit-line-clamp: 1;
		line-clamp: 1;
	}

	.dafmp-cart-popup__product-price {
		font-size: 0.98rem;
	}

	.dafmp-cart-popup__product-bottom {
		gap: 7px;
	}

	.dafmp-cart-popup__qty-button {
		width: 28px;
		height: 28px;
		font-size: 17px;
	}

	.dafmp-cart-popup__qty-input {
		width: 34px;
		height: 28px;
		font-size: 12px;
	}

	.dafmp-cart-popup__notice,
	.dafmp-cart-popup__summary {
		padding: 8px 10px;
		border-radius: 10px;
	}

	.dafmp-cart-popup__summary-label,
	.dafmp-cart-popup__notice-text,
	.dafmp-cart-popup__status {
		font-size: 11px;
	}

	.dafmp-cart-popup__summary-value {
		font-size: 0.9rem;
	}

	.dafmp-cart-popup__footer {
		gap: 8px;
		padding: 0 14px 14px;
	}

	.dafmp-cart-popup__button {
		min-height: 38px;
		padding: 0 10px;
		font-size: 12px;
	}
}

@media (max-width: 479px) {
	.dafmp-cart-popup__title {
		font-size: 1.08rem;
	}

	.dafmp-cart-popup__product {
		grid-template-columns: 68px minmax(0, 1fr);
	}

	.dafmp-cart-popup__product-title {
		font-size: 0.9rem;
	}

	.dafmp-cart-popup__product-price {
		font-size: 0.94rem;
	}

	.dafmp-cart-popup__summary-value {
		font-size: 0.86rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dafmp-cart-popup-overlay,
	.dafmp-cart-popup,
	.dafmp-cart-popup__close,
	.dafmp-cart-popup__button,
	.dafmp-cart-popup__qty-button {
		transition: none !important;
	}
}