/**
 * Noxora Cart v2 - BEM CSS
 *
 * Server-driven cart styling with BEM naming convention.
 * Replaces legacy .ns-pro-cart-* classes.
 *
 * @package Noxora_Core
 * @version 4.14.0
 */

/* ============================================
   CART TRIGGER (Header Icon)
   ============================================ */

.nx-cart {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.nx-cart__trigger {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: none;
	background: transparent;
	color: inherit;
	cursor: pointer;
	border-radius: 8px;
	transition: background-color 0.2s ease;
}

.nx-cart__trigger:hover {
	background-color: rgba(255, 255, 255, 0.1);
}

.nx-cart__badge {
	position: absolute;
	top: 4px;
	right: 4px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 600;
	color: #fff;
	background-color: #ef4444;
	border-radius: 9px;
	border: 2px solid var(--nx-bg-primary, #1a1a2e);
}

.nx-cart__badge[hidden] {
	display: none;
}

/* ============================================
   CART PANEL (Dropdown)
   ============================================ */

.nx-cart__panel {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	width: 320px;
	max-width: calc(100vw - 32px);
	max-height: 480px;
	display: flex;
	flex-direction: column;
	background: var(--nx-bg-secondary, #16162a);
	border: 1px solid var(--nx-border, rgba(255, 255, 255, 0.1));
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
	overflow: hidden;
	z-index: 1000;
}

.nx-cart__panel[hidden] {
	display: none;
}

/* ============================================
   CART LOADING STATE
   ============================================ */

.nx-cart__loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 3rem 1rem;
	gap: 1rem;
}

.nx-cart__spinner {
	width: 32px;
	height: 32px;
	border: 3px solid rgba(255, 255, 255, 0.1);
	border-top-color: var(--nx-accent, #8b5cf6);
	border-radius: 50%;
	animation: nx-cart-spin 0.8s linear infinite;
}

@keyframes nx-cart-spin {
	to {
		transform: rotate(360deg);
	}
}

.nx-cart__loading-text {
	font-size: 14px;
	color: var(--nx-muted, rgba(255, 255, 255, 0.6));
}

.nx-cart__loading[hidden] {
	display: none;
}

/* ============================================
   CART EMPTY STATE
   ============================================ */

.nx-cart__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 3rem 1rem;
	gap: 1rem;
	text-align: center;
}

.nx-cart__empty-icon {
	width: 48px;
	height: 48px;
	color: var(--nx-muted, rgba(255, 255, 255, 0.4));
}

.nx-cart__empty-text {
	font-size: 14px;
	color: var(--nx-muted, rgba(255, 255, 255, 0.6));
}

.nx-cart__empty[hidden] {
	display: none;
}

/* ============================================
   CART ITEMS LIST
   ============================================ */

.nx-cart__items {
	display: flex;
	flex-direction: column;
	max-height: 320px;
	overflow-y: auto;
	padding: 0.5rem;
	gap: 0.5rem;
}

.nx-cart__items::-webkit-scrollbar {
	width: 6px;
}

.nx-cart__items::-webkit-scrollbar-track {
	background: transparent;
}

.nx-cart__items::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.2);
	border-radius: 3px;
}

.nx-cart__items::-webkit-scrollbar-thumb:hover {
	background: rgba(255, 255, 255, 0.3);
}

.nx-cart__items[hidden] {
	display: none;
}

/* ============================================
   CART ITEM
   ============================================ */

.nx-cart__item {
	display: grid;
	grid-template-columns: 48px 1fr auto;
	gap: 0.75rem;
	align-items: center;
	padding: 0.75rem;
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid rgba(255, 255, 255, 0.05);
	border-radius: 8px;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.nx-cart__item:hover {
	background: rgba(255, 255, 255, 0.05);
	border-color: rgba(255, 255, 255, 0.1);
}

.nx-cart__item-thumb {
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.05);
}

.nx-cart__item-info {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	min-width: 0;
}

.nx-cart__item-title {
	font-size: 13px;
	font-weight: 500;
	color: var(--nx-text-primary, #fff);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nx-cart__item-type {
	font-size: 11px;
	color: var(--nx-muted, rgba(255, 255, 255, 0.5));
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.nx-cart__item-price {
	font-size: 13px;
	font-weight: 600;
	color: var(--nx-accent, #8b5cf6);
}

.nx-cart__item-remove {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border: none;
	background: transparent;
	color: var(--nx-muted, rgba(255, 255, 255, 0.5));
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	border-radius: 6px;
	transition: color 0.2s ease, background-color 0.2s ease;
}

.nx-cart__item-remove:hover {
	color: #ef4444;
	background: rgba(239, 68, 68, 0.1);
}

.nx-cart__item-remove:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ============================================
   CART FOOTER
   ============================================ */

.nx-cart__footer {
	display: flex;
	flex-direction: column;
	padding: 1rem;
	gap: 0.75rem;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nx-cart__total {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 14px;
	color: var(--nx-text-primary, #fff);
}

.nx-cart__total-label {
	color: var(--nx-muted, rgba(255, 255, 255, 0.6));
}

.nx-cart__total-value {
	font-weight: 600;
	font-size: 16px;
}

.nx-cart__checkout {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 0.75rem 1rem;
	border: none;
	background: var(--nx-accent, #8b5cf6);
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	border-radius: 8px;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.1s ease;
	text-decoration: none;
}

.nx-cart__checkout:hover {
	background: var(--nx-accent-hover, #7c3aed);
}

.nx-cart__checkout:active {
	transform: scale(0.98);
}

.nx-cart__checkout[hidden] {
	display: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
	.nx-cart__panel {
		width: calc(100vw - 32px);
		right: -8px;
	}

	.nx-cart__item {
		grid-template-columns: 40px 1fr auto;
		gap: 0.5rem;
		padding: 0.5rem;
	}

	.nx-cart__item-thumb {
		width: 40px;
		height: 40px;
	}
}
