/**
 * Aloxovn Mini Shop – frontend.
 *
 * Mọi selector đều nằm trong namespace .ams-* (không có selector global như h1, p, img, button).
 * Font và màu chữ kế thừa từ theme. Tùy biến qua biến CSS trong .ams-scope.
 * Mobile-first; layout lớn dùng container queries (theo độ rộng khung chứa của theme).
 */

.ams-scope {
	--ams-primary: #2563eb;
	--ams-primary-contrast: #ffffff;
	--ams-hotline: #16a34a;
	--ams-zalo: #0068ff;
	--ams-danger: #dc2626;
	--ams-warning-bg: #fffbeb;
	--ams-warning-border: #f59e0b;
	--ams-muted: rgba(127, 127, 127, 0.9);
	--ams-border: rgba(127, 127, 127, 0.25);
	--ams-surface: rgba(127, 127, 127, 0.06);
	--ams-radius: 10px;
	--ams-button-radius: 4px;
	--ams-spacing: 16px;
	--ams-gap: 16px;
	--ams-container: 1200px;
	--ams-image-ratio: 1 / 1;
	--ams-cols-desktop: 4;
	--ams-cols-tablet: 3;
	--ams-cols-mobile: 2;
	font-family: inherit;
	color: inherit;
}

.ams-scope,
.ams-scope *,
.ams-scope *::before,
.ams-scope *::after {
	box-sizing: border-box;
}

/* Thuộc tính hidden phải thắng display của class (cần thiết cho JS). */
.ams-scope[hidden],
.ams-scope [hidden] {
	display: none !important;
}

.ams-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.ams-container {
	width: min(100% - 32px, var(--ams-container));
	margin-inline: auto;
	padding-block: 24px 48px;
}

.ams-main {
	display: block;
	width: 100%;
}

.ams-scope .ams-icon {
	flex: 0 0 auto;
	width: 1.15em;
	height: 1.15em;
}

.ams-section-title {
	margin: 0 0 12px;
	font-size: 1.15rem;
	line-height: 1.3;
}

/* ================= Nút bấm ================= */

.ams-scope .ams-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 18px;
	border: 1px solid transparent;
	border-radius: var(--ams-button-radius);
	background: var(--ams-surface);
	color: inherit;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s ease, background-color 0.15s ease, transform 0.05s ease;
	-webkit-tap-highlight-color: transparent;
}

.ams-scope .ams-button:hover {
	filter: brightness(0.94);
	text-decoration: none;
}

.ams-scope .ams-button:active {
	transform: translateY(1px);
}

.ams-scope .ams-button:focus-visible,
.ams-scope .ams-qty__btn:focus-visible,
.ams-scope .ams-gallery__thumb:focus-visible,
.ams-scope .ams-cart-item__remove:focus-visible,
.ams-scope .ams-chip:focus-visible,
.ams-floating-cart__link:focus-visible {
	outline: 3px solid var(--ams-primary);
	outline-offset: 2px;
}

.ams-scope .ams-button[disabled] {
	opacity: 0.65;
	cursor: not-allowed;
}

.ams-scope .ams-button--primary {
	background: var(--ams-primary);
	color: var(--ams-primary-contrast);
}

.ams-scope .ams-button--outline {
	background: transparent;
	border-color: currentColor;
}

.ams-scope .ams-button--hotline {
	background: var(--ams-hotline);
	color: #fff;
}

.ams-scope .ams-button--zalo {
	background: var(--ams-zalo);
	color: #fff;
}

.ams-scope .ams-button--block {
	display: flex;
	width: 100%;
}

.ams-scope .ams-button--large {
	min-height: 52px;
	font-size: 1.05rem;
}

.ams-scope .ams-button--small {
	min-height: 36px;
	padding: 6px 12px;
}

.ams-scope .ams-button.is-loading {
	cursor: progress;
}

.ams-scope .ams-button.is-added {
	filter: saturate(1.2);
}

.ams-button__meta {
	font-weight: 400;
	opacity: 0.9;
	white-space: nowrap;
}

.ams-contact-buttons {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 8px;
	margin-top: 10px;
}

.ams-contact-buttons .ams-button {
	flex-wrap: wrap;
}

/* ================= Giá / trạng thái ================= */

.ams-scope .ams-price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 8px;
	margin: 0;
}

.ams-scope .ams-price__regular {
	opacity: 0.6;
	font-size: 0.9em;
	text-decoration: line-through;
}

.ams-scope .ams-price__current {
	color: var(--ams-primary);
	font-weight: 700;
	text-decoration: none;
	background: none;
}

.ams-scope .ams-price__current--sale {
	color: var(--ams-danger);
}

.ams-scope .ams-price__contact {
	font-weight: 700;
}

.ams-scope .ams-stock {
	font-size: 0.9rem;
	font-weight: 600;
}

.ams-scope .ams-stock--in {
	color: var(--ams-hotline);
}

.ams-scope .ams-stock--out {
	color: var(--ams-danger);
	margin: 8px 0;
}

.ams-scope .ams-badge {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 1;
	padding: 3px 8px;
	border-radius: 999px;
	background: var(--ams-danger);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.4;
}

.ams-scope .ams-badge--muted {
	background: rgba(17, 24, 39, 0.75);
}

/* ================= Shop ================= */

.ams-shop__header {
	margin-bottom: 16px;
}

.ams-shop__title {
	margin: 0 0 6px;
	line-height: 1.25;
}

.ams-shop__description > :last-child {
	margin-bottom: 0;
}

.ams-shop-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 20px;
}

.ams-shop-toolbar__categories {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	max-width: 100%;
	padding-bottom: 2px;
	scrollbar-width: thin;
}

.ams-scope .ams-chip {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	padding: 6px 14px;
	border: 1px solid var(--ams-border);
	border-radius: 999px;
	color: inherit;
	font-size: 0.9rem;
	text-decoration: none;
	white-space: nowrap;
}

.ams-scope .ams-chip.is-active {
	border-color: var(--ams-primary);
	background: var(--ams-primary);
	color: var(--ams-primary-contrast);
}

.ams-scope .ams-select {
	min-height: 40px;
	max-width: 100%;
	padding: 6px 10px;
	border: 1px solid var(--ams-border);
	border-radius: 6px;
	background-color: transparent;
	color: inherit;
	font: inherit;
}

.ams-shop-toolbar__sort {
	display: flex;
	gap: 8px;
	margin: 0 0 0 auto;
}

.ams-scope .ams-grid {
	display: grid;
	grid-template-columns: repeat(var(--ams-cols-mobile), minmax(0, 1fr));
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ams-scope .ams-product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 1px solid var(--ams-border);
	border-radius: var(--ams-radius);
	overflow: hidden;
	background: transparent;
}

.ams-scope .ams-product-card::before {
	content: none;
}

.ams-product-card__media {
	position: relative;
	display: block;
	aspect-ratio: var(--ams-image-ratio);
	background: var(--ams-surface);
	overflow: hidden;
}

.ams-scope .ams-product-card__image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.ams-scope .ams-product-card:hover .ams-product-card__image {
	transform: scale(1.03);
}

.ams-product-card__placeholder,
.ams-gallery__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	min-height: 120px;
	opacity: 0.4;
}

.ams-product-card__placeholder .ams-icon,
.ams-gallery__placeholder .ams-icon {
	width: 40px;
	height: 40px;
}

.ams-product-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 6px;
	padding: 10px;
}

.ams-scope .ams-product-card__title {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.ams-scope .ams-product-card__title a {
	color: inherit;
	text-decoration: none;
}

.ams-scope .ams-product-card__title a:hover {
	text-decoration: underline;
}

.ams-product-card__excerpt {
	font-size: 0.85rem;
	opacity: 0.8;
}

.ams-product-card__actions {
	margin-top: auto;
	padding-top: 4px;
}

.ams-scope .ams-product-card__actions .ams-button {
	min-height: 40px;
	padding: 8px 10px;
	font-size: 0.9rem;
}

.ams-scope .ams-empty {
	margin: 24px 0;
	opacity: 0.8;
}

.ams-pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	margin-top: 28px;
}

.ams-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	min-height: 40px;
	padding: 0 10px;
	border: 1px solid var(--ams-border);
	border-radius: 8px;
	color: inherit;
	font-size: 0.95rem;
	text-decoration: none;
}

.ams-pagination a.page-numbers:hover {
	border-color: var(--ams-primary);
	color: var(--ams-primary);
}

.ams-pagination .page-numbers.current {
	border-color: var(--ams-primary);
	background: var(--ams-primary);
	color: var(--ams-primary-contrast);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.ams-pagination .page-numbers.dots {
	border-color: transparent;
}

/* ================= Chi tiết sản phẩm ================= */

.ams-breadcrumb {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 16px;
	font-size: 0.875rem;
	opacity: 0.85;
}

.ams-breadcrumb a {
	color: inherit;
}

.ams-single-product__top {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 20px;
}

.ams-gallery {
	min-width: 0;
}

.ams-scope .ams-gallery__main {
	margin: 0;
	border-radius: var(--ams-radius);
	overflow: hidden;
	background: var(--ams-surface);
	aspect-ratio: var(--ams-image-ratio);
}

.ams-scope .ams-gallery__image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	margin: 0;
	object-fit: cover;
}

.ams-scope .ams-gallery__thumbs {
	display: flex;
	gap: 8px;
	margin: 10px 0 0;
	padding: 0 0 4px;
	overflow-x: auto;
	list-style: none;
}

.ams-scope .ams-gallery__thumbs li {
	flex: 0 0 auto;
	margin: 0;
	padding: 0;
}

.ams-scope .ams-gallery__thumbs li::before {
	content: none;
}

.ams-scope .ams-gallery__thumb {
	display: block;
	width: 64px;
	height: 64px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 8px;
	background: none;
	overflow: hidden;
	cursor: pointer;
	opacity: 0.75;
}

.ams-scope .ams-gallery__thumb.is-active {
	border-color: var(--ams-primary);
	opacity: 1;
}

.ams-scope .ams-gallery__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
}

.ams-single-product__summary {
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-width: 0;
}

.ams-scope .ams-single-product__title {
	margin: 0;
	line-height: 1.25;
	overflow-wrap: anywhere;
}

.ams-scope .ams-single-product__price {
	font-size: 1.5rem;
}

.ams-scope .ams-single-product__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.9rem;
}

.ams-scope .ams-single-product__meta li {
	margin: 0;
}

.ams-single-product__excerpt > :last-child {
	margin-bottom: 0;
}

.ams-add-to-cart--single {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.ams-add-to-cart--single .ams-add-to-cart__button {
	flex: 1 1 200px;
	width: auto;
	min-height: 48px;
}

.ams-scope .ams-qty {
	display: inline-flex;
	align-items: stretch;
	height: 48px;
	border: 1px solid var(--ams-border);
	border-radius: var(--ams-button-radius);
	overflow: hidden;
}

.ams-scope .ams-qty--small {
	height: 38px;
}

.ams-scope .ams-qty__btn {
	width: 44px;
	min-width: 38px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--ams-surface);
	color: inherit;
	font: inherit;
	font-size: 1.2rem;
	line-height: 1;
	cursor: pointer;
}

.ams-scope .ams-qty__btn[disabled] {
	opacity: 0.4;
	cursor: not-allowed;
}

.ams-scope .ams-qty__input {
	width: 52px;
	min-height: 0;
	height: auto;
	margin: 0;
	padding: 0 4px;
	border: 0;
	border-inline: 1px solid var(--ams-border);
	border-radius: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.ams-scope .ams-qty__input::-webkit-outer-spin-button,
.ams-scope .ams-qty__input::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

.ams-single-product__description {
	margin-top: 36px;
	padding-top: 24px;
	border-top: 1px solid var(--ams-border);
}

.ams-content {
	overflow-wrap: break-word;
}

.ams-content img {
	max-width: 100%;
	height: auto;
}

.ams-single-product--embedded {
	margin-bottom: 24px;
}

.ams-single-product--embed {
	margin-block: 24px;
}

.ams-single-product__more {
	margin: 12px 0 0;
}

/* ================= Giỏ hàng / đặt hàng ================= */

.ams-scope .ams-loading {
	margin: 16px 0;
	opacity: 0.75;
}

.ams-notices:empty {
	display: none;
}

.ams-notices {
	display: grid;
	gap: 8px;
	margin-bottom: 16px;
}

.ams-scope .ams-notice {
	margin: 0;
	padding: 10px 14px;
	border-left: 4px solid var(--ams-primary);
	border-radius: 6px;
	background: var(--ams-surface);
}

.ams-scope .ams-notice--warning {
	border-left-color: var(--ams-warning-border);
	background: var(--ams-warning-bg);
	color: #78350f;
}

.ams-scope .ams-notice--error {
	border-left-color: var(--ams-danger);
	background: #fef2f2;
	color: #7f1d1d;
}

.ams-cart__empty,
.ams-notice-box {
	padding: 32px 16px;
	border: 1px dashed var(--ams-border);
	border-radius: var(--ams-radius);
	text-align: center;
}

.ams-cart__empty p {
	margin: 0 0 16px;
}

.ams-cart__layout,
.ams-checkout__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 20px;
	align-items: start;
}

.ams-scope .ams-cart__items,
.ams-scope .ams-summary__items {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ams-scope .ams-cart-item {
	display: grid;
	grid-template-columns: 72px minmax(0, 1fr);
	grid-template-areas:
		'media info'
		'media total';
	gap: 4px 12px;
	margin: 0;
	padding: 14px 0;
	border-bottom: 1px solid var(--ams-border);
}

.ams-scope .ams-cart-item::before,
.ams-scope .ams-summary__item::before {
	content: none;
}

.ams-cart-item__media,
.ams-summary__item .ams-cart-item__media {
	grid-area: media;
	display: block;
	width: 72px;
	height: 72px;
	border-radius: 8px;
	background: var(--ams-surface);
	overflow: hidden;
}

.ams-scope .ams-cart-item__image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
}

.ams-cart-item__info {
	grid-area: info;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.ams-scope .ams-cart-item__title {
	color: inherit;
	font-weight: 600;
	line-height: 1.35;
	text-decoration: none;
	overflow-wrap: anywhere;
}

.ams-cart-item__price {
	font-size: 0.9rem;
}

.ams-cart-item__controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 14px;
	margin-top: 4px;
}

.ams-scope .ams-cart-item__remove {
	min-height: 38px;
	padding: 0 4px;
	border: 0;
	background: none;
	color: var(--ams-danger);
	font: inherit;
	font-size: 0.875rem;
	text-decoration: underline;
	cursor: pointer;
}

.ams-cart-item__total {
	grid-area: total;
	align-self: end;
	font-weight: 700;
	text-align: right;
}

.ams-summary {
	padding: 16px;
	border: 1px solid var(--ams-border);
	border-radius: var(--ams-radius);
	background: var(--ams-surface);
}

.ams-scope .ams-summary__rows {
	margin: 0;
}

.ams-summary__row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 0;
}

.ams-scope .ams-summary__row dt,
.ams-scope .ams-summary__row dd {
	margin: 0;
	padding: 0;
	font-weight: 400;
}

.ams-scope .ams-summary__row dd {
	text-align: right;
}

.ams-summary__row--total {
	margin-top: 4px;
	border-top: 1px solid var(--ams-border);
	padding-top: 12px;
	font-size: 1.15rem;
}

.ams-scope .ams-summary__row--total dt,
.ams-scope .ams-summary__row--total dd {
	font-weight: 700;
}

.ams-scope .ams-summary__note {
	margin: 4px 0 0;
	font-size: 0.875rem;
	opacity: 0.85;
}

.ams-summary__actions {
	display: grid;
	gap: 8px;
	margin-top: 16px;
}

.ams-summary__actions .ams-contact-buttons {
	margin-top: 0;
}

.ams-scope .ams-summary__item {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 8px 0;
	border-bottom: 1px solid var(--ams-border);
}

.ams-summary__item .ams-cart-item__media {
	width: 48px;
	height: 48px;
}

.ams-summary__item-info {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ams-summary__item-name {
	font-weight: 600;
	overflow-wrap: anywhere;
}

.ams-summary__item-qty {
	font-size: 0.85rem;
	opacity: 0.8;
}

.ams-summary__item-total {
	font-weight: 600;
	white-space: nowrap;
}

.ams-scope .ams-summary__edit {
	margin: 10px 0 0;
	font-size: 0.9rem;
}

.ams-summary__alt {
	margin-top: 16px;
	padding-top: 12px;
	border-top: 1px dashed var(--ams-border);
}

.ams-scope .ams-summary__alt p {
	margin: 0;
	font-size: 0.9rem;
}

/* Form */

.ams-form {
	display: grid;
	gap: 14px;
	min-width: 0;
}

.ams-form__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 14px;
}

.ams-field--half {
	min-width: 0;
}

.ams-form__intro > :last-child {
	margin-bottom: 0;
}

.ams-scope .ams-form__error {
	margin: 0;
	padding: 10px 14px;
	border-left: 4px solid var(--ams-danger);
	border-radius: 6px;
	background: #fef2f2;
	color: #7f1d1d;
}

.ams-field {
	display: grid;
	gap: 6px;
}

.ams-scope .ams-field__label {
	display: block;
	margin: 0;
	padding: 0;
	font-weight: 600;
}

.ams-scope .ams-field__fieldset {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.ams-field__options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 18px;
	margin-top: 6px;
}

.ams-scope .ams-radio {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	cursor: pointer;
}

.ams-scope .ams-radio input {
	width: 20px;
	height: 20px;
	margin: 0;
	accent-color: var(--ams-primary);
}

.ams-scope .ams-input {
	display: block;
	width: 100%;
	max-width: 100%;
	min-height: 48px;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid var(--ams-border);
	border-radius: 8px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 16px; /* Tránh iOS tự zoom khi focus. */
	line-height: 1.4;
	box-shadow: none;
}

.ams-scope textarea.ams-input {
	min-height: 96px;
	resize: vertical;
}

.ams-scope .ams-input:focus {
	border-color: var(--ams-primary);
	outline: 2px solid color-mix(in srgb, var(--ams-primary) 30%, transparent);
	outline-offset: 0;
}

.ams-field.has-error .ams-input {
	border-color: var(--ams-danger);
}

.ams-scope .ams-field__error {
	margin: 0;
	color: var(--ams-danger);
	font-size: 0.875rem;
}

.ams-scope .ams-required {
	color: var(--ams-danger);
}

.ams-scope .ams-form__disclaimer {
	margin: 0;
	font-size: 0.85rem;
	opacity: 0.8;
}

/* Honeypot: ẩn khỏi người dùng thật nhưng không dùng display:none (bot dễ phát hiện). */
.ams-scope .ams-hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.ams-turnstile {
	min-height: 65px;
}

/* ================= Trang cảm ơn ================= */

.ams-order-success {
	max-width: 640px;
	margin: 0 auto;
	padding: 24px 0;
	text-align: center;
}

.ams-order-success__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: var(--ams-hotline);
	color: #fff;
}

.ams-order-success__icon .ams-icon {
	width: 34px;
	height: 34px;
}

.ams-scope .ams-order-success__title {
	margin: 14px 0 6px;
}

.ams-scope .ams-order-success__lead,
.ams-scope .ams-order-success__note {
	margin: 0 0 12px;
}

.ams-order-success__number {
	display: inline-flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 8px 0 16px;
	padding: 10px 18px;
	border: 1px dashed var(--ams-primary);
	border-radius: 8px;
	font-size: 1.1rem;
}

.ams-order-success__number strong {
	letter-spacing: 0.04em;
}

.ams-order-success__details {
	margin: 0 0 16px;
	text-align: left;
}

.ams-scope .ams-order-success__total {
	display: flex;
	justify-content: space-between;
	margin: 10px 0 0;
}

.ams-order-success__actions {
	display: grid;
	gap: 8px;
	max-width: 420px;
	margin: 20px auto 0;
}

.ams-order-success__actions .ams-contact-buttons {
	margin-top: 0;
}

/* ================= Giỏ hàng nổi + toast ================= */

.ams-floating-cart {
	position: fixed;
	right: 16px;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	z-index: 9990;
}

.ams-scope .ams-floating-cart__link {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--ams-primary);
	color: var(--ams-primary-contrast);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
	text-decoration: none;
}

.ams-floating-cart__link .ams-icon {
	width: 26px;
	height: 26px;
}

.ams-floating-cart__count {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border: 2px solid #fff;
	border-radius: 999px;
	background: var(--ams-danger);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
}

.ams-toast {
	position: fixed;
	left: 50%;
	bottom: calc(84px + env(safe-area-inset-bottom, 0px));
	z-index: 9991;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px 14px;
	width: max-content;
	max-width: calc(100% - 32px);
	padding: 12px 18px;
	border-radius: 10px;
	background: #111827;
	color: #fff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	transform: translateX(-50%);
	font-size: 0.95rem;
}

.ams-scope .ams-toast__link {
	color: #93c5fd;
	font-weight: 600;
	text-decoration: underline;
}

/* ================= Responsive theo khung chứa (container queries) =================
 * Layout phản ứng theo độ rộng THỰC TẾ của vùng nội dung theme (ví dụ block theme giới hạn
 * nội dung ~650px), không theo viewport → không bị ép cột khi theme có sidebar/khung hẹp.
 */

.ams-products {
	container: ams-products / inline-size;
}

.ams-single-product {
	container: ams-single / inline-size;
}

.ams-cart,
.ams-checkout {
	container: ams-cart / inline-size;
}

.ams-cart__main {
	container: ams-cart-main / inline-size;
}

@container ams-products (min-width: 520px) {
	.ams-scope .ams-grid {
		grid-template-columns: repeat(var(--ams-cols-tablet), minmax(0, 1fr));
		gap: var(--ams-gap);
	}
}

@container ams-products (min-width: 900px) {
	.ams-scope .ams-grid {
		grid-template-columns: repeat(var(--ams-cols-desktop), minmax(0, 1fr));
		gap: 20px;
	}

	.ams-product-card__body {
		padding: 12px 14px 14px;
	}
}

@container ams-single (min-width: 720px) {
	.ams-single-product__top {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: 40px;
		align-items: start;
	}

	.ams-gallery {
		position: sticky;
		top: 24px;
	}
}

@container ams-cart (min-width: 640px) {
	.ams-form__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.ams-form__grid > .ams-field {
		grid-column: 1 / -1;
	}

	.ams-form__grid > .ams-field--half {
		grid-column: span 1;
	}
}

@container ams-cart (min-width: 820px) {
	.ams-cart__layout,
	.ams-checkout__layout {
		grid-template-columns: minmax(0, 1fr) 340px;
		gap: 32px;
	}

	.ams-summary {
		position: sticky;
		top: 24px;
	}
}

@container ams-cart-main (min-width: 460px) {
	.ams-scope .ams-cart-item {
		grid-template-columns: 88px minmax(0, 1fr) auto;
		grid-template-areas: 'media info total';
		align-items: start;
	}

	.ams-cart-item__media {
		width: 88px;
		height: 88px;
	}

	.ams-cart-item__total {
		align-self: start;
		min-width: 100px;
	}
}

/* Trình duyệt cũ không hỗ trợ container queries: dùng media query. */
@supports not (container-type: inline-size) {
	@media (min-width: 600px) {
		.ams-scope .ams-grid {
			grid-template-columns: repeat(var(--ams-cols-tablet), minmax(0, 1fr));
		}
	}

	@media (min-width: 1024px) {
		.ams-scope .ams-grid {
			grid-template-columns: repeat(var(--ams-cols-desktop), minmax(0, 1fr));
		}

		.ams-form__grid {
			grid-template-columns: repeat(2, minmax(0, 1fr));
		}

		.ams-form__grid > .ams-field {
			grid-column: 1 / -1;
		}

		.ams-form__grid > .ams-field--half {
			grid-column: span 1;
		}

		.ams-single-product__top {
			grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
			gap: 40px;
		}
	}
}

@media (prefers-reduced-motion: reduce) {
	.ams-scope .ams-button,
	.ams-scope .ams-product-card__image {
		transition: none;
	}
}
