/**
 * Etsy Storefront Connector - Cart Styles
 *
 * @package EtsyStorefrontConnector
 */

/* Add to Cart Buttons */
.esc-add-to-cart,
.esc-quick-add-cart {
	display: inline-block;
	padding: 10px 20px;
	background: #ff6900;
	color: white;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	transition: all 0.3s ease;
	text-decoration: none;
}

.esc-add-to-cart:hover,
.esc-quick-add-cart:hover {
	background: #e55a00;
	transform: translateY(-1px);
	box-shadow: 0 2px 8px rgba(255, 105, 0, 0.3);
}

.esc-add-to-cart.loading,
.esc-quick-add-cart.loading {
	opacity: 0.7;
	cursor: not-allowed;
}

.esc-add-to-cart.added {
	background: #46b450;
}

/* Quick Add Cart Button (Grid View) */
.esc-quick-add-cart {
	position: absolute;
	bottom: 10px;
	right: 10px;
	padding: 8px;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: all 0.3s ease;
}

.esc-listing-item:hover .esc-quick-add-cart {
	opacity: 1;
}

.esc-quick-add-cart svg {
	width: 20px;
	height: 20px;
	fill: white;
}

/* Update listing items to have relative positioning */
.esc-listing-item {
	position: relative;
}

.esc-listing-actions {
	display: flex;
	gap: 10px;
	align-items: center;
	justify-content: space-between;
}

/* Cart Button (Header/Widget) */
.esc-cart-button-container {
	display: inline-block;
	position: relative;
	float: right;
}

.esc-cart-button {
	display: inline-flex;
	align-items: center;
	padding: 8px 16px;
	background: #ffffff;
	border: 2px solid #ff6900;
	border-radius: 4px;
	color: #ff6900;
	text-decoration: none;
	transition: all 0.3s ease;
	position: relative;
}

.esc-cart-button:hover {
	background: #ff6900;
	color: white;
}

.esc-cart-icon {
	display: flex;
	align-items: center;
	margin-right: 8px;
}

.esc-cart-count {
	position: absolute;
	top: -8px;
	right: -8px;
	background: #ff6900;
	color: white;
	border-radius: 50%;
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: bold;
}

.esc-cart-total-preview {
	margin-left: 10px;
	font-weight: 600;
}

/* Cart Container */
.esc-cart-container {
	margin: 20px 0;
}

/* Cart Table */
.esc-cart-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 20px;
}

.esc-cart-table thead th {
	background: #f5f5f5;
	padding: 15px 10px;
	text-align: left;
	font-weight: 600;
	border-bottom: 2px solid #e5e5e5;
}

.esc-cart-table tbody td {
	padding: 15px 10px;
	border-bottom: 1px solid #e5e5e5;
	vertical-align: middle;
}

.esc-cart-item-image {
	width: 80px;
}

.esc-cart-item-image img {
	width: 60px;
	height: 60px;
	object-fit: cover;
	border-radius: 4px;
}

.esc-cart-item-title a {
	color: #333;
	text-decoration: none;
	font-weight: 500;
}

.esc-cart-item-title a:hover {
	color: #ff6900;
}

.esc-quantity-input {
	width: 60px;
	padding: 5px;
	border: 1px solid #ddd;
	border-radius: 4px;
	text-align: center;
}

.esc-cart-item-remove {
	width: 40px;
	text-align: center;
}

.esc-remove-item {
	background: none;
	border: none;
	color: #999;
	font-size: 24px;
	cursor: pointer;
	padding: 0;
	width: 30px;
	height: 30px;
	line-height: 1;
	transition: color 0.2s ease;
}

.esc-remove-item:hover {
	color: #d63638;
}

/* Cart Total */
.esc-cart-total td {
	padding: 20px 10px;
	font-size: 18px;
	border-top: 2px solid #333;
}

.esc-cart-total-amount {
	color: #ff6900;
	font-size: 24px;
}

/* Cart Actions */
.esc-cart-actions {
	display: flex;
	justify-content: space-between;
	gap: 15px;
	margin: 20px 0;
}

.esc-btn-secondary {
	background: #f5f5f5;
	color: #333;
	border: 1px solid #ddd;
}

.esc-btn-secondary:hover {
	background: #e5e5e5;
}

.esc-clear-cart {
	flex: 1;
}

.esc-checkout-btn {
	flex: 1;
}

/* Empty Cart */
.esc-cart-empty {
	text-align: center;
	padding: 60px 20px;
	background: #f9f9f9;
	border-radius: 8px;
}

.esc-cart-empty p {
	font-size: 18px;
	color: #666;
	margin-bottom: 20px;
}

/* Cart Notice */
.esc-cart-notice {
	background: #f0f8ff;
	border: 1px solid #b3d9ff;
	border-radius: 4px;
	padding: 15px;
	margin-top: 20px;
}

.esc-cart-notice p {
	margin: 0;
	color: #0073aa;
	font-size: 14px;
}

/* Checkout Container */
.esc-checkout-container {
	margin: 20px 0;
}

.esc-checkout-notice {
	background: #fff3cd;
	border: 1px solid #ffeaa7;
	padding: 15px;
	border-radius: 4px;
	margin-bottom: 20px;
}

.esc-checkout-shop {
	background: #f9f9f9;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	padding: 20px;
	margin-bottom: 20px;
}

.esc-checkout-shop h4 {
	margin-top: 0;
	color: #333;
}

.esc-checkout-items {
	list-style: disc;
	margin: 15px 0 20px 20px;
}

/* Checkout Instructions Modal */
.esc-checkout-instructions,
.esc-multi-shop-checkout {
	padding: 20px;
	max-width: 700px;
	margin: 0 auto;
}

.esc-checkout-instructions h3 {
	color: #333;
	margin-top: 0;
	margin-bottom: 15px;
}

.esc-shop-group {
	background: #f9f9f9;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	padding: 20px;
	margin-bottom: 20px;
}

.esc-shop-group h4 {
	margin-top: 0;
}

.esc-shop-group ul {
	margin: 15px 0 20px 20px;
}

/* Modal Overlay */
.esc-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 999999;
}

.esc-modal {
	background: white;
	border-radius: 8px;
	max-width: 90%;
	max-height: 90vh;
	overflow: auto;
	position: relative;
	padding: 30px;
}

.esc-modal-close {
	position: absolute;
	top: 10px;
	right: 10px;
	background: none;
	border: none;
	font-size: 30px;
	cursor: pointer;
	color: #999;
	line-height: 1;
	padding: 0;
	width: 30px;
	height: 30px;
}

.esc-modal-close:hover {
	color: #333;
}

/* Notifications */
.esc-notification {
	position: fixed;
	top: 20px;
	right: 20px;
	padding: 15px 20px;
	border-radius: 4px;
	background: white;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	display: flex;
	align-items: center;
	gap: 10px;
	transform: translateX(400px);
	transition: transform 0.3s ease;
	z-index: 1000000;
	max-width: 350px;
}

.esc-notification.show {
	transform: translateX(0);
}

.esc-notification-success {
	border-left: 4px solid #46b450;
}

.esc-notification-error {
	border-left: 4px solid #d63638;
}

.esc-notification-info {
	border-left: 4px solid #0073aa;
}

.esc-notification-close {
	background: none;
	border: none;
	font-size: 20px;
	cursor: pointer;
	color: #999;
	padding: 0;
	margin-left: auto;
	line-height: 1;
}

/* Spinner */
.esc-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid #ffffff;
	border-top-color: transparent;
	border-radius: 50%;
	animation: esc-spin 0.8s linear infinite;
}

@keyframes esc-spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
	.esc-cart-table thead th {
		padding: 10px 5px;
		font-size: 14px;
	}

	.esc-cart-table tbody td {
		padding: 10px 5px;
	}

	.esc-cart-item-image {
		width: 60px;
	}

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

	.esc-cart-actions {
		flex-direction: column;
	}

	.esc-clear-cart,
	.esc-checkout-btn {
		width: 100%;
	}

	.esc-notification {
		right: 10px;
		left: 10px;
		max-width: none;
	}
}

/* Integration with existing listing styles */
.esc-listing-item .esc-product-form {
	display: flex;
	gap: 10px;
	align-items: center;
	margin-top: 10px;
}

.esc-listing-item .esc-quantity {
	width: 60px;
	padding: 8px;
	border: 1px solid #ddd;
	border-radius: 4px;
}

.esc-listing-item .esc-add-to-cart {
	flex: 1;
}

/* Cart Widget Styles */
.widget_esc_cart_widget {
	padding: 15px;
	background: #f9f9f9;
	border-radius: 8px;
}

.widget_esc_cart_widget h2 {
	margin-top: 0;
	font-size: 18px;
}

.esc-widget-cart-items {
	list-style: none;
	margin: 15px 0;
	padding: 0;
}

.esc-widget-cart-items li {
	padding: 8px 0;
	border-bottom: 1px solid #e5e5e5;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.esc-widget-cart-items li:last-child {
	border-bottom: none;
}

.esc-widget-cart-total {
	font-weight: bold;
	font-size: 16px;
	margin: 15px 0;
	padding-top: 15px;
	border-top: 2px solid #333;
}