/**
 * File Name: frontend-cart-widget.css
 * File Location: /assets/css/frontend-cart-widget.css
 *
 * Purpose:
 * Premium DAF Marketplace header cart dropdown styling.
 * Positioning is handled by frontend-cart-widget.js on mobile to keep
 * the dropdown centered and viewport-safe.
 *
 * Linked Files:
 * - /includes/frontend/class-frontend-cart-widget.php
 * - /includes/frontend/class-frontend-cart.php
 * - /includes/frontend/class-frontend-menu-icons.php
 * - /assets/js/frontend-cart-widget.js
 */

/* ==========================================================================
   DAF Cart Widget - Dropdown Container
   ========================================================================== */

.daf-cart-dropdown-wrapper {
	position: absolute !important;
	top: 135% !important;
	right: 0 !important;
	width: 390px !important;
	max-width: calc(100vw - 24px) !important;
	background: #ffffff !important;
	border: 1px solid #e2e8f0 !important;
	border-radius: 14px !important;
	box-shadow: 0 24px 42px -12px rgba(15, 23, 42, 0.22), 0 10px 18px -12px rgba(15, 23, 42, 0.16) !important;
	z-index: 999999999 !important;
	opacity: 0 !important;
	visibility: hidden !important;
	transform: translateY(12px) !important;
	transition: opacity 0.22s ease, visibility 0.22s ease, transform 0.22s ease !important;
	pointer-events: none !important;
	padding: 0 !important;
	overflow: hidden !important;
	box-sizing: border-box !important;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.daf-menu-hook-wrapper.daf-active #daf-cart-dropdown,
.daf-menu-hook-wrapper.daf-cart-active #daf-cart-dropdown,
.daf-menu-hook-wrapper.is-active #daf-cart-dropdown,
.daf-cart-trigger.daf-active #daf-cart-dropdown,
.daf-cart-trigger.daf-cart-active #daf-cart-dropdown,
.daf-cart-trigger.is-active #daf-cart-dropdown,
.daf-cart-dropdown-wrapper.active,
.daf-cart-dropdown-wrapper.open {
	opacity: 1 !important;
	visibility: visible !important;
	transform: translateY(0) !important;
	pointer-events: auto !important;
}

/* ==========================================================================
   DAF Cart Widget - Header
   ========================================================================== */

.daf-cart-dropdown-header,
.daf-cart-dropdown-wrapper .daf-dropdown-header {
	padding: 16px 18px !important;
	border-bottom: 1px solid #eef2f7 !important;
	background: #ffffff !important;
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	gap: 12px !important;
	box-sizing: border-box !important;
}

.daf-cart-dropdown-wrapper .daf-dropdown-title {
	font-weight: 900 !important;
	font-size: 14px !important;
	color: #0f172a !important;
	text-transform: uppercase !important;
	letter-spacing: 0.5px !important;
	display: block !important;
	line-height: 1.2 !important;
}

.daf-cart-dropdown-subtitle,
.daf-cart-dropdown-wrapper .daf-dropdown-subtitle {
	margin-top: 4px !important;
	display: block !important;
	font-size: 12px !important;
	font-weight: 600 !important;
	color: #64748b !important;
	line-height: 1.2 !important;
}

/* ==========================================================================
   DAF Cart Widget - Content Shell
   ========================================================================== */

.daf-cart-content-refresh {
	display: flex !important;
	flex-direction: column !important;
	min-height: 0 !important;
	background: #ffffff !important;
}

.daf-cart-dropdown-body,
.daf-cart-dropdown-wrapper .daf-dropdown-body {
	padding: 0 !important;
	display: flex !important;
	flex-direction: column !important;
	background: #ffffff !important;
	box-sizing: border-box !important;
	overflow: hidden !important;
}

.daf-cart-widget-scroll {
	--daf-cart-visible-items: 3;
	max-height: calc(var(--daf-cart-visible-items) * 92px) !important;
	overflow-y: auto !important;
	overflow-x: hidden !important;
	background: #ffffff !important;
	box-sizing: border-box !important;
	-webkit-overflow-scrolling: touch !important;
	overscroll-behavior: contain !important;
}

.daf-cart-widget-scroll::-webkit-scrollbar {
	width: 7px !important;
}

.daf-cart-widget-scroll::-webkit-scrollbar-track {
	background: #f8fafc !important;
}

.daf-cart-widget-scroll::-webkit-scrollbar-thumb {
	background: #cbd5e1 !important;
	border-radius: 999px !important;
}

.daf-cart-widget-scroll::-webkit-scrollbar-thumb:hover {
	background: #94a3b8 !important;
}

/* ==========================================================================
   DAF Cart Widget - Item List
   ========================================================================== */

.daf-cart-item-list {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	display: flex !important;
	flex-direction: column !important;
}

.daf-cart-item {
	min-height: 92px !important;
	display: grid !important;
	grid-template-columns: 64px minmax(0, 1fr) !important;
	gap: 12px !important;
	align-items: center !important;
	padding: 12px 16px !important;
	border-bottom: 1px solid #f1f5f9 !important;
	box-sizing: border-box !important;
	background: #ffffff !important;
	transition: background 0.2s ease !important;
}

.daf-cart-item:hover {
	background: #fbfdff !important;
}

.daf-cart-item:last-child {
	border-bottom: none !important;
}

.daf-item-thumb {
	width: 64px !important;
	height: 56px !important;
	display: block !important;
	overflow: hidden !important;
	border-radius: 10px !important;
	background: #f1f5f9 !important;
	border: 1px solid #eef2f7 !important;
	box-sizing: border-box !important;
	flex: 0 0 auto !important;
}

.daf-item-thumb img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	object-position: center !important;
	display: block !important;
}

.daf-item-info {
	min-width: 0 !important;
	display: flex !important;
	flex-direction: column !important;
	gap: 7px !important;
}

.daf-item-name {
	color: #0f172a !important;
	font-size: 13px !important;
	font-weight: 800 !important;
	line-height: 1.28 !important;
	text-decoration: none !important;
	white-space: normal !important;
	overflow: hidden !important;
	display: -webkit-box !important;
	-webkit-line-clamp: 2 !important;
	-webkit-box-orient: vertical !important;
}

.daf-item-name:hover {
	color: #2271b1 !important;
}

/* ==========================================================================
   DAF Cart Widget - Meta
   ========================================================================== */

.daf-item-meta-elite {
	display: flex !important;
	flex-direction: column !important;
	gap: 6px !important;
}

.daf-meta-top {
	display: flex !important;
	justify-content: space-between !important;
	align-items: center !important;
	gap: 8px !important;
}

.daf-meta-license {
	font-size: 10px !important;
	font-weight: 800 !important;
	color: #475569 !important;
	background: #f1f5f9 !important;
	border: 1px solid #e2e8f0 !important;
	padding: 3px 8px !important;
	border-radius: 999px !important;
	text-transform: uppercase !important;
	letter-spacing: 0.25px !important;
	line-height: 1 !important;
	white-space: nowrap !important;
}

.daf-meta-qty-calc {
	font-size: 12px !important;
	color: #64748b !important;
	font-weight: 700 !important;
	line-height: 1 !important;
	white-space: nowrap !important;
}

.daf-meta-bottom {
	display: flex !important;
	justify-content: space-between !important;
	align-items: center !important;
	gap: 8px !important;
	border-top: 1px dashed #e2e8f0 !important;
	padding-top: 7px !important;
}

.daf-line-total {
	font-size: 12px !important;
	color: #475569 !important;
	line-height: 1 !important;
	font-weight: 600 !important;
}

.daf-line-total strong {
	color: #0f172a !important;
	font-weight: 900 !important;
}

/* ==========================================================================
   DAF Cart Widget - Remove Button
   ========================================================================== */

.daf-remove-item-btn {
	width: 30px !important;
	height: 30px !important;
	border-radius: 9px !important;
	border: 1px solid #fecaca !important;
	background: #fff7f7 !important;
	color: #ef4444 !important;
	padding: 0 !important;
	cursor: pointer !important;
	transition: all 0.2s ease !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex: 0 0 30px !important;
	box-shadow: 0 4px 10px rgba(239, 68, 68, 0.08) !important;
}

.daf-remove-item-btn:hover {
	background: #ef4444 !important;
	border-color: #ef4444 !important;
	color: #ffffff !important;
	transform: translateY(-1px) !important;
	box-shadow: 0 10px 18px rgba(239, 68, 68, 0.22) !important;
}

.daf-remove-item-btn:active {
	transform: translateY(0) !important;
}

.daf-remove-item-btn.daf-loading {
	opacity: 0.55 !important;
	pointer-events: none !important;
}

/* ==========================================================================
   DAF Cart Widget - Sticky Footer
   ========================================================================== */

.daf-cart-dropdown-footer,
.daf-cart-dropdown-wrapper .daf-dropdown-footer {
	flex: 0 0 auto !important;
	position: sticky !important;
	bottom: 0 !important;
	padding: 16px !important;
	background: #f8fafc !important;
	border-top: 1px solid #e2e8f0 !important;
	box-sizing: border-box !important;
	z-index: 5 !important;
}

.daf-dropdown-total {
	display: flex !important;
	justify-content: space-between !important;
	align-items: center !important;
	margin-bottom: 14px !important;
	gap: 12px !important;
}

.daf-dropdown-total span:first-child {
	font-weight: 800 !important;
	color: #64748b !important;
	font-size: 13px !important;
}

.daf-total-amount {
	font-size: 20px !important;
	font-weight: 950 !important;
	color: #0f172a !important;
	line-height: 1 !important;
	white-space: nowrap !important;
}

/* ==========================================================================
   DAF Cart Widget - Action Buttons
   ========================================================================== */

.daf-dropdown-actions {
	display: grid !important;
	grid-template-columns: 1fr 1fr !important;
	gap: 10px !important;
}

.daf-btn-view-cart,
.daf-btn-checkout {
	min-width: 0 !important;
	height: 40px !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	border-radius: 8px !important;
	font-size: 12px !important;
	font-weight: 900 !important;
	text-decoration: none !important;
	transition: all 0.2s ease !important;
	padding: 0 12px !important;
	line-height: 1 !important;
	box-sizing: border-box !important;
	text-align: center !important;
	white-space: nowrap !important;
}

.daf-btn-view-cart {
	background: #ffffff !important;
	color: #1e293b !important;
	border: 1.5px solid #cbd5e1 !important;
}

.daf-btn-view-cart:hover {
	border-color: #0f172a !important;
	background: #f1f5f9 !important;
	color: #0f172a !important;
	text-decoration: none !important;
	transform: translateY(-1px) !important;
}

.daf-btn-checkout {
	background: #8cc63f !important;
	color: #ffffff !important;
	border: none !important;
}

.daf-btn-checkout:hover {
	background: #78ad35 !important;
	color: #ffffff !important;
	text-decoration: none !important;
	transform: translateY(-1px) !important;
}

/* ==========================================================================
   DAF Cart Widget - Empty State
   ========================================================================== */

.daf-empty-cart-msg {
	min-height: 190px !important;
	padding: 38px 22px !important;
	text-align: center !important;
	color: #64748b !important;
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 9px !important;
	box-sizing: border-box !important;
}

.daf-empty-cart-icon {
	width: 54px !important;
	height: 54px !important;
	border-radius: 50% !important;
	background: #f1f5f9 !important;
	color: #8cc63f !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	font-size: 25px !important;
	font-weight: 900 !important;
	line-height: 1 !important;
}

.daf-empty-cart-msg strong {
	color: #0f172a !important;
	font-size: 15px !important;
	font-weight: 900 !important;
	line-height: 1.2 !important;
}

.daf-empty-cart-msg span:not(.daf-empty-cart-icon) {
	color: #64748b !important;
	font-size: 13px !important;
	line-height: 1.5 !important;
	max-width: 260px !important;
	font-weight: 600 !important;
}

/* ==========================================================================
   DAF Cart Widget - Badge Compatibility
   ========================================================================== */

.daf-cart-badge.daf-badge {
	position: absolute !important;
	top: -4px !important;
	right: -6px !important;
	background: #8cc63f !important;
	color: #ffffff !important;
	font-size: 10px !important;
	font-weight: 900 !important;
	min-width: 18px !important;
	height: 18px !important;
	border-radius: 999px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	border: 2px solid #ffffff !important;
	box-shadow: 0 4px 10px rgba(140, 198, 63, 0.28) !important;
	padding: 0 5px !important;
	line-height: 14px !important;
	z-index: 10 !important;
	box-sizing: border-box !important;
}

/* ==========================================================================
   DAF Cart Widget - Responsive
   ========================================================================== */

@media (max-width: 520px) {
	/*
	 * Mobile width/left/right/top are injected by frontend-cart-widget.js.
	 * Do not force right/width here, otherwise the dropdown can shift
	 * into the page edge on small screens.
	 */
	.daf-mp-mobile-action-slot--cart .daf-cart-dropdown-wrapper,
	.daf-cart-dropdown-wrapper {
		border-radius: 16px !important;
		max-width: none !important;
	}

	.daf-dropdown-actions {
		grid-template-columns: 1fr !important;
	}

	.daf-cart-widget-scroll {
		max-height: min(calc(var(--daf-cart-visible-items) * 98px), 42vh) !important;
	}

	.daf-cart-item {
		grid-template-columns: 58px minmax(0, 1fr) !important;
		min-height: 98px !important;
		padding: 12px 14px !important;
	}

	.daf-item-thumb {
		width: 58px !important;
		height: 52px !important;
	}

	.daf-meta-top,
	.daf-meta-bottom {
		align-items: flex-start !important;
	}

	.daf-meta-bottom {
		flex-direction: row !important;
	}
}