/**
 * Greenbox tellimus — mockup: tumedad tokenid, kaardid, aktiivne rida (qty > 0).
 */

.greenbox-wrap {
	/* Design tokens (Tailwind mockup) */
	--gb-bg: #1a211d;
	--gb-card: #141a16;
	--gb-border: #2a362d;
	--gb-primary: #5aa982;
	--gb-primary-hover: #4a8f6d;
	--gb-primary-soft: rgba(90, 169, 130, 0.08);
	--gb-primary-ring: rgba(90, 169, 130, 0.45);
	--gb-input-bg: #1a211d;
	--gb-text: #e5e7eb;
	--gb-muted: #9ca3af;
	--gb-checkout-text: #0a120e;
	--gb-focus: rgba(90, 169, 130, 0.35);
	--gb-footer-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);

	font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
	max-width: 1100px;
	margin: 0 auto;
	padding: 1rem 1rem 7rem;
	background: var(--gb-bg);
	color: var(--gb-text);
	font-size: 15px;
	line-height: 1.5;
	box-sizing: border-box;
}

.greenbox-wrap *,
.greenbox-wrap *::before,
.greenbox-wrap *::after {
	box-sizing: border-box;
}

/* Pealkiri — mockup: text-2xl font-bold + muted intro */
.greenbox-header {
	margin-bottom: 1.25rem;
}

.greenbox-title {
	margin: 0 0 0.25rem 0;
	font-size: 1.5rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--gb-text);
}

.greenbox-intro {
	margin: 0;
	font-size: 0.875rem;
	color: var(--gb-muted);
}

/* Kategooria filter — bg-card border rounded-xl p-4 */
.greenbox-cat-filter {
	margin: 0 0 1.5rem 0;
	padding: 1rem;
	background: var(--gb-card);
	border: 1px solid var(--gb-border);
	border-radius: 0.75rem;
}

.greenbox-cat-filter-label {
	display: block;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--gb-muted);
	margin-bottom: 0.5rem;
}

.greenbox-wrap select.greenbox-jump-cat {
	width: 100%;
	max-width: 420px;
	padding: 0.75rem 2.35rem 0.75rem 1rem;
	font-size: 1rem;
	line-height: 1.35;
	min-height: 2.75rem;
	color: var(--gb-text) !important;
	background-color: var(--gb-input-bg) !important;
	border: 1px solid var(--gb-border) !important;
	border-radius: 0.5rem;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 1rem center;
	background-size: 1rem 1rem;
	color-scheme: dark;
}

.greenbox-wrap select.greenbox-jump-cat:hover,
.greenbox-wrap select.greenbox-jump-cat:focus {
	border-color: var(--gb-primary) !important;
}

.greenbox-wrap select.greenbox-jump-cat:focus {
	outline: none;
	box-shadow: 0 0 0 3px var(--gb-focus);
}

.greenbox-wrap select.greenbox-jump-cat option,
.greenbox-wrap select.greenbox-jump-cat optgroup {
	background-color: var(--gb-card);
	color: var(--gb-text);
}

.greenbox-cat-filter-hint {
	margin: 0.5rem 0 0 0;
	font-size: 0.75rem;
	color: var(--gb-muted);
	line-height: 1.4;
}

/* WooCommerce teavitused */
.greenbox-notices.woocommerce {
	margin: 0 0 1.25rem 0;
	clear: both;
}

.greenbox-notices .woocommerce-message,
.greenbox-notices .woocommerce-info,
.greenbox-notices .woocommerce-error,
.greenbox-notices .woocommerce-notice,
.greenbox-notices ul.woocommerce-message,
.greenbox-notices ul.woocommerce-error {
	list-style: none;
	margin: 0 0 0.75rem 0;
	padding: 0.85rem 1rem;
	border-radius: 0.5rem;
	border: 1px solid var(--gb-border);
	color: var(--gb-text);
	background: rgba(0, 0, 0, 0.25);
}

.greenbox-notices ul.woocommerce-message li,
.greenbox-notices ul.woocommerce-error li,
.greenbox-notices ul.woocommerce-info li {
	margin: 0;
	padding: 0;
}

.greenbox-notices .woocommerce-message,
.greenbox-notices ul.woocommerce-message {
	background: var(--gb-primary-soft);
	border-color: var(--gb-primary);
}

.greenbox-notices .woocommerce-info,
.greenbox-notices ul.woocommerce-info {
	background: rgba(96, 165, 250, 0.12);
	border-color: rgba(96, 165, 250, 0.45);
}

.greenbox-notices .woocommerce-error,
.greenbox-notices ul.woocommerce-error {
	background: rgba(220, 80, 80, 0.18);
	border-color: rgba(248, 113, 113, 0.55);
}

.greenbox-notices .button,
.greenbox-notices a.button {
	margin-top: 0.35rem;
	margin-right: 0.35rem;
}

.greenbox-category {
	margin-bottom: 1.5rem;
	scroll-margin-top: 1rem;
}

.greenbox-category--hidden {
	display: none !important;
}

/* JOOGID — text-primary uppercase border-b */
.greenbox-category-title {
	margin: 0 0 0.75rem 0;
	padding-bottom: 0.5rem;
	font-size: 1.125rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--gb-primary);
	border-bottom: 1px solid var(--gb-border);
}

/* Kaart: rounded-xl overflow divide-y */
.greenbox-table-scroll {
	overflow: visible;
	border: 1px solid var(--gb-border);
	border-radius: 0.75rem;
	background: var(--gb-card);
}

.greenbox-table {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
	background: transparent;
	border: none;
}

.greenbox-table thead.screen-reader-text {
	position: absolute;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	word-wrap: normal !important;
}

.greenbox-table tbody {
	display: block;
}

.greenbox-table tbody tr.greenbox-row {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem;
	border-bottom: 1px solid var(--gb-border);
	transition: background 0.15s ease;
}

.greenbox-table tbody tr.greenbox-row:last-child {
	border-bottom: none;
}

/* Aktiivne rida (kogus > 0) — bg-primary/5 */
.greenbox-row.greenbox-row--active {
	background: var(--gb-primary-soft);
}

.greenbox-table tbody td {
	display: block;
	padding: 0 !important;
	border: none !important;
	vertical-align: middle;
}

/* Vasak: nimi + ühikuhind */
.greenbox-cell-meta {
	flex: 1 1 auto;
	min-width: 0;
	align-self: stretch;
}

.greenbox-product-name {
	display: block;
	font-weight: 500;
	font-size: 1rem;
	line-height: 1.35;
	color: var(--gb-text);
	margin-bottom: 0.25rem;
}

.greenbox-unit-price {
	display: block;
	font-size: 0.875rem;
	font-variant-numeric: tabular-nums;
	color: var(--gb-muted);
}

/* Parem: stepper + reasumma ühel real (mockup gap-3) */
.greenbox-cell-actions {
	flex: 0 0 auto;
	align-self: center;
}

.greenbox-actions-row {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: flex-end;
	gap: 0.75rem;
	min-width: 0;
}

.greenbox-line-wrap {
	flex: 0 0 auto;
	min-width: 3rem;
	max-width: 6.5rem;
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* Stepper — bg-background border rounded-lg h-9 mockup; aktiivsel primary äär */
.greenbox-qty-stepper {
	display: inline-flex;
	align-items: stretch;
	height: 2.25rem;
	border: 1px solid var(--gb-border);
	border-radius: 0.5rem;
	background: var(--gb-input-bg);
	overflow: hidden;
	vertical-align: middle;
}

.greenbox-row--active .greenbox-qty-stepper {
	border-color: var(--gb-primary);
	box-shadow: 0 0 0 1px var(--gb-primary-ring);
}

.greenbox-qty-btn {
	flex: 0 0 auto;
	width: 2.25rem;
	min-width: 2.25rem;
	padding: 0;
	margin: 0;
	border: none;
	border-right: 1px solid var(--gb-border);
	background: transparent;
	color: var(--gb-muted);
	font-size: 1rem;
	line-height: 1;
	font-weight: 600;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.12s ease, background 0.12s ease;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}

.greenbox-qty-btn:last-of-type {
	border-right: none;
	border-left: 1px solid var(--gb-border);
}

.greenbox-qty-btn:hover,
.greenbox-qty-btn:focus {
	color: var(--gb-text);
	background: rgba(255, 255, 255, 0.04);
	outline: none;
}

.greenbox-qty-stepper .greenbox-qty {
	width: 2rem;
	min-width: 2rem;
	flex: 0 0 auto;
	padding: 0;
	border: none;
	border-radius: 0;
	background: transparent;
	color: var(--gb-text);
	font-size: 0.875rem;
	font-weight: 600;
	text-align: center;
	font-variant-numeric: tabular-nums;
	-moz-appearance: textfield;
}

.greenbox-qty-stepper .greenbox-qty::-webkit-outer-spin-button,
.greenbox-qty-stepper .greenbox-qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.greenbox-qty-stepper .greenbox-qty:focus {
	outline: none;
	box-shadow: inset 0 0 0 2px var(--gb-primary);
}

.greenbox-line-total {
	display: block;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--gb-muted);
	white-space: nowrap;
}

.greenbox-row--active .greenbox-line-total {
	color: var(--gb-text);
	font-weight: 600;
}

.greenbox-empty {
	color: var(--gb-muted);
}

/* Sticky jalus — bg-card border-t shadow */
.greenbox-sticky {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99998;
	padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
	background: var(--gb-card);
	border-top: 1px solid var(--gb-border);
	box-shadow: var(--gb-footer-shadow);
}

.greenbox-sticky-inner {
	max-width: 1100px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 1rem;
}

.greenbox-sticky-text {
	font-size: 1rem;
	font-weight: 500;
	text-align: center;
	line-height: 1.35;
}

.greenbox-sticky-count {
	color: var(--gb-text);
	font-weight: 600;
}

.greenbox-sep {
	margin: 0 0.5rem;
	color: var(--gb-muted);
	font-weight: 400;
}

.greenbox-sticky-sum {
	font-size: 1.125rem;
	font-weight: 700;
	color: var(--gb-text);
	font-variant-numeric: tabular-nums;
}

.greenbox-btn-checkout {
	width: 100%;
	background: var(--gb-primary) !important;
	color: var(--gb-checkout-text) !important;
	border: none !important;
	padding: 0.875rem 1rem !important;
	border-radius: 0.75rem !important;
	font-weight: 600 !important;
	font-size: 1rem !important;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.15s ease, filter 0.15s ease;
	touch-action: manipulation;
}

.greenbox-btn-checkout:hover,
.greenbox-btn-checkout:focus {
	background: var(--gb-primary-hover) !important;
	color: var(--gb-checkout-text) !important;
	filter: none;
	outline: none;
}

@media (min-width: 768px) {
	.greenbox-title {
		font-size: 1.625rem;
	}

	.greenbox-table tbody tr.greenbox-row {
		padding: 1rem 1.125rem;
		gap: 1.25rem;
	}

	.greenbox-sticky-inner {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		flex-wrap: wrap;
		gap: 1rem;
	}

	.greenbox-sticky-text {
		text-align: left;
		margin-bottom: 0;
	}

	.greenbox-btn-checkout {
		width: auto;
		min-width: 14rem;
		padding-left: 1.75rem !important;
		padding-right: 1.75rem !important;
	}
}

/* Suuremad puutealad kitsatel ekraanidel */
@media (max-width: 767px) {
	.greenbox-qty-stepper {
		height: 2.5rem;
		min-height: 44px;
		border-radius: 0.5rem;
	}

	.greenbox-qty-btn {
		width: 2.5rem;
		min-width: 44px;
		min-height: 44px;
		font-size: 1.125rem;
	}

	.greenbox-qty-stepper .greenbox-qty {
		width: 2.25rem;
		min-width: 2.25rem;
		font-size: 1rem;
	}

	.greenbox-line-total {
		font-size: 0.9375rem;
	}

	.greenbox-row--active .greenbox-line-total {
		font-size: 1rem;
	}
}
