/*
 * Product page: the option as buttons and the quantity stepper (FEATURE-BACKLOG item 24, 24.13).
 * Markup: ocmod/option_values.ocmod.xml; data: catalog/model/extension/asc/option_values.php buttons().
 *
 * One labelled group per option, the chosen value repeated in the heading, every value a button
 * with its price under it, the chosen one marked by a border, a tint and a check mark. A value on
 * special shows its old price and the percentage; a value out of stock is shown, crossed out, and
 * cannot be picked; a value that can be ordered without stock (24.15) carries its status (7-14 zile,
 * La comandă) under the price. The buttons are real radio inputs, so the keyboard and screen
 * readers work.
 */
.asc-opt {
	--asc-brand: #1f90bb;
	--asc-brand-dark: #17739a;
	--asc-tint: #eef7fb;
	--asc-line: #cfd6db;
	--asc-sale: #c0392b;
	--asc-wait: #8a5a00;
	border: 0;
	margin: 0 0 18px;
	padding: 0;
	min-width: 0;
}

.asc-opt__legend {
	width: auto;
	border: 0;
	margin: 0 0 10px;
	padding: 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	color: #333;
}

.asc-opt__current {
	font-weight: 400;
	color: #555;
}

.asc-opt__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
	gap: 8px;
}

.asc-opt--priced .asc-opt__grid {
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}

.asc-opt--list .asc-opt__grid {
	grid-template-columns: 1fr;
}

.asc-chip {
	position: relative;
	display: block;
	margin: 0;
	font-weight: 400;
	cursor: pointer;
}

/* the radio stays in the page for the keyboard and the form, out of sight */
.asc-chip__input {
	position: absolute;
	top: 0;
	left: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}

.asc-chip__box {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	height: 100%;
	padding: 8px 6px;
	border: 1px solid var(--asc-line);
	border-radius: 6px;
	background: #fff;
	text-align: center;
	transition: border-color .15s, box-shadow .15s, background-color .15s;
}

.asc-chip:hover .asc-chip__box {
	border-color: var(--asc-brand);
}

.asc-chip__input:checked + .asc-chip__box {
	border-color: var(--asc-brand);
	box-shadow: inset 0 0 0 1px var(--asc-brand);
	background: var(--asc-tint);
}

/* the check mark of the chosen one, on its top-left corner (the percentage sits on the right) */
.asc-chip__input:checked + .asc-chip__box::before {
	content: "";
	position: absolute;
	top: -7px;
	left: -5px;
	width: 18px;
	height: 18px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--asc-brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-4.9' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px no-repeat;
}

.asc-chip__input:focus-visible + .asc-chip__box {
	outline: 2px solid var(--asc-brand-dark);
	outline-offset: 2px;
}

.asc-chip__name {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	color: #222;
	overflow-wrap: anywhere;
}

.asc-chip__price {
	margin-top: 3px;
	font-size: 12px;
	line-height: 1.25;
	color: #555;
}

.asc-chip__price b {
	font-weight: 600;
}

.asc-chip__price s {
	display: block;
	color: #8a8a8a;
	font-weight: 400;
}

.asc-chip--sale .asc-chip__price b {
	color: var(--asc-sale);
}

/* 24.15: orderable without stock, the status under the price */
.asc-chip__status {
	margin-top: 2px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.25;
	color: var(--asc-wait);
}

.asc-chip__badge {
	position: absolute;
	top: -8px;
	right: -4px;
	padding: 1px 6px;
	border-radius: 9px;
	background: var(--asc-sale);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.5;
}

.asc-chip__img {
	width: 28px;
	height: 28px;
	margin-bottom: 4px;
	border-radius: 50%;
	object-fit: cover;
}

.asc-chip--out {
	cursor: not-allowed;
}

.asc-chip--out .asc-chip__box,
.asc-chip--out:hover .asc-chip__box {
	border-style: dashed;
	border-color: var(--asc-line);
	background: #f6f7f8;
}

.asc-chip--out .asc-chip__name {
	color: #8a8a8a;
	text-decoration: line-through;
}

.asc-chip--out .asc-chip__price {
	color: #8a8a8a;
}

/* long names: one value per line, the price on the right */
.asc-opt--list .asc-chip__box {
	flex-direction: row;
	flex-wrap: wrap;
	justify-content: flex-start;
	padding: 10px 12px 10px 28px;
	text-align: left;
}

.asc-opt--list .asc-chip__name {
	flex: 1 1 auto;
}

.asc-opt--list .asc-chip__price {
	margin: 0 0 0 12px;
	text-align: right;
}

.asc-opt--list .asc-chip__price s {
	display: inline;
	margin-right: 4px;
}

.asc-opt--list .asc-chip__status {
	flex: 1 0 100%;
	margin-top: 3px;
}

.asc-opt--list .asc-chip__badge {
	position: static;
	margin-left: 8px;
}

.asc-opt--list .asc-chip__input:checked + .asc-chip__box::before {
	top: 50%;
	left: 8px;
	margin-top: -7px;
}

/* the quantity stepper, beside the add-to-cart button where the browser can tell (:has) */
.asc-qty {
	display: inline-flex;
	align-items: stretch;
	height: 46px;
	border: 1px solid #cfd6db;
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
	vertical-align: top;
}

.asc-qty__btn {
	width: 42px;
	border: 0;
	background: #f3f5f6;
	color: #333;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.asc-qty__btn:hover {
	background: #e6eaec;
}

.asc-qty__btn:focus-visible {
	outline: 2px solid #17739a;
	outline-offset: -2px;
}

#product .asc-qty__input.form-control {
	width: 58px;
	height: 100%;
	padding: 0 4px;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	font-size: 16px;
	text-align: center;
}

#product .form-group:has(#input-quantity) {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 10px;
}

#product .form-group:has(#input-quantity) > * {
	flex: 0 0 100%;
}

#product .form-group:has(#input-quantity) > label {
	margin: 0 0 -4px;
}

#product .form-group:has(#input-quantity) > br,
#product .form-group:has(#input-quantity) > input[type="hidden"] {
	display: none;
}

#product .form-group:has(#input-quantity) > .asc-qty {
	flex: 0 0 auto;
}

#product .form-group:has(#input-quantity) > #button-cart {
	flex: 1 1 180px;
	width: auto;
	min-height: 46px;
	margin: 0;
}

.asc-buy-min {
	margin: -6px 0 14px;
	color: #666;
	font-size: 13px;
}

.asc-buy-min[hidden] {
	display: none;
}

/* 24.15: availability, the same three states on the cards and on the product page:
   in stock, orderable at a status (7-14 zile, La comandă), Lipsă stoc (cannot be ordered) */
.asc-avail {
	display: inline-block;
	margin: 0 0 6px;
	padding: 1px 8px;
	border-radius: 10px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
}

.asc-avail--in {
	background: #e8f5e9;
	color: #2e7d32;
}

.asc-avail--order {
	background: #fff4e0;
	color: #8a5a00;
}

.asc-avail--out {
	background: #f1f1f1;
	color: #757575;
}

li > .asc-avail {
	margin: 0;
}

/* the product cannot be ordered: the note goes under the add-to-cart button */
.asc-buy-out {
	order: 10;
	margin: 0;
	color: #757575;
	font-size: 13px;
}

.asc-buy-out[hidden] {
	display: none;
}

#button-cart[disabled],
.product-thumb .button-group button[disabled] {
	cursor: not-allowed;
	opacity: .55;
}

/* 24.16: phones, the buying bar once the add-to-cart button has scrolled out of view (asc-option-values.js);
   under the cookie notice (z-index 10000), which covers it until it is answered */
.asc-buybar {
	display: none;
}

@media (max-width: 767px) {
	.asc-buybar {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 8990;
		display: flex;
		align-items: center;
		gap: 10px;
		padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
		background: #fff;
		border-top: 1px solid #e3e6ea;
		box-shadow: 0 -4px 14px rgba(0, 0, 0, .12);
		transform: translateY(110%);
		transition: transform .2s ease;
	}

	.asc-buybar--on {
		transform: translateY(0);
	}

	.asc-buybar__info {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
		min-width: 0;
		line-height: 1.25;
	}

	.asc-buybar__price b {
		font-size: 17px;
		color: #222;
	}

	.asc-buybar__price s {
		font-size: 12px;
		color: #8a8a8a;
	}

	.asc-buybar__opt {
		overflow: hidden;
		font-size: 12px;
		color: #666;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

	.asc-buybar__btn {
		flex: 0 0 auto;
		min-height: 44px;
		padding: 0 16px;
		border: 0;
		border-radius: 6px;
		background: #1f90bb;
		color: #fff;
		font-size: 15px;
		font-weight: 600;
	}

	.asc-buybar__btn[disabled] {
		background: #f1f1f1;
		color: #757575;
	}

	body.asc-buybar-room {
		padding-bottom: 64px;
	}
}

