/**
 * Menu Cart Widget Styles
 * 
 * @package Custom_Elementor_Widgets
 * @since 1.0.0
 */

/* Menu Cart Wrapper */
.cew-menu-cart {
	position: relative;
	display: inline-block;
}

/* Toggle Button */
.cew-menu-cart__toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	position: relative;
	transition: all 0.3s ease;
	padding: 10px 15px;
}

.cew-menu-cart__toggle-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: relative;
}

.cew-menu-cart__toggle-icon svg {
	width: 24px;
	height: 24px;
	transition: all 0.3s ease;
}

.cew-menu-cart__toggle-subtotal {
	font-weight: 600;
	white-space: nowrap;
}

/* Items Indicator */
.cew-menu-cart__toggle-indicator {
	position: absolute;
	top: -5px;
	right: -5px;
	min-width: 18px;
	height: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	padding: 2px 5px;
	transition: all 0.3s ease;
}

.cew-menu-cart__toggle-indicator.hidden {
	display: none;
}

.cew-menu-cart__toggle-indicator.indicator-bubble {
	border-radius: 50%;
}

.cew-menu-cart__toggle-indicator.indicator-plain {
	border-radius: 0;
	background-color: transparent !important;
}

/* Cart Container */
.cew-menu-cart__container {
	position: absolute;
	top: calc(100% + 10px);
	background: #fff;
	box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
	z-index: 9999;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-10px);
	transition: all 0.3s ease;
	min-width: 320px;
	max-width: 400px;
}

.cew-menu-cart__container.cart-type-mini-cart {
	left: 0;
}

.cew-menu-cart__container.cart-type-side-cart {
	position: fixed;
	top: 0;
	bottom: 0;
	width: 400px;
	max-width: 90vw;
	transform: translateX(100%);
	overflow-y: auto;
	max-height: 100vh;
}

.cew-menu-cart__container.cart-type-side-cart.cart-position-left {
	left: 0;
	right: auto;
	transform: translateX(-100%);
}

.cew-menu-cart__container.cart-type-side-cart.cart-position-right {
	right: 0;
	left: auto;
	transform: translateX(100%);
}

/* Active States */
.cew-menu-cart.cart-open .cew-menu-cart__container.cart-type-mini-cart {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.cew-menu-cart.cart-open .cew-menu-cart__container.cart-type-side-cart {
	opacity: 1;
	visibility: visible;
	transform: translateX(0);
}

/* Hover Trigger */
.cew-menu-cart[data-open-cart="hover"]:hover .cew-menu-cart__container.cart-type-mini-cart {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

/* Overlay for Side Cart */
.cew-menu-cart__overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 9998;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
}

.cew-menu-cart.cart-open .cew-menu-cart__overlay {
	opacity: 1;
	visibility: visible;
}

/* Close Button */
.cew-menu-cart__close-button {
	position: absolute;
	top: 15px;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 5px;
	line-height: 1;
	transition: all 0.3s ease;
	z-index: 10;
}

.cew-menu-cart__close-button.close-position-left {
	left: 15px;
}

.cew-menu-cart__close-button.close-position-right {
	right: 15px;
}

.cew-menu-cart__close-button svg {
	width: 20px;
	height: 20px;
	display: block;
}

.cew-menu-cart__close-button:hover {
	transform: scale(1.1);
}

/* Products List */
.cew-menu-cart__products {
	max-height: 400px;
	overflow-y: auto;
	padding: 20px;
	margin-bottom: 20px;
}

.cew-menu-cart__container.cart-type-side-cart .cew-menu-cart__products {
	max-height: calc(100vh - 250px);
	padding-top: 60px;
}

/* Individual Product */
.cew-menu-cart__product {
	display: flex;
	gap: 15px;
	padding: 15px 0;
	position: relative;
}

.cew-menu-cart__product-image {
	flex-shrink: 0;
	width: 80px;
	height: 80px;
}

.cew-menu-cart__product-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 4px;
}

.cew-menu-cart__product-details {
	flex-grow: 1;
	min-width: 0;
}

.cew-menu-cart__product-name {
	font-weight: 600;
	margin-bottom: 8px;
	line-height: 1.4;
}

.cew-menu-cart__product-name a {
	color: inherit;
	text-decoration: none;
	transition: color 0.3s ease;
}

.cew-menu-cart__product-name a:hover {
	color: #0073aa;
}

.cew-menu-cart__product-meta {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 14px;
}

.cew-menu-cart__product.price-position-top .cew-menu-cart__product-meta {
	flex-direction: column-reverse;
}

.cew-menu-cart__product-quantity {
	color: #666;
}

.cew-menu-cart__product-price {
	font-weight: 600;
}

/* Remove Button */
.cew-menu-cart__product-remove-wrapper {
	flex-shrink: 0;
	display: flex;
}

.cew-menu-cart__product-remove-wrapper.remove-position-top {
	align-items: flex-start;
}

.cew-menu-cart__product-remove-wrapper.remove-position-center {
	align-items: center;
}

.cew-menu-cart__product-remove-wrapper.remove-position-bottom {
	align-items: flex-end;
}

.cew-menu-cart__product-remove {
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	font-size: 20px;
	line-height: 1;
	transition: all 0.3s ease;
	cursor: pointer;
}

.cew-menu-cart__product-remove:hover {
	transform: scale(1.2);
}

/* Empty Message */
.cew-menu-cart__empty-message {
	padding: 40px 20px;
	text-align: center;
	color: #666;
}

/* Footer */
.cew-menu-cart__footer {
	padding: 20px;
	border-top: 1px solid #eee;
}

.cew-menu-cart__subtotal {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	font-size: 18px;
	font-weight: 700;
	padding: 15px 0;
}

/* Buttons */
.cew-menu-cart__buttons {
	display: flex;
	gap: 10px;
}

.cew-menu-cart__buttons.layout-inline {
	flex-direction: row;
}

.cew-menu-cart__buttons.layout-stacked {
	flex-direction: column;
}

.cew-menu-cart__buttons.vertical-top {
	order: -1;
	margin-bottom: 20px;
	margin-top: 0;
}

.cew-menu-cart__buttons.vertical-bottom {
	order: 1;
	margin-top: 20px;
	margin-bottom: 0;
}

.cew-menu-cart__button {
	flex: 1;
	padding: 12px 24px;
	text-align: center;
	text-decoration: none;
	border: 2px solid transparent;
	border-radius: 4px;
	font-weight: 600;
	transition: all 0.3s ease;
	cursor: pointer;
	display: block;
}

.cew-menu-cart__button--view-cart {
	background-color: transparent;
	color: #333;
	border-color: #ddd;
}

.cew-menu-cart__button--view-cart:hover {
	background-color: #f5f5f5;
	border-color: #333;
}

.cew-menu-cart__button--checkout {
	background-color: #0073aa;
	color: #fff;
	border-color: #0073aa;
}

.cew-menu-cart__button--checkout:hover {
	background-color: #005177;
	border-color: #005177;
}

/* Notice for Missing WooCommerce */
.cew-menu-cart-notice {
	padding: 20px;
	background: #fff3cd;
	border: 1px solid #ffc107;
	border-radius: 4px;
	color: #856404;
	text-align: center;
}

/* Scrollbar Styling */
.cew-menu-cart__products::-webkit-scrollbar {
	width: 6px;
}

.cew-menu-cart__products::-webkit-scrollbar-track {
	background: #f1f1f1;
}

.cew-menu-cart__products::-webkit-scrollbar-thumb {
	background: #888;
	border-radius: 3px;
}

.cew-menu-cart__products::-webkit-scrollbar-thumb:hover {
	background: #555;
}

/* Responsive */
@media (max-width: 768px) {
	.cew-menu-cart__container.cart-type-mini-cart {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		max-width: 100%;
		transform: translateY(100%);
	}
	
	.cew-menu-cart.cart-open .cew-menu-cart__container.cart-type-mini-cart {
		transform: translateY(0);
	}
	
	.cew-menu-cart__container.cart-type-side-cart {
		width: 100%;
		max-width: 100%;
	}
}

/* Loading State */
.cew-menu-cart.loading .cew-menu-cart__products {
	opacity: 0.5;
	pointer-events: none;
}

/* Animation for item removal */
@keyframes fadeOut {
	from {
		opacity: 1;
		transform: translateX(0);
	}
	to {
		opacity: 0;
		transform: translateX(-20px);
	}
}

.cew-menu-cart__product.removing {
	animation: fadeOut 0.3s ease forwards;
}
