/**
 * WooCommerce Ajax Cart Sidebar - Frontend Styles
 *
 * @package WC_Ajax_Cart_Sidebar
 */

/* ===========================
   CSS Variables
   =========================== */
:root {
	--wcacs-primary-color: #0073aa;
	--wcacs-bg-color: #ffffff;
	--wcacs-text-color: #333333;
	--wcacs-button-color: #0073aa;
	--wcacs-border-radius: 8px;
	--wcacs-sidebar-width: 420px;
	--wcacs-transition-speed: 300ms;
	--wcacs-overlay-bg: rgba(0, 0, 0, 0.5);
	--wcacs-border-color: #e0e0e0;
	--wcacs-hover-color: #f5f5f5;
	--wcacs-error-color: #dc3545;
	--wcacs-success-color: #28a745;
}

/* ===========================
   Header Cart Icon
   =========================== */
.wcacs-header-cart-icon {
	position: fixed;
	top: 20px;
	left: 20px;
	z-index: 999999;
}

.wcacs-cart-trigger {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	background: var(--wcacs-bg-color);
	border: 2px solid var(--wcacs-border-color);
	border-radius: 50%;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wcacs-cart-trigger:hover {
	background: var(--wcacs-primary-color);
	border-color: var(--wcacs-primary-color);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	transform: translateY(-2px);
}

.wcacs-cart-trigger:hover .wcacs-cart-icon {
	color: var(--wcacs-bg-color);
}

.wcacs-cart-icon {
	width: 24px;
	height: 24px;
	color: var(--wcacs-text-color);
	transition: color 0.3s ease;
}

.wcacs-cart-count {
	position: absolute;
	top: -6px;
	right: -6px;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	background: var(--wcacs-error-color);
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	border-radius: 10px;
	line-height: 1;
}

/* ===========================
   Overlay
   =========================== */
.wcacs-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: var(--wcacs-overlay-bg);
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--wcacs-transition-speed) ease, visibility var(--wcacs-transition-speed) ease;
	z-index: 999998;
}

.wcacs-overlay.wcacs-overlay-visible {
	opacity: 1;
	visibility: visible;
}

/* ===========================
   Sidebar (RIGHT SIDE FIX)
   =========================== */
.wcacs-sidebar {
	position: fixed;
	top: 0;
	right: 0; /* Anchor to the right side */
	left: auto; /* Ensure left is not applied */
	width: var(--wcacs-sidebar-width);
	height: 100%;
	background: var(--wcacs-bg-color);
	box-shadow: -2px 0 16px rgba(0, 0, 0, 0.1); /* Shadow pointing leftwards */
	transform: translateX(100%); /* Push out to the right */
	-webkit-transform: translateX(100%);
	transition: transform var(--wcacs-transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
	-webkit-transition: -webkit-transform var(--wcacs-transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
	z-index: 999999;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	will-change: transform;
	-webkit-overflow-scrolling: touch;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

.wcacs-sidebar.wcacs-sidebar-open {
	transform: translateX(0);
	-webkit-transform: translateX(0);
}

.wcacs-sidebar-inner {
	display: flex;
	flex-direction: column;
	height: 100%;
}

/* ===========================
   Sidebar Header
   =========================== */
.wcacs-sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 24px;
	border-bottom: 1px solid var(--wcacs-border-color);
	flex-shrink: 0;
}

.wcacs-sidebar-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	color: var(--wcacs-text-color);
	display: flex;
	align-items: center;
	gap: 12px;
}

.wcacs-cart-count-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 24px;
	padding: 0 8px;
	background: var(--wcacs-primary-color);
	color: #ffffff;
	font-size: 12px;
	font-weight: 700;
	border-radius: 12px;
}

.wcacs-close-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	background: transparent;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.2s ease;
	color: var(--wcacs-text-color);
}

.wcacs-close-button:hover {
	background: var(--wcacs-hover-color);
}

.wcacs-close-button svg {
	width: 20px;
	height: 20px;
}

/* ===========================
   Sidebar Content
   =========================== */
.wcacs-sidebar-content {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 24px;
}

.wcacs-sidebar-content::-webkit-scrollbar {
	width: 6px;
}

.wcacs-sidebar-content::-webkit-scrollbar-track {
	background: transparent;
}

.wcacs-sidebar-content::-webkit-scrollbar-thumb {
	background: var(--wcacs-border-color);
	border-radius: 3px;
}

.wcacs-sidebar-content::-webkit-scrollbar-thumb:hover {
	background: #c0c0c0;
}

/* ===========================
   Empty Cart
   =========================== */
.wcacs-empty-cart {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 40px 20px;
	min-height: 300px;
}

.wcacs-empty-cart-icon {
	margin-bottom: 24px;
}

.wcacs-empty-cart-icon svg {
	display: block;
}

.wcacs-empty-cart-message {
	margin: 0 0 24px;
	font-size: 16px;
	color: #666666;
}

/* ===========================
   Cart Items
   =========================== */
.wcacs-cart-items {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.wcacs-cart-item {
	display: flex;
	gap: 16px;
	padding: 16px;
	background: var(--wcacs-bg-color);
	border: 1px solid var(--wcacs-border-color);
	border-radius: var(--wcacs-border-radius);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.wcacs-cart-item.wcacs-loading {
	opacity: 0.6;
	pointer-events: none;
}

.wcacs-cart-item-image {
	flex-shrink: 0;
	width: 80px;
	height: 80px;
}

.wcacs-cart-item-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: calc(var(--wcacs-border-radius) / 2);
}

.wcacs-cart-item-details {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}

.wcacs-cart-item-name {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
}

.wcacs-cart-item-name a {
	color: var(--wcacs-text-color);
	text-decoration: none;
	transition: color 0.2s ease;
}

.wcacs-cart-item-name a:hover {
	color: var(--wcacs-primary-color);
}

.wcacs-cart-item-variation {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 13px;
	color: #666666;
}

.wcacs-variation-item {
	display: flex;
	gap: 6px;
}

.wcacs-variation-label {
	font-weight: 500;
}

.wcacs-variation-value {
	color: var(--wcacs-text-color);
}

.wcacs-cart-item-meta {
	display: flex;
	align-items: center;
	gap: 12px;
}

.wcacs-cart-item-price {
	font-size: 15px;
	font-weight: 700;
	color: var(--wcacs-primary-color);
}

.wcacs-cart-item-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 4px;
}

/* ===========================
   Quantity Controls (Clean Card UI)
   =========================== */

/* The main container acts as a clean, floating card */
.wcacs-quantity-controls {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	background-color: var(--wcacs-bg-color, #ffffff);
	border: none;
	border-radius: 12px;
	padding: 6px 8px;
	min-width: 110px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
	transition: box-shadow 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}

/* Smooth levitation effect on hover */
.wcacs-quantity-controls:hover,
.wcacs-quantity-controls:focus-within {
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
	transform: translateY(-2px);
}

/* Button styling - using soft background colors instead of borders */
.wcacs-quantity-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background-color: #f4f6f8;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	color: #637381;
	transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
	will-change: transform;
}

/* Minus button - smooth transition to a soft red tint */
.wcacs-quantity-minus:hover:not(:disabled) {
	background-color: #fff1f0;
	color: var(--wcacs-error-color, #dc3545);
	transform: scale(1.05);
}

/* Plus button - smooth transition to a soft primary tint */
.wcacs-quantity-plus:hover:not(:disabled) {
	background-color: color-mix(in srgb, var(--wcacs-primary-color) 12%, transparent);
	color: var(--wcacs-primary-color, #0073aa);
	transform: scale(1.05);
}

/* Tactile click effect */
.wcacs-quantity-btn:active:not(:disabled) {
	transform: scale(0.95);
}

.wcacs-quantity-btn:disabled {
	opacity: 0.3;
	cursor: not-allowed;
	background-color: transparent;
}

.wcacs-quantity-btn svg {
	width: 16px;
	height: 16px;
}

/* Seamless input field integrated into the card */
.wcacs-quantity-input {
	flex: 1;
	width: 36px;
	height: 32px;
	text-align: center;
	border: none;
	background-color: transparent;
	font-size: 15px;
	font-weight: 600;
	color: var(--wcacs-text-color, #212b36);
	padding: 0;
	margin: 0 4px;
	-moz-appearance: textfield;
	transition: color 0.3s ease;
}

.wcacs-quantity-input:focus {
	outline: none;
	color: var(--wcacs-primary-color, #0073aa);
}

/* Hide native browser arrows */
.wcacs-quantity-input::-webkit-outer-spin-button,
.wcacs-quantity-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
/* ===========================
   Sidebar Footer
   =========================== */
.wcacs-sidebar-footer {
	flex-shrink: 0;
	padding: 24px;
	border-top: 1px solid var(--wcacs-border-color);
	background: var(--wcacs-bg-color);
}

.wcacs-subtotal {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
	padding: 16px;
	background: var(--wcacs-hover-color);
	border-radius: var(--wcacs-border-radius);
}

.wcacs-subtotal-label {
	font-size: 16px;
	font-weight: 600;
	color: var(--wcacs-text-color);
}

.wcacs-subtotal-amount {
	font-size: 20px;
	font-weight: 700;
	color: var(--wcacs-primary-color);
}

.wcacs-footer-buttons {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* ===========================
   Buttons
   =========================== */
.wcacs-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 14px 24px;
	font-size: 15px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	border: none;
	border-radius: var(--wcacs-border-radius);
	cursor: pointer;
	transition: all 0.3s ease;
	line-height: 1.4;
}

.wcacs-button-primary {
	background: var(--wcacs-button-color);
	color: #ffffff;
}

.wcacs-button-primary:hover {
	background: color-mix(in srgb, var(--wcacs-button-color) 85%, black);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wcacs-button-secondary {
	background: transparent;
	color: var(--wcacs-text-color);
	border: 2px solid var(--wcacs-border-color);
}

.wcacs-button-secondary:hover {
	background: var(--wcacs-hover-color);
	border-color: var(--wcacs-text-color);
}

/* ===========================
   Body Lock
   =========================== */
body.wcacs-sidebar-active {
	overflow: hidden;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 768px) {
	.wcacs-sidebar {
		width: 100%;
		max-width: 100%;
		z-index: 999999;
	}

	.wcacs-overlay {
		z-index: 999998;
	}

	.wcacs-cart-trigger,
	.wcacs-shortcode-trigger {
		-webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
		touch-action: manipulation;
		user-select: none;
		-webkit-user-select: none;
	}

	.wcacs-close-button,
	.wcacs-quantity-btn,
	.wcacs-remove-item {
		min-width: 44px;
		min-height: 44px;
		-webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
		touch-action: manipulation;
	}

	.wcacs-cart-trigger,
	.wcacs-close-button,
	.wcacs-quantity-btn,
	.wcacs-remove-item,
	.wcacs-button {
		touch-action: manipulation;
		-ms-touch-action: manipulation;
	}

	.wcacs-cart-trigger,
	.wcacs-shortcode-trigger {
		-webkit-appearance: none;
		appearance: none;
	}

	.wcacs-sidebar button,
	.wcacs-cart-trigger {
		-webkit-touch-callout: none;
		-webkit-user-select: none;
		-khtml-user-select: none;
		-moz-user-select: none;
		-ms-user-select: none;
		user-select: none;
	}

	/* Mobile Sidebar Right Side Fix */
	.wcacs-sidebar.wcacs-sidebar-open {
		position: fixed;
		top: 0;
		right: 0;
		left: auto; /* Ensures left overrides don't conflict */
		width: 100%;
		height: 100%;
		height: 100vh;
		height: -webkit-fill-available;
	}

	.wcacs-sidebar-content {
		-webkit-overflow-scrolling: touch;
		overflow-y: auto;
	}

	.wcacs-sidebar-header {
		padding-top: max(24px, env(safe-area-inset-top));
		padding-left: max(24px, env(safe-area-inset-left));
		padding-right: max(24px, env(safe-area-inset-right));
	}

	.wcacs-sidebar-footer {
		padding-bottom: max(24px, env(safe-area-inset-bottom));
		padding-left: max(24px, env(safe-area-inset-left));
		padding-right: max(24px, env(safe-area-inset-right));
	}
}

@media (max-width: 360px) {
	.wcacs-sidebar-header,
	.wcacs-sidebar-content,
	.wcacs-sidebar-footer {
		padding-left: 16px;
		padding-right: 16px;
	}

	.wcacs-cart-item {
		padding: 12px;
	}

	.wcacs-cart-item-image {
		width: 50px;
		height: 50px;
	}
}

@media (max-height: 500px) and (orientation: landscape) {
	.wcacs-sidebar-header {
		padding: 12px 16px;
	}

	.wcacs-sidebar-footer {
		padding: 12px 16px;
	}

	.wcacs-cart-item {
		padding: 8px;
	}

	.wcacs-cart-item-image {
		width: 60px;
		height: 60px;
	}

	.wcacs-footer-buttons {
		flex-direction: column;
	}
}

/* ===========================
   Loading States
   =========================== */
@keyframes wcacs-spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

.wcacs-loading-spinner {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 2px solid var(--wcacs-border-color);
	border-top-color: var(--wcacs-primary-color);
	border-radius: 50%;
	animation: wcacs-spin 0.6s linear infinite;
}

/* ===========================
   Accessibility
   =========================== */
.wcacs-cart-trigger:focus,
.wcacs-close-button:focus,
.wcacs-button:focus,
.wcacs-quantity-btn:focus,
.wcacs-remove-item:focus {
	outline: 2px solid var(--wcacs-primary-color);
	outline-offset: 2px;
}

.wcacs-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ===========================
   Print Styles
   =========================== */
@media print {
	.wcacs-header-cart-icon,
	.wcacs-sidebar,
	.wcacs-overlay {
		display: none !important;
	}
}

/* ===========================
   Shortcode Styles
   =========================== */

/* Wrapper Styles */
.wcacs-cart-icon-wrapper {
	display: inline-block;
}

.wcacs-cart-icon-wrapper.wcacs-align-left {
	text-align: left;
}

.wcacs-cart-icon-wrapper.wcacs-align-center {
	text-align: center;
}

.wcacs-cart-icon-wrapper.wcacs-align-right {
	text-align: right;
}

/* Position Variants */
.wcacs-cart-icon-wrapper.wcacs-position-static {
	position: static;
}

.wcacs-cart-icon-wrapper.wcacs-position-fixed {
	position: fixed;
	top: 20px;
	left: 20px;
	z-index: 999999;
}

.wcacs-cart-icon-wrapper.wcacs-position-absolute {
	position: absolute;
}

/* Shortcode Trigger Button */
.wcacs-shortcode-trigger {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 16px;
	background: var(--wcacs-bg-color);
	border: 2px solid var(--wcacs-border-color);
	border-radius: var(--wcacs-border-radius);
	cursor: pointer;
	transition: all 0.3s ease;
	font-size: 14px;
	font-weight: 500;
	color: var(--wcacs-text-color);
}

.wcacs-shortcode-trigger:hover {
	background: var(--wcacs-primary-color);
	border-color: var(--wcacs-primary-color);
	color: #ffffff;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wcacs-shortcode-trigger:hover .wcacs-cart-icon {
	color: #ffffff;
}

/* Default Style */
.wcacs-style-default .wcacs-shortcode-trigger {
	min-width: 48px;
	height: 48px;
	border-radius: 50%;
	padding: 12px;
}

.wcacs-style-default.wcacs-has-label .wcacs-shortcode-trigger {
	border-radius: var(--wcacs-border-radius);
	min-width: auto;
	padding: 10px 20px;
}

/* Minimal Style */
.wcacs-style-minimal .wcacs-shortcode-trigger {
	min-width: 40px;
	height: 40px;
	padding: 8px;
	background: transparent;
	border: none;
	border-radius: 0;
}

.wcacs-style-minimal .wcacs-shortcode-trigger:hover {
	background: var(--wcacs-hover-color);
	transform: none;
	box-shadow: none;
	color: var(--wcacs-primary-color);
}

.wcacs-cart-icon-minimal {
	width: 20px;
	height: 20px;
}

.wcacs-cart-count-minimal {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	font-size: 10px;
}

/* Text Style */
.wcacs-style-text .wcacs-shortcode-trigger {
	background: transparent;
	border: none;
	padding: 8px 12px;
	font-size: 15px;
	font-weight: 600;
}

.wcacs-style-text .wcacs-shortcode-trigger:hover {
	background: var(--wcacs-hover-color);
	border: none;
	color: var(--wcacs-primary-color);
	transform: none;
	box-shadow: none;
}

.wcacs-cart-text {
	display: flex;
	align-items: center;
	gap: 8px;
}

.wcacs-style-text .wcacs-cart-count {
	position: static;
	display: inline-flex;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	margin-left: 4px;
}

/* Cart Label */
.wcacs-cart-label {
	font-size: 14px;
	font-weight: 500;
	white-space: nowrap;
}

/* Inline Style */
.wcacs-style-inline .wcacs-shortcode-trigger {
	border-radius: var(--wcacs-border-radius);
}

/* Widget Specific */
.widget.wc-ajax-cart-sidebar-widget {
	text-align: center;
}

.widget.wc-ajax-cart-sidebar-widget .wcacs-cart-icon-wrapper {
	width: 100%;
}

.widget.wc-ajax-cart-sidebar-widget .wcacs-shortcode-trigger {
	width: 100%;
	justify-content: center;
}

@media (max-width: 768px) {
	.wcacs-cart-icon-wrapper.wcacs-position-fixed {
		top: 15px;
		left: 15px;
	}

	.wcacs-style-default .wcacs-shortcode-trigger {
		min-width: 44px;
		height: 44px;
	}

	.wcacs-cart-label {
		display: none;
	}

	.wcacs-style-default.wcacs-has-label .wcacs-shortcode-trigger {
		border-radius: 50%;
		padding: 10px;
		min-width: 44px;
	}
}

/* ===========================
   Simple Style (No Border)
   =========================== */
.wcacs-style-simple .wcacs-shortcode-trigger {
	background: transparent;
	border: none;
	padding: 8px;
	min-width: auto;
	height: auto;
	border-radius: 0;
	box-shadow: none;
}

.wcacs-style-simple .wcacs-shortcode-trigger:hover {
	background: transparent;
	border: none;
	transform: scale(1.1);
	box-shadow: none;
}

.wcacs-style-simple .wcacs-shortcode-trigger:hover .wcacs-cart-icon {
	color: var(--wcacs-primary-color);
}

.wcacs-style-simple .wcacs-cart-icon {
	color: var(--wcacs-text-color);
	transition: all 0.3s ease;
}

.wcacs-style-simple .wcacs-cart-count {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	background: var(--wcacs-error-color);
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	border-radius: 9px;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.wcacs-style-simple.wcacs-has-label .wcacs-shortcode-trigger {
	padding: 8px 12px;
	gap: 8px;
}

.wcacs-style-simple.wcacs-has-label .wcacs-shortcode-trigger:hover {
	background: var(--wcacs-hover-color);
	border-radius: var(--wcacs-border-radius);
}

.wcacs-style-simple .wcacs-shortcode-trigger[data-size="small"] .wcacs-cart-icon {
	width: 20px;
	height: 20px;
}

.wcacs-style-simple .wcacs-shortcode-trigger[data-size="large"] .wcacs-cart-icon {
	width: 32px;
	height: 32px;
}

.wcacs-style-simple.wcacs-no-count .wcacs-shortcode-trigger {
	padding: 6px;
}

.wcacs-style-simple.wcacs-clean .wcacs-shortcode-trigger:hover {
	transform: none;
	background: transparent;
}

.wcacs-style-simple.wcacs-clean .wcacs-shortcode-trigger:hover .wcacs-cart-icon {
	color: var(--wcacs-text-color);
	opacity: 0.7;
}

@media (max-width: 768px) {
	.wcacs-style-simple .wcacs-cart-count {
		min-width: 16px;
		height: 16px;
		font-size: 10px;
		top: 0;
		right: 0;
	}
}