/* ---------------------------------------------------------------------------
   Quote list (inc/quote-list.php, assets/js/quote-list.js): add buttons, header counters, toast and the list
   component (quote sheet + contact page). Same --motion / --ease-morph tokens as the rest of the site; no animation
   under prefers-reduced-motion. Without JS (no .js class) the buttons stay hidden and the page is exactly as before.
   ------------------------------------------------------------------------ */

/* Add buttons */
.qadd {
	display: none;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background-color var(--motion-fast) var(--ease-morph), border-color var(--motion-fast) var(--ease-morph),
		color var(--motion-fast) var(--ease-morph), transform var(--motion-fast) var(--ease-morph);
}

.js .qadd {
	display: inline-flex;
}

.qadd:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 2px;
}

.qadd__check,
.qadd__text--done {
	display: none;
}

.qadd.is-added .qadd__plus,
.qadd.is-added .qadd__text:not(.qadd__text--done) {
	display: none;
}

.qadd.is-added .qadd__check {
	display: inline-flex;
}

.qadd.is-added .qadd__text--done {
	display: inline;
}

.qadd .icon {
	flex: none;
}

/* "+" on a product card (catalogue, related, search): a round button on the photo's top-right corner. */
.pcard,
.pdn-ptile {
	position: relative;
}

.qadd--icon {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid var(--border);
	border-radius: 50%;
	background: var(--surface);
	color: var(--brand-dark);
	box-shadow: 0 2px 8px rgba(11, 21, 18, 0.1);
}

.pdn-ptile .qadd--icon {
	top: 22px;
	right: 22px;
}

.qadd--icon:hover,
.qadd--icon.is-added {
	border-color: var(--brand);
	background: var(--brand);
	color: var(--text-invert);
}

.qadd--icon:active {
	transform: scale(0.92);
}

@media (pointer: coarse) {
	.qadd--icon {
		width: 40px;
		height: 40px;
	}
}

/* "Add to quote" next to "Request a quote" on the product page. */
.qadd--label {
	height: 52px;
	gap: 9px;
	padding-inline: 26px;
	border-radius: 8px;
	background: transparent;
}

.qadd--label.is-added {
	border-color: var(--brand);
	background: var(--brand-tint);
	color: var(--brand-dark);
}

/* Header counters: a white bubble inside the BÁO GIÁ pill / button, hidden at 0. */
.qcount {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	margin-inline-start: 8px;
	padding: 0 6px;
	border-radius: 99px;
	background: #fff;
	color: var(--brand-dark);
	font-family: var(--font-head);
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0;
	line-height: 1;
}

.qcount[hidden] {
	display: none;
}

.qcount.is-pop {
	animation: qcount-pop var(--motion) var(--ease-morph);
}

.qcount.is-bump {
	animation: qcount-bump var(--motion) var(--ease-morph);
}

@keyframes qcount-pop {
	from {
		opacity: 0;
		transform: scale(0.4);
	}
}

@keyframes qcount-bump {
	40% {
		transform: scale(1.3);
	}
}

/* Toast after adding */
.qtoast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	z-index: 190;
	display: flex;
	align-items: center;
	gap: 16px;
	max-width: calc(100% - 160px);
	padding: 12px 18px;
	border-radius: 10px;
	background: #0b1512;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	box-shadow: 0 12px 32px rgba(11, 21, 18, 0.28);
	opacity: 0;
	visibility: hidden;
	transform: translate(-50%, 12px);
	transition: opacity var(--motion) var(--ease-morph), transform var(--motion) var(--ease-morph), visibility 0s linear var(--motion);
}

.qtoast.is-on {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
	transition-delay: 0s;
}

.qtoast__view {
	flex: none;
	color: #7ee0ae;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.qtoast__view[hidden] {
	display: none;
}

.qtoast__view:focus-visible {
	outline: 2px solid #7ee0ae;
	outline-offset: 3px;
}

@media (max-width: 640px) {
	.qtoast {
		left: 16px;
		max-width: calc(100% - 100px);
		transform: translateY(12px);
	}

	.qtoast.is-on {
		transform: none;
	}
}

/* The list component */
.qsheet__list {
	margin: 0 0 18px;
}

.qlist-slot {
	margin: 0 0 24px;
}

.qlist {
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--surface);
}

.qlist__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--border);
}

.qlist__title {
	margin: 0;
	font-family: var(--font-head);
	font-size: 16px;
	font-weight: 800;
	line-height: 1.2;
}

.qlist__count {
	font-size: 13px;
	font-weight: 600;
	color: var(--text-muted);
}

.qlist__clear {
	padding: 4px 0;
	border: 0;
	background: none;
	color: var(--text-muted);
	font: 600 13px/1.2 var(--font-body);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.qlist__clear:hover {
	color: var(--brand-dark);
}

.qlist__items {
	margin: 0;
	padding: 0;
	list-style: none;
}

.qlist__item {
	display: grid;
	grid-template-columns: 48px minmax(0, 1fr) 32px;
	grid-template-areas:
		"photo main remove"
		"photo edit edit";
	align-items: start;
	gap: 8px 12px;
	padding: 12px 16px;
}

.qlist__item + .qlist__item {
	border-top: 1px solid var(--border);
}

.qlist__photo {
	grid-area: photo;
	display: block;
	width: 48px;
	height: 48px;
	overflow: hidden;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface-alt);
}

.qlist__photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #fff;
}

.qlist__main {
	grid-area: main;
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.qlist__name {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.qlist__code {
	font-size: 12px;
	color: var(--text-muted);
}

.qlist__edit {
	grid-area: edit;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.qlist__note {
	box-sizing: border-box;
	flex: 1 1 150px;
	min-width: 0;
	height: 36px;
	padding: 0 10px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface);
	color: var(--text);
	font: 400 13px/1 var(--font-body);
}

.qlist__note::placeholder {
	color: var(--text-muted);
}

.qlist__note:focus,
.qlist__qty-input:focus {
	border-color: var(--brand);
	outline: 0;
	box-shadow: 0 0 0 3px var(--brand-tint);
}

.qlist__qty {
	display: inline-flex;
	align-items: stretch;
	height: 36px;
	border: 1px solid var(--border);
	border-radius: 8px;
	overflow: hidden;
}

.qlist__step {
	width: 30px;
	padding: 0;
	border: 0;
	background: var(--surface-alt);
	color: var(--text);
	font: 600 16px/1 var(--font-body);
	cursor: pointer;
	transition: background-color var(--motion-fast) var(--ease-morph);
}

.qlist__step:hover {
	background: var(--brand-tint);
}

.qlist__qty-input {
	box-sizing: border-box;
	width: 46px;
	padding: 0;
	border: 0;
	border-inline: 1px solid var(--border);
	border-radius: 0;
	background: var(--surface);
	color: var(--text);
	font: 700 14px/1 var(--font-body);
	text-align: center;
	appearance: textfield;
	-moz-appearance: textfield;
}

.qlist__qty-input::-webkit-outer-spin-button,
.qlist__qty-input::-webkit-inner-spin-button {
	margin: 0;
	appearance: none;
	-webkit-appearance: none;
}

.qlist__remove {
	grid-area: remove;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--text-muted);
	cursor: pointer;
	transition: background-color var(--motion-fast) var(--ease-morph), color var(--motion-fast) var(--ease-morph);
}

.qlist__remove:hover {
	background: var(--surface-alt);
	color: var(--text);
}

.qlist__step:focus-visible,
.qlist__remove:focus-visible,
.qlist__clear:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 1px;
}

@media (prefers-reduced-motion: reduce) {
	.qadd,
	.qlist__step,
	.qlist__remove,
	.qtoast {
		transition: none;
	}

	.qcount.is-pop,
	.qcount.is-bump {
		animation: none;
	}
}

/* "Email me this list" box (inc/quote-saved.php): under the lines, inside the list card. */
.qsave {
	padding: 14px 16px 16px;
	border-top: 1px solid var(--border);
	background: var(--surface-alt);
	border-radius: 0 0 12px 12px;
}

.qsave__title {
	margin: 0 0 8px;
	font-family: var(--font-head);
	font-size: 15px;
	font-weight: 800;
	line-height: 1.25;
}

.qsave__row {
	display: flex;
	gap: 8px;
}

.qsave__input {
	box-sizing: border-box;
	flex: 1 1 auto;
	min-width: 0;
	height: 40px;
	padding: 0 12px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface);
	color: var(--text);
	font: 400 14px/1 var(--font-body);
}

.qsave__input:focus {
	border-color: var(--brand);
	outline: 0;
	box-shadow: 0 0 0 3px var(--brand-tint);
}

.qsave__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.qsave__btn {
	flex: none;
	height: 40px;
	padding: 0 16px;
	border: 1px solid var(--brand);
	border-radius: 8px;
	background: var(--surface);
	color: var(--brand-dark);
	font: 700 14px/1 var(--font-body);
	cursor: pointer;
	transition: background-color var(--motion-fast) var(--ease-morph), color var(--motion-fast) var(--ease-morph);
}

.qsave__btn:hover:not(:disabled),
.qsave__btn:focus-visible {
	background: var(--brand);
	color: var(--text-invert);
	outline: 0;
}

.qsave__btn:disabled {
	opacity: 0.6;
	cursor: progress;
}

.qsave__note {
	margin: 8px 0 0;
	font-size: 12px;
	line-height: 1.5;
	color: var(--text-muted);
}

.qsave__note a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.qsave__msg {
	margin: 8px 0 0;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.45;
	color: var(--text);
}

.qsave__msg[hidden] {
	display: none;
}

.qsave__msg.is-ok {
	color: var(--brand-dark);
}

.qsave__msg.is-error {
	color: #b3261e;
}

@media (max-width: 480px) {
	.qsave__row {
		flex-direction: column;
	}

	.qsave__btn {
		width: 100%;
	}
}

/* On-site reminder bar: a later visit with a non-empty list. Above the floating dock; no motion under reduced motion. */
.qnudge {
	position: fixed;
	right: 20px;
	bottom: 92px;
	z-index: 45;
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: min(420px, calc(100% - 40px));
	padding: 10px 8px 10px 16px;
	border-radius: 10px;
	background: #0b1512;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	box-shadow: 0 12px 32px rgba(11, 21, 18, 0.28);
	opacity: 0;
	transform: translateY(12px);
	transition: opacity var(--motion) var(--ease-morph), transform var(--motion) var(--ease-morph);
}

.qnudge.is-on {
	opacity: 1;
	transform: none;
}

.qnudge__text {
	min-width: 0;
}

.qnudge__go {
	flex: none;
	color: #7ee0ae;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.qnudge__x {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: rgba(255, 255, 255, 0.75);
	cursor: pointer;
}

.qnudge__x:hover {
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
}

.qnudge__go:focus-visible,
.qnudge__x:focus-visible {
	outline: 2px solid #7ee0ae;
	outline-offset: 2px;
}

@media (max-width: 640px) {
	.qnudge {
		right: 16px;
		bottom: 84px;
		left: 16px;
		max-width: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.qnudge,
	.qsave__btn {
		transition: none;
	}
}
