/* ==========================================================================
   DS AJAX Cart – Styles
   ========================================================================== */

/* -----------------------------------------------------------------------
 * Buy Now Button
 * ---------------------------------------------------------------------- */
.ds-buy-now-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	background: linear-gradient(135deg, #ff6b35 0%, #e63946 100%) !important;
	color: #fff !important;
	border: none !important;
	border-radius: 6px;
	padding: 12px 28px !important;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.25s ease;
	text-transform: none;
	letter-spacing: 0.3px;
	position: relative;
	overflow: hidden;
	margin-left: 10px;
}

.ds-buy-now-btn:hover {
	background: linear-gradient(135deg, #e63946 0%, #c62828 100%) !important;
	transform: translateY(-1px);
	box-shadow: 0 4px 15px rgba(230, 57, 70, 0.35);
}

.ds-buy-now-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 8px rgba(230, 57, 70, 0.25);
}

/* -----------------------------------------------------------------------
 * Loading Spinner
 * ---------------------------------------------------------------------- */
.ds-loading {
	position: relative;
	pointer-events: none;
	opacity: 0.75;
}

.ds-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 18px;
	margin: -9px 0 0 -9px;
	border: 2.5px solid transparent;
	border-top-color: currentColor;
	border-right-color: currentColor;
	border-radius: 50%;
	animation: ds-spin 0.6s linear infinite;
}

@keyframes ds-spin {
	to {
		transform: rotate(360deg);
	}
}

.ds-cart-wrapper.ds-cart-loading {
	position: relative;
	pointer-events: none;
}

.ds-cart-wrapper.ds-cart-loading::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255, 255, 255, 0.5);
	backdrop-filter: blur(2px);
	z-index: 10;
	border-radius: 12px;
}

.ds-cart-wrapper.ds-cart-loading::before {
	content: '';
	position: absolute;
	top: 150px;
	left: 50%;
	width: 30px;
	height: 30px;
	margin-left: -15px;
	border: 3px solid #e2e8f0;
	border-top-color: #e63946;
	border-radius: 50%;
	animation: ds-spin 0.6s linear infinite;
	z-index: 11;
}

/* Hide text while loading */
.ds-loading .ds-toast__message,
.single_add_to_cart_button.ds-loading,
.ds-buy-now-btn.ds-loading,
.ds-card-buy-now.ds-loading,
.ajax_add_to_cart.ds-loading {
	color: transparent !important;
}

/* -----------------------------------------------------------------------
 * Toast Notifications
 * ---------------------------------------------------------------------- */
.ds-toast-container {
	position: fixed;
	top: 24px;
	right: 24px;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	gap: 10px;
	pointer-events: none;
}

.ds-toast {
	pointer-events: auto;
	border-radius: 12px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
	transform: translateX(110%);
	opacity: 0;
	transition: transform 0.35s cubic-bezier(0.21, 1.02, 0.55, 1), opacity 0.3s ease;
}

.ds-toast--visible {
	transform: translateX(0);
	opacity: 1;
}

/* --- Simple toast (errors, etc.) --- */
.ds-toast--success,
.ds-toast--error {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 280px;
	max-width: 420px;
	padding: 14px 18px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--ds-bg-white);
	backdrop-filter: blur(12px);
}

.ds-toast--success {
	background: linear-gradient(135deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.95) 100%);
}

.ds-toast--error {
	background: linear-gradient(135deg, rgba(239, 68, 68, 0.95) 0%, rgba(185, 28, 28, 0.95) 100%);
}

.ds-toast__message {
	flex: 1;
}

/* --- Rich product toast --- */
.ds-toast--product {
	background: var(--ds-bg-white);
	width: 360px;
	overflow: hidden;
}

.ds-toast__header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--ds-border);
	font-size: 13px;
	font-weight: 600;
	color: #10b981;
}

.ds-toast__header span {
	flex: 1;
}

.ds-toast__check {
	flex-shrink: 0;
}

.ds-toast__body {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
}

.ds-toast__img {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 8px;
	border: 1px solid #f0f0f0;
	flex-shrink: 0;
}

.ds-toast__info {
	flex: 1;
	min-width: 0;
}

.ds-toast__name {
	font-size: 14px;
	font-weight: 600;
	color: #1a1a1a;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin-bottom: 6px;
}

.ds-toast__meta {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 13px;
}

.ds-toast__price {
	color: var(--ds-danger);
	font-weight: 700;
}

.ds-toast__qty {
	color: var(--ds-text-muted);
	font-weight: 500;
}

.ds-toast__cart-link {
	display: block;
	text-align: center;
	padding: 10px 16px;
	background: #f8f8f8;
	color: #4169e1 !important;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none !important;
	border-top: 1px solid #f0f0f0;
	transition: background 0.2s;
}

.ds-toast__cart-link:hover {
	background: #f0f0f0;
}

/* --- Close button (shared) --- */
.ds-toast__close {
	background: none !important;
	border: none !important;
	color: rgba(0, 0, 0, 0.35);
	font-size: 20px;
	cursor: pointer;
	padding: 0 !important;
	line-height: 1;
	margin-left: auto;
	transition: color 0.2s;
}

.ds-toast--success .ds-toast__close,
.ds-toast--error .ds-toast__close {
	color: rgba(255, 255, 255, 0.8);
}

.ds-toast__close:hover {
	color: rgba(0, 0, 0, 0.6);
}

.ds-toast--success .ds-toast__close:hover,
.ds-toast--error .ds-toast__close:hover {
	color: var(--ds-bg-white);
}

/* -----------------------------------------------------------------------
 * Product Card Quantity & Cart Button
 * ---------------------------------------------------------------------- */
.ds-product-card-actions {
	display: flex;
	align-items: stretch;
	gap: 10px;
	margin-top: 15px;
	height: 38px;
}

.ds-qty-control {
	display: flex;
	align-items: stretch;
	border: 1px solid #e6effd;
	border-radius: 6px;
	overflow: hidden;
	background-color: #edf2fa;
	height: 38px;
	box-sizing: border-box;
	flex: 1;
	/* Take up remaining space */
}

.ds-qty-btn {
	background: transparent;
	border: none;
	width: 32px;
	color: var(--ds-text);
	font-size: 16px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.ds-qty-btn:hover {
	background: #e0e0e0;
}

.ds-qty-input {
	flex: 1;
	min-width: 0;
	width: 100%;
	border: none !important;
	text-align: center;
	font-size: 14px;
	color: var(--ds-text);
	padding: 0;
	margin: 0;
	-moz-appearance: textfield;
	appearance: textfield;
	border-radius: 0 !important;
	background: transparent;
}

.ds-qty-input::-webkit-outer-spin-button,
.ds-qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
}

.products .ajax_add_to_cart,
.ds-product-card-actions .ajax_add_to_cart {
	transition: all 0.25s ease;
	position: relative;
	overflow: hidden;
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 38px !important;
	height: 38px !important;
	padding: 0 !important;
	border-radius: 6px !important;
	background: white !important;
	color: var(--ds-primary) !important;
	border: 1px solid var(--ds-primary) !important;
	flex-shrink: 0;
	box-sizing: border-box;
}

.products .ajax_add_to_cart:hover,
.ds-product-card-actions .ajax_add_to_cart:hover {
	background: var(--ds-primary) !important;
	color: white !important;
}

.products .ajax_add_to_cart.added::after,
.ds-product-card-actions .ajax_add_to_cart.added::after {
	display: none;
	/* Hide the default checkmark */
}

.products .ajax_add_to_cart.added,
.ds-product-card-actions .ajax_add_to_cart.added {
	background: #10b981 !important;
	color: white !important;
	border-color: #10b981 !important;
	/* Green background on success */
}


/* Hide the "View cart" (Xem giỏ hàng) button added by WooCommerce */
.products .added_to_cart.wc-forward,
.ds-product-card-actions .added_to_cart.wc-forward {
	display: none !important;
}

/* Card Buy Now Button */
.ds-card-buy-now {
	flex: 1;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	background: var(--ds-primary-gradient) !important;
	color: #fff !important;
	font-size: 13px !important;
	font-weight: 500 !important;
	border-radius: 6px !important;
	/* padding: 10px 10px 12px !important; */
	text-decoration: none !important;
	transition: all 0.25s ease !important;
	white-space: nowrap !important;
	border: none !important;
	height: 38px !important;
	position: relative !important;
	overflow: hidden !important;
}

.ds-card-buy-now:hover {
	background: linear-gradient(135deg, #e63946 0%, #c62828 100%) !important;
	color: #fff !important;
	transform: translateY(-1px);
	box-shadow: 0 4px 15px rgba(230, 57, 70, 0.35);
}

/* -----------------------------------------------------------------------
 * Single product buttons layout
 * ---------------------------------------------------------------------- */
.single-product form.cart .button,
.single-product form.cart .ds-buy-now-btn {
	vertical-align: middle;
}

/* -----------------------------------------------------------------------
 * Responsive
 * ---------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
	.ds-card-buy-now {
		display: none !important;
	}
}

@media screen and (max-width: 600px) {
	.ds-toast-container {
		top: auto;
		bottom: 16px;
		right: 16px;
		left: 16px;
	}

	.ds-toast {
		min-width: unset;
		max-width: 100%;
	}

	.ds-buy-now-btn {
		margin-left: 0;
		margin-top: 10px;
		width: 100%;
	}

	.single-product form.cart {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
	}

	.single-product form.cart .single_add_to_cart_button {
		flex: 1;
	}

	.single-product form.cart .ds-buy-now-btn {
		flex: 1;
	}
}