/**
 * Lonamed Custom Add to Cart — widget styles (v1.4)
 *
 * Matches catmobile.ro-style reference provided by client:
 *  - Quantity: boxed number with "buc" unit label (no +/− buttons)
 *  - Cart button: big solid red with cart icon, two-line layout
 *      Line 1 (large): "Adaugă În Coș"
 *      Line 2 (small): bundle composition e.g. "PAT + SALTEA + LENJERIE"
 *  - Delivery line: green, bold, with truck icon, sits below the row
 */

.lonamed-atc {
	--lonamed-atc-primary: #c8102e;
	--lonamed-atc-primary-hover: #a50d24;
	--lonamed-atc-text: #ffffff;
	--lonamed-atc-border: #d9d9d9;
	--lonamed-atc-delivery: #3B2338;
	--lonamed-atc-bg: #ffffff;
	--lonamed-atc-radius: 8px;
	--lonamed-atc-height: 64px;

	display: block;
	width: 100%;
	margin: 16px 0;
	font-family: inherit;
	box-sizing: border-box;
}

.lonamed-atc *,
.lonamed-atc *::before,
.lonamed-atc *::after {
	box-sizing: border-box;
}

/* ── Row: qty + cart button ─────────────────────────────────────────── */
.lonamed-atc__row {
	display: flex;
	align-items: stretch;
	gap: 10px;
	width: 100%;
	flex-wrap: wrap;
}

/* ── Quantity box (boxed number + "buc" unit + plus button) ─────────── */
.lonamed-atc__qty {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	height: var(--lonamed-atc-height);
	min-width: 116px;
	padding: 0 4px 0 12px;
	border: 1px solid var(--lonamed-atc-border);
	border-radius: var(--lonamed-atc-radius);
	background: var(--lonamed-atc-bg);
	flex: 0 0 auto;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lonamed-atc__qty:hover,
.lonamed-atc__qty:focus-within {
	border-color: #999;
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.lonamed-atc__qty-input {
	width: 32px;
	border: 0;
	background: transparent;
	text-align: center;
	font-size: 18px;
	font-weight: 700;
	color: #1a1a1a;
	-moz-appearance: textfield;
	padding: 0;
	line-height: 1;
}

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

.lonamed-atc__qty-input:focus {
	outline: none;
}

.lonamed-atc__qty-unit {
	font-size: 13px;
	font-weight: 500;
	color: #777;
	letter-spacing: 0.02em;
	user-select: none;
}

/* +/− buttons inside qty box. !important + high-spec selectors to override WoodMart */
.lonamed-atc .lonamed-atc__qty-plus,
.lonamed-atc .lonamed-atc__qty-minus,
button.lonamed-atc__qty-plus,
button.lonamed-atc__qty-minus {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	border: 0 !important;
	border-radius: 6px;
	background: #f1f1f1 !important;
	background-color: #f1f1f1 !important;
	background-image: none !important;
	color: #333 !important;
	font-size: 20px;
	font-weight: 400;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.15s ease, color 0.15s ease;
	text-decoration: none;
	box-shadow: none;
	min-height: 0;
}

.lonamed-atc .lonamed-atc__qty-plus {
	margin-left: 4px;
}

.lonamed-atc .lonamed-atc__qty-minus {
	margin-right: 4px;
}

.lonamed-atc .lonamed-atc__qty-plus:hover,
.lonamed-atc .lonamed-atc__qty-minus:hover,
button.lonamed-atc__qty-plus:hover,
button.lonamed-atc__qty-minus:hover {
	background: #e5e5e5 !important;
	background-color: #e5e5e5 !important;
	color: #000 !important;
}

.lonamed-atc .lonamed-atc__qty-plus:active,
.lonamed-atc .lonamed-atc__qty-minus:active,
button.lonamed-atc__qty-plus:active,
button.lonamed-atc__qty-minus:active {
	background: #d8d8d8 !important;
	background-color: #d8d8d8 !important;
}

/* ── Cart button — BIG RED, two-line text layout ────────────────────── */
/* Selector specificity is intentionally raised to win over WoodMart's
   default button styling (theme button rules use high specificity). */
.lonamed-atc .lonamed-atc__cart-btn,
button.lonamed-atc__cart-btn {
	flex: 1 1 60%;
	min-height: var(--lonamed-atc-height);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 10px 22px;
	border: 0 !important;
	border-radius: var(--lonamed-atc-radius);
	background: var(--lonamed-atc-primary) !important;
	background-color: var(--lonamed-atc-primary) !important;
	background-image: none !important;
	color: var(--lonamed-atc-text) !important;
	cursor: pointer;
	position: relative;
	transition: background-color 0.18s ease, transform 0.08s ease, box-shadow 0.18s ease;
	-webkit-appearance: none;
	appearance: none;
	min-width: 0;
	line-height: 1.2;
	text-align: left;
	box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
	text-transform: none;
	font-family: inherit;
	text-decoration: none;
}

.lonamed-atc .lonamed-atc__cart-btn:hover,
button.lonamed-atc__cart-btn:hover,
.lonamed-atc .lonamed-atc__cart-btn:focus,
button.lonamed-atc__cart-btn:focus {
	background: var(--lonamed-atc-primary-hover) !important;
	background-color: var(--lonamed-atc-primary-hover) !important;
	color: var(--lonamed-atc-text) !important;
	box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
}

.lonamed-atc .lonamed-atc__cart-btn:active,
button.lonamed-atc__cart-btn:active {
	transform: translateY(1px);
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.lonamed-atc .lonamed-atc__cart-btn:focus-visible {
	outline: 2px solid var(--lonamed-atc-primary-hover);
	outline-offset: 2px;
}

.lonamed-atc__cart-icon {
	flex-shrink: 0;
	color: var(--lonamed-atc-text) !important;
	fill: none !important;
	stroke: var(--lonamed-atc-text) !important;
}

.lonamed-atc__cart-icon path {
	stroke: var(--lonamed-atc-text) !important;
}

/* Two-line text block inside the button */
.lonamed-atc__cart-text {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 2px;
	pointer-events: none;
	min-width: 0;
	flex: 1 1 auto;
	color: var(--lonamed-atc-text) !important;
}

.lonamed-atc__cart-action {
	display: block;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
	color: var(--lonamed-atc-text) !important;
}

.lonamed-atc__cart-label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	opacity: 0.95;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
	color: var(--lonamed-atc-text) !important;
}

/* ── Loading spinner ────────────────────────────────────────────────── */
.lonamed-atc__spinner {
	position: absolute;
	right: 16px;
	top: 50%;
	width: 18px;
	height: 18px;
	margin-top: -9px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

.lonamed-atc__cart-btn.is-loading {
	pointer-events: none;
	opacity: 0.9;
}

.lonamed-atc__cart-btn.is-loading .lonamed-atc__spinner {
	opacity: 1;
	animation: lonamed-atc-spin 0.7s linear infinite;
}

@keyframes lonamed-atc-spin {
	to { transform: rotate(360deg); }
}

/* ── Delivery line (GREEN, bold, centered) ──────────────────────────── */
.lonamed-atc p.lonamed-atc__delivery,
.lonamed-atc__delivery {
	margin: 12px 0 0 !important;
	padding: 0 !important;
	font-size: 14px;
	font-weight: 600;
	color: var(--lonamed-atc-delivery) !important;
	display: flex;
	align-items: center;
	gap: 8px;
	line-height: 1.4;
	text-align: center;
	justify-content: center;
}

.lonamed-atc__delivery-icon {
	flex-shrink: 0;
	color: var(--lonamed-atc-delivery) !important;
	fill: var(--lonamed-atc-delivery) !important;
}

.lonamed-atc__delivery-icon path {
	fill: var(--lonamed-atc-delivery) !important;
}

/* ── Mobile ─────────────────────────────────────────────────────────── */
@media ( max-width: 480px ) {
	.lonamed-atc {
		--lonamed-atc-height: 58px;
	}

	.lonamed-atc__qty {
		min-width: 76px;
		padding: 0 10px;
	}

	.lonamed-atc__qty-input {
		width: 30px;
		font-size: 16px;
	}

	.lonamed-atc__qty-unit {
		font-size: 12px;
	}

	.lonamed-atc__cart-btn {
		padding: 8px 14px;
		gap: 10px;
	}

	.lonamed-atc__cart-action {
		font-size: 15px;
	}

	.lonamed-atc__cart-label {
		font-size: 11px;
	}

	.lonamed-atc__delivery {
		font-size: 13px;
	}
}
