/* SMT Product Buy Box - Frontend Styles
 * Class prefix: smt-pbb-
 * Version: 1.0.0
 */

.smt-pbb-block,
.smt-pbb-block * {
	box-sizing: border-box;
}

.smt-pbb-block {
	width: 100%;
	max-width: 1080px;
	margin: 16px auto;
	font-family: Arial, sans-serif;
	background: #ffffff;
	border: 1px solid #eeeeee;
	border-radius: 5px;
	overflow: hidden;
}

.smt-pbb-row {
	display: grid;
	grid-template-columns: 90px minmax(280px, 1fr) 190px 232px;
	gap: 16px;
	align-items: center;
	padding: 12px 16px;
}

/* Khi khong co anh, bo cot dau */
.smt-pbb-block:not(:has(.smt-pbb-image)) .smt-pbb-row {
	grid-template-columns: minmax(280px, 1fr) 190px 232px;
}

.smt-pbb-image img {
	width: 70px;
	height: 70px;
	object-fit: contain;
	border-radius: 5px;
	display: block;
}

.smt-pbb-name {
	font-size: 15px;
	font-weight: 400;
	color: #ef1f1f;
	line-height: 1.45;
	word-break: break-word;
}

/* ========================================================
   Inline variation selector (san pham bien the trong multi-list)
   ======================================================== */

.smt-pbb-var-selects {
	margin-top: 6px;
}

.smt-pbb-attr-wrap {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 4px;
}

.smt-pbb-attr-label {
	font-size: 12px;
	color: #555555;
	white-space: nowrap;
	flex-shrink: 0;
}

.smt-pbb-attr-wrap select {
	font-size: 12px;
	padding: 3px 6px;
	border: 1px solid #dddddd;
	border-radius: 4px;
	background: #ffffff;
	color: #333333;
	max-width: 180px;
	flex: 1 1 auto;
	min-width: 0;
	cursor: pointer;
}

.smt-pbb-attr-wrap select:focus {
	border-color: #aaaaaa;
	outline: none;
}

/* Nut disabled khi chua chon bien the */
.smt-pbb-btn--disabled {
	opacity: 0.55;
	cursor: not-allowed;
	pointer-events: none;
}

/* Link tren ten san pham (khi bat tuy chon "chen permalink") */
.smt-pbb-name-link {
	color: inherit;
	text-decoration: none;
}

.smt-pbb-name-link:hover {
	text-decoration: underline;
	color: inherit;
}

.smt-pbb-price {
	display: flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
	font-size: 15px;
}

.smt-pbb-price-current {
	color: #00a000;
	font-weight: 400;
}

.smt-pbb-price-old {
	color: #999999;
	text-decoration: line-through;
	font-weight: 400;
}

/* Quantity selector */
.smt-pbb-qty {
	display: inline-flex;
	align-items: center;
	height: 34px;
	border: 1px solid #e5e5e5;
	border-radius: 5px;
	overflow: hidden;
	background: #ffffff;
}

.smt-pbb-qty button {
	flex: 0 0 20px;
	height: 34px;
	margin: 0;
	border: none;
	background: #fafafa;
	color: #777777;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	transition: background 0.15s ease, color 0.15s ease;

}

.smt-pbb-qty button:hover {
	background: #f1f1f1;
	color: #111111;
}

.smt-pbb-qty input[type="number"] {
	flex: 0 0 30px;
	width: 30px;
	min-width: 30px;
	max-width: 30px;
	height: 34px;
	padding: 0;
	margin: 0;
	border: none;
	border-left: 1px solid #eeeeee;
	border-right: 1px solid #eeeeee;
	text-align: center;
	font-size: 15px;
	font-family: inherit;
	color: #0f172a;
	background: #ffffff;
	box-shadow: none;
	outline: none;
	box-sizing: border-box;
	-moz-appearance: textfield;
	appearance: textfield;
	border-radius: 0;
}

.smt-pbb-qty input[type="number"]::-webkit-outer-spin-button,
.smt-pbb-qty input[type="number"]::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* Action line */
.smt-pbb-action-line {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	width: 100%;
	min-width: 0;
	white-space: nowrap;
}

.smt-pbb-action {
	flex: 0 0 120px;
	min-width: 120px;
}

/* Button */
.smt-pbb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 34px;
	padding: 8px 14px;
	border-radius: 5px;
	background: var(--smt-pbb-btn-bg, #ff7900);
	color: #ffffff;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	transition: background 0.2s ease;
	white-space: nowrap;
	border: none;
	cursor: pointer;
}

.smt-pbb-btn:hover,
.smt-pbb-btn:focus {
	background: var(--smt-pbb-btn-hover, #e96f00);
	color: #ffffff;
	text-decoration: none;
}

/* ========================================================
   Variable product: danh sach bien the
   .smt-pbb-row--with-stock: override grid 5 cot (them cot stock).
   ======================================================== */

/* Ngan cach giua cac hang bien the */
.smt-pbb-variation-row + .smt-pbb-variation-row {
	border-top: 1px solid #f5f5f5;
}

/* Grid 5 cot cho variation row co cot stock */
.smt-pbb-row--with-stock {
	grid-template-columns: 90px minmax(200px, 1fr) 160px 96px 220px;
}

/* Stock status badge */
.smt-pbb-stock {
	display: flex;
	align-items: center;
}

.smt-pbb-stock-badge {
	display: inline-block;
	padding: 3px 8px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 500;
	white-space: nowrap;
	line-height: 1.5;
}

.smt-pbb-stock--instock {
	background: #e6f4ea;
	color: #1a7f3a;
}

.smt-pbb-stock--lowstock {
	background: #fff3e0;
	color: #e65100;
}

.smt-pbb-stock--outofstock {
	background: #f5f5f5;
	color: #888888;
}

.smt-pbb-stock--onbackorder {
	background: #e3f2fd;
	color: #1565c0;
}

/* === Responsive: tablet === */
@media (max-width: 900px) {
	.smt-pbb-row {
		grid-template-columns: 78px minmax(200px, 1fr) 160px 214px;
		gap: 12px;
		padding: 12px;
	}

	.smt-pbb-row--with-stock {
		grid-template-columns: 78px minmax(160px, 1fr) 130px 84px 200px;
	}

	.smt-pbb-image img {
		width: 64px;
		height: 64px;
	}

	.smt-pbb-name,
	.smt-pbb-price {
		font-size: 14px;
	}

	.smt-pbb-btn {
		padding-left: 12px;
		padding-right: 12px;
	}
}

/* === Responsive: mobile === */
@media (max-width: 720px) {
	.smt-pbb-block {
		margin: 12px 0;
		border-radius: 5px;
	}

	.smt-pbb-row {
		grid-template-columns: 72px 1fr;
		grid-template-areas:
			"image name"
			"image price"
			"image actions";
		gap: 8px 12px;
		padding: 12px;
	}

	/* Variation row co stock: them grid-area stock */
	.smt-pbb-row--with-stock {
		grid-template-columns: 72px 1fr;
		grid-template-areas:
			"image name"
			"image price"
			"image stock"
			"image actions";
	}

	.smt-pbb-row--with-stock .smt-pbb-stock {
		grid-area: stock;
	}

	.smt-pbb-image {
		grid-area: image;
		align-self: start;
	}

	.smt-pbb-image img {
		width: 64px;
		height: 64px;
	}

	.smt-pbb-name-wrap {
		grid-area: name;
	}

	.smt-pbb-price {
		grid-area: price;
		font-size: 14px;
		flex-wrap: wrap;
		gap: 6px;
		line-height: 1.3;
		white-space: normal;
	}

	.smt-pbb-action-line {
		grid-area: actions;
		display: flex;
		align-items: center;
		justify-content: flex-start;
		gap: 8px;
		width: 100%;
		white-space: nowrap;
	}

	.smt-pbb-qty {
		flex: 0 0 90px;
	}

	.smt-pbb-action {
		flex: 1 1 auto;
		min-width: 0;
	}

	.smt-pbb-btn {
		width: 100%;
		min-height: 36px;
		font-size: 14px;
	}

	.smt-pbb-name {
		font-size: 14px;
		line-height: 1.4;
	}

	/* Khi khong co anh tren mobile */
	.smt-pbb-block:not(:has(.smt-pbb-image)) .smt-pbb-row {
		grid-template-columns: 1fr;
		grid-template-areas:
			"name"
			"price"
			"actions";
	}
}

/* === Responsive: small mobile === */
@media (max-width: 420px) {
	.smt-pbb-row {
		grid-template-columns: 62px 1fr;
		gap: 7px 10px;
		padding: 10px;
	}

	.smt-pbb-row--with-stock {
		grid-template-columns: 62px 1fr;
	}

	.smt-pbb-image img {
		width: 56px;
		height: 56px;
	}

	.smt-pbb-name {
		font-size: 13.5px;
	}

	.smt-pbb-price {
		font-size: 13.5px;
	}

	.smt-pbb-action-line {
		gap: 6px;
	}

	.smt-pbb-qty {
		flex-basis: 84px;
		height: 32px;
	}

	.smt-pbb-qty button {
		flex-basis: 28px;
		width: 28px;
		height: 32px;
		font-size: 17px;
	}

	.smt-pbb-qty input[type="number"] {
		height: 32px;
		font-size: 14px;
		flex: 0 0 28px;
		width: 28px;
		min-width: 28px;
		max-width: 28px;
		padding: 0;
	}

	.smt-pbb-btn {
		min-height: 32px;
		padding: 7px 10px;
		font-size: 13px;
	}
}
