/**
 * HNG Commerce - Sidebar Cart Layout
 * Carrinho desliza do lado direito
 */

.hng-cart-sidebar {
	position: fixed;
	right: -400px;
	top: 0;
	width: 400px;
	height: 100vh;
	background: var(--hng-cart-surface, #fff);
	box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
	display: flex;
	flex-direction: column;
	z-index: 99998;
	/* Prevent blocking trigger button during close animation */
	pointer-events: none;
	/* Use CSS variable for animation duration with !important to override theme conflicts */
	transition-property: right !important;
	transition-duration: var(--hng-cart-animation-duration, 400ms) !important;
	transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.hng-cart-sidebar.active {
	right: 0 !important;
	pointer-events: auto;
}

/* Ajuste para admin bar do WordPress */
body.admin-bar .hng-cart-sidebar {
	top: 32px;
	height: calc(100vh - 32px);
}

@media screen and (max-width: 782px) {
	body.admin-bar .hng-cart-sidebar {
		top: 46px;
		height: calc(100vh - 46px);
	}
}

/* Overlay (fundo escuro) */
.hng-cart-sidebar::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, var(--hng-cart-overlay-opacity, 0.5));
	opacity: 0;
	pointer-events: none;
	transition-property: opacity !important;
	transition-duration: var(--hng-cart-animation-duration, 400ms) !important;
	transition-timing-function: ease !important;
	z-index: -1;
}

.hng-cart-sidebar.active::before {
	opacity: 1 !important;
	pointer-events: auto !important;
}

/* Sem overlay - não adiciona fundo escuro */
.hng-cart-sidebar.no-overlay::before {
	display: none;
}

/* Header */
.hng-cart-sidebar-header {
	padding: 20px;
	border-bottom: 1px solid var(--hng-cart-border, #e5e7eb);
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: var(--hng-cart-header-bg, #f9fafb);
}

.hng-cart-sidebar-header h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	color: var(--hng-cart-text, #1f2937);
}

/* Content Area */
.hng-cart-sidebar-content {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: var(--hng-cart-surface, #fff);
}

.hng-cart-sidebar-content::-webkit-scrollbar {
	width: 6px;
}

.hng-cart-sidebar-content::-webkit-scrollbar-track {
	background: #f1f5f9;
}

.hng-cart-sidebar-content::-webkit-scrollbar-thumb {
	background: #cbd5e0;
	border-radius: 3px;
}

.hng-cart-sidebar-content::-webkit-scrollbar-thumb:hover {
	background: #a0aec0;
}

/* Cart Items */
.hng-cart-items {
	margin: 0;
	padding: 0;
	background: var(--hng-cart-surface, #fff);
}

.hng-cart-item {
	display: flex;
	gap: 12px;
	padding: 12px;
	border: 1px solid var(--hng-cart-border, #e5e7eb);
	border-radius: 8px;
	margin-bottom: 12px;
	background: var(--hng-cart-surface, #fff);
	transition: all 0.2s;
}

.hng-cart-item:hover {
	border-color: var(--hng-cart-primary, #2AFFA3);
	box-shadow: 0 2px 8px rgba(42, 255, 163, 0.1);
}

.hng-cart-item-image {
	width: 60px;
	height: 60px;
	border-radius: 6px;
	overflow: hidden;
	flex-shrink: 0;
}

.hng-cart-item-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hng-cart-item-details {
	flex: 1;
}

.hng-cart-item-name {
	font-weight: 600;
	color: var(--hng-cart-text, #1f2937);
	margin: 0 0 4px 0;
	font-size: 14px;
	line-height: 1.4;
}

.hng-cart-item-price {
	color: var(--hng-cart-muted, #6b7280);
	font-size: 12px;
	margin: 0;
}

.hng-cart-item-quantity {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 8px;
}

.hng-qty-btn {
	background: var(--hng-cart-surface-soft, #f3f4f6);
	border: 1px solid var(--hng-cart-border, #e5e7eb);
	width: 24px;
	height: 24px;
	border-radius: 4px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	color: var(--hng-cart-text, #1f2937);
	transition: all 0.2s;
}

.hng-qty-btn:hover {
	background: var(--hng-cart-primary, #2AFFA3);
	color: var(--hng-cart-contrast, #050505);
	border-color: var(--hng-cart-primary, #2AFFA3);
}

.hng-qty-input {
	width: 36px;
	padding: 4px;
	text-align: center;
	border: 1px solid var(--hng-cart-border, #d1d5db);
	border-radius: 4px;
	font-size: 12px;
	color: var(--hng-cart-text, #1f2937);
	background: var(--hng-cart-surface, #fff);
}

.hng-cart-item-remove {
	background: transparent;
	border: none;
	color: #ef4444;
	cursor: pointer;
	padding: 0;
	font-size: 14px;
	transition: color 0.2s;
}

.hng-cart-item-remove:hover {
	color: #dc2626;
}

/* Footer */
.hng-cart-sidebar-footer {
	padding: 16px;
	border-top: 1px solid var(--hng-cart-border, #e5e7eb);
	background: var(--hng-cart-surface, #fff);
	text-align: var(--hng-cart-button-align, center);
}

/* Totals dentro do sidebar */
.hng-cart-sidebar-footer .hng-cart-totals {
	background: transparent;
	padding: 0;
	border: none;
	margin-bottom: 12px;
}

.hng-cart-sidebar-footer .hng-btn,
.hng-cart-sidebar-footer .btn {
	margin-top: 12px;
}

.hng-cart-sidebar-footer .hng-btn-block,
.hng-cart-sidebar-footer .btn-block {
	margin-left: auto;
	margin-right: auto;
}

/* Overlay quando sidebar está aberto */
.hng-cart-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 99997;
	opacity: 0;
	pointer-events: none;
	transition-property: opacity !important;
	transition-duration: var(--hng-cart-animation-duration, 400ms) !important;
	transition-timing-function: ease !important;
}

.hng-cart-overlay.active {
	opacity: 1 !important;
	pointer-events: auto !important;
}

/* Mobile */
@media (max-width: 768px) {
	.hng-cart-sidebar {
		width: 100%;
		right: -100%;
	}

	.hng-cart-sidebar-header {
		padding: 16px;
	}

	.hng-cart-item {
		padding: 10px;
		margin-bottom: 10px;
	}

	.hng-cart-item-image {
		width: 50px;
		height: 50px;
	}
}
