/* d81-lieferservice — Frontend */

:root {
	--d81-ls-accent: #c8932a;
	--d81-ls-accent-dark: #a07419;
	--d81-ls-bg: #fff;
	--d81-ls-text: #1a1a1a;
	--d81-ls-muted: #666;
	--d81-ls-border: #e0e0e0;
	--d81-ls-warn: #b97a17;
	--d81-ls-error: #c0392b;
	--d81-ls-radius: 0.5rem;
	--d81-ls-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ============================================================ Vorschalt-Page */

.d81-ls-prequalify {
	max-width: 38rem;
	margin: 2rem auto;
	padding: 1.75rem;
	background: var(--d81-ls-bg);
	border-radius: var(--d81-ls-radius);
	box-shadow: var(--d81-ls-shadow);
	color: var(--d81-ls-text);
	font-family: inherit;
}

.d81-ls-prequalify__header h2 {
	margin: 0 0 0.5rem;
	font-size: 1.5rem;
}

.d81-ls-prequalify__header p {
	margin: 0 0 1.5rem;
	color: var(--d81-ls-muted);
	line-height: 1.5;
}

.d81-ls-prequalify__modes {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-bottom: 1.5rem;
}

.d81-ls-prequalify__modes .d81-ls-mode {
	flex: 1 1 0;
	min-width: 8rem;
}

.d81-ls-mode {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
	padding: 1rem 0.5rem;
	background: #fafafa;
	border: 2px solid var(--d81-ls-border);
	border-radius: var(--d81-ls-radius);
	cursor: pointer;
	transition: all 0.15s ease;
	font: inherit;
	color: inherit;
}

.d81-ls-mode:hover {
	border-color: var(--d81-ls-accent);
}

.d81-ls-mode.is-active {
	border-color: var(--d81-ls-accent);
	background: #fff8eb;
	box-shadow: inset 0 0 0 1px var(--d81-ls-accent);
}

.d81-ls-mode--disabled,
.d81-ls-mode[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
	background: #f3f3f3;
	border-color: var(--d81-ls-border);
}
.d81-ls-mode--disabled:hover,
.d81-ls-mode[disabled]:hover {
	border-color: var(--d81-ls-border);
}
.d81-ls-mode__hint {
	font-size: 0.8rem;
	color: var(--d81-ls-warn);
	font-weight: 500;
	margin-top: 0.15rem;
}

.d81-ls-closed-notice {
	margin-bottom: 1rem;
	padding: 0.85rem 1rem;
	background: #fff7e6;
	border: 1px solid #e6c990;
	border-left: 4px solid var(--d81-ls-warn);
	border-radius: var(--d81-ls-radius);
	color: #5a3d0c;
	font-size: 0.95rem;
	line-height: 1.4;
}
.d81-ls-closed-notice strong {
	font-weight: 600;
}

.d81-ls-mode__icon {
	font-size: 1.75rem;
	line-height: 1;
}

.d81-ls-mode__label {
	font-weight: 600;
}

.d81-ls-mode__hint {
	font-size: 0.85rem;
	color: var(--d81-ls-muted);
}

.d81-ls-prequalify__form {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

/* hidden-Attribut soll Vorrang haben (auch gegen display:flex) */
.d81-ls-prequalify__form[hidden],
[data-d81-pane][hidden],
.d81-ls-prequalify [hidden] {
	display: none !important;
}

.d81-ls-label {
	font-weight: 600;
	font-size: 0.95rem;
}

.d81-ls-input {
	width: 100%;
	padding: 0.75rem 0.9rem;
	border: 1px solid var(--d81-ls-border);
	border-radius: var(--d81-ls-radius);
	font-size: 1rem;
	background: #fff;
	color: inherit;
}

.d81-ls-input:focus {
	outline: 2px solid var(--d81-ls-accent);
	outline-offset: 1px;
	border-color: var(--d81-ls-accent);
}

.d81-ls-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	padding: 0.85rem 0rem;
	border: 0;
	border-radius: var(--d81-ls-radius);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease;
}

.d81-ls-btn--primary {
	background: var(--d81-ls-accent);
	color: #fff;
}

.d81-ls-btn--primary:hover:not(:disabled) {
	background: var(--d81-ls-accent-dark);
}

.d81-ls-btn--primary:disabled {
	opacity: 0.6;
	cursor: wait;
}

.d81-ls-btn--secondary {
	background: transparent;
	color: var(--d81-ls-accent);
	border: 1px solid var(--d81-ls-accent);
	margin-top: 0.75rem;
}

.d81-ls-btn--secondary:hover {
	background: var(--d81-ls-accent);
	color: #fff;
}

.d81-ls-note {
	font-size: 0.85rem;
	color: var(--d81-ls-muted);
	margin: 0.25rem 0 0;
	line-height: 1.4;
}

.d81-ls-note--info {
	color: var(--d81-ls-text);
	background: #fff7e6;
	border: 1px solid #e6c990;
	border-left: 3px solid var(--d81-ls-warn);
	border-radius: var(--d81-ls-radius);
	padding: 0.6rem 0.8rem;
	margin: 0.25rem 0 0.5rem;
}

.d81-ls-result {
	margin-top: 0.5rem;
	padding: 0.9rem 1rem;
	border-radius: var(--d81-ls-radius);
	border: 1px solid var(--d81-ls-border);
	background: #fafafa;
}

.d81-ls-result p { margin: 0 0 0.5rem; }
.d81-ls-result p:last-child { margin: 0; }

.d81-ls-result--warn {
	border-color: var(--d81-ls-warn);
	background: #fff7e6;
	color: #5a3d0c;
}

.d81-ls-result--error {
	border-color: var(--d81-ls-error);
	background: #fdecea;
	color: #6a1d18;
}

.d81-ls-result__meta {
	font-size: 0.85rem;
	color: var(--d81-ls-muted);
}

@media (max-width: 480px) {
	.d81-ls-prequalify { margin: 1rem; padding: 1.25rem; }
}

/* Google Places Autocomplete – z-index oberhalb Theme */
.pac-container { z-index: 999999 !important; }

/* Modern PlaceAutocompleteElement Web-Component */
.d81-ls-place-ac-wrap {
	display: block;
	margin-bottom: 0.25rem;
}
.d81-ls-place-ac-wrap gmp-place-autocomplete {
	display: block;
	width: 100%;
}

/* ============================================================ Confirm-Modal */

.d81-ls-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	/* Höher als Googles PlaceAutocompleteElement focus-ring (z-index 1000002) */
	z-index: 2147483640;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	animation: d81-ls-fade-in 0.15s ease-out;
}

@keyframes d81-ls-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.d81-ls-modal {
	background: #fff;
	color: var(--d81-ls-text);
	border-radius: 0.75rem;
	padding: 1.75rem;
	max-width: 30rem;
	width: 100%;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
	animation: d81-ls-scale-in 0.18s ease-out;
}

@keyframes d81-ls-scale-in {
	from { transform: scale(0.96); opacity: 0; }
	to   { transform: scale(1); opacity: 1; }
}

.d81-ls-modal__title {
	margin: 0 0 1rem;
	font-size: 1.25rem;
}

.d81-ls-modal__details {
	display: grid;
	grid-template-columns: auto 1fr;
	column-gap: 1rem;
	row-gap: 0.4rem;
	margin: 0 0 1.5rem;
	font-size: 0.95rem;
}

.d81-ls-modal__details dt {
	color: var(--d81-ls-muted);
	font-weight: 400;
}

.d81-ls-modal__details dd {
	margin: 0;
	font-weight: 600;
}

.d81-ls-modal__actions {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.d81-ls-modal__primary {
	width: 100%;
}

.d81-ls-modal__row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.6rem;
}

@media (max-width: 480px) {
	.d81-ls-modal { padding: 1.25rem; }
	.d81-ls-modal__row { grid-template-columns: 1fr; }
	.d81-ls-modal__details { grid-template-columns: 1fr; row-gap: 0.1rem; }
	.d81-ls-modal__details dd { margin-bottom: 0.5rem; }
}

/* ============================================================ Cart-Sidebar */

.d81-ls-cart {
	background: #fff;
	color: var(--d81-ls-text);
	font-family: inherit;
}

/* Bestell-Page-Layout: Speisekarte links + Cart rechts, im normalen Content-Flow */
.d81-ls-orderpage-grid {
	display: block;
}

.d81-ls-orderpage-grid__main {
	min-width: 0; /* erlaubt Grid-Items zu shrinken (Truncation in Children) */
}

/* Desktop: 2-Spalten-Grid, Cart sticky beim Scrollen */
@media (min-width: 1024px) {
	.d81-ls-orderpage-grid {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 22rem;
		gap: 1.5rem;
		align-items: start;
	}
	.d81-ls-cart {
		position: sticky;
		top: 1rem;
		max-height: calc(100vh - 2rem);
		display: flex;
		flex-direction: column;
		border: 1px solid var(--d81-ls-border);
		border-radius: var(--d81-ls-radius);
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
		overflow: hidden;
	}
	.d81-ls-cart__toggle { display: none; }
	.d81-ls-cart__body {
		flex: 1;
		display: flex;
		flex-direction: column;
		overflow: hidden;
	}
	.d81-ls-cart__items {
		overflow-y: auto;
	}
}

/* Mobile / Tablet: Bottom-Sheet (out of flow) */
@media (max-width: 1023px) {
	.d81-ls-cart {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		max-height: 80vh;
		z-index: 9990;
		display: flex;
		flex-direction: column;
		border-top: 1px solid var(--d81-ls-border);
		box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
	}
	.d81-ls-cart__body {
		display: none;
		flex-direction: column;
		overflow: auto;
		max-height: calc(80vh - 4rem);
	}
	.d81-ls-cart.is-open .d81-ls-cart__body {
		display: flex;
	}
}

.d81-ls-cart__toggle {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	width: 100%;
	padding: 0.85rem 1rem;
	background: var(--d81-ls-accent);
	color: #fff;
	border: 0;
	font-weight: 600;
	cursor: pointer;
	font: inherit;
	font-size: 1rem;
}
.d81-ls-cart__toggle-icon { font-size: 1.25rem; }
.d81-ls-cart__toggle-count {
	background: rgba(255,255,255,0.25);
	padding: 0.1rem 0.6rem;
	border-radius: 999px;
	font-size: 0.85rem;
}
.d81-ls-cart__toggle-total { margin-left: auto; }

.d81-ls-cart__header {
	padding: 1rem 1rem 0.75rem;
	border-bottom: 1px solid var(--d81-ls-border);
}
.d81-ls-cart__header h3 { margin: 0 0 0.25rem; font-size: 1.1rem; }
.d81-ls-cart__mode {
	margin: 0;
	color: var(--d81-ls-muted);
	font-size: 0.9rem;
}
.d81-ls-cart__mode small { display: block; font-size: 0.8rem; margin-top: 0.15rem; }
.d81-ls-cart__change {
	background: none;
	border: 0;
	color: var(--d81-ls-accent);
	font: inherit;
	font-size: 0.85rem;
	padding: 0.25rem 0;
	cursor: pointer;
	text-decoration: underline;
}

.d81-ls-cart__progress {
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--d81-ls-border);
}
.d81-ls-cart__progress-bar {
	height: 0.5rem;
	background: #f0f0f0;
	border-radius: 999px;
	overflow: hidden;
	margin-bottom: 0.5rem;
}
.d81-ls-cart__progress-fill {
	height: 100%;
	background: var(--d81-ls-accent);
	transition: width 0.3s ease;
	border-radius: 999px;
}
.d81-ls-cart__progress-label {
	margin: 0;
	font-size: 0.85rem;
	color: var(--d81-ls-muted);
}

.d81-ls-cart__items {
	list-style: none;
	margin: 0;
	padding: 0;
	flex: 1;
	overflow-y: auto;
}
.d81-ls-cart__empty {
	padding: 2rem 1rem;
	text-align: center;
	color: var(--d81-ls-muted);
}
.d81-ls-cart__item {
	display: grid;
	grid-template-columns: 3rem 1fr auto auto;
	gap: 0.6rem;
	align-items: center;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--d81-ls-border);
}
.d81-ls-cart__thumb {
	width: 3rem;
	height: 3rem;
	object-fit: cover;
	border-radius: 0.25rem;
}
.d81-ls-cart__item-meta {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.d81-ls-cart__item-name {
	font-size: 0.9rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.d81-ls-cart__item-line {
	font-size: 0.85rem;
	color: var(--d81-ls-muted);
}

.d81-ls-cart__item-extras {
	font-size: 0.78rem;
	color: var(--d81-ls-muted);
	margin: 0.15rem 0;
	line-height: 1.35;
}
.d81-ls-cart__item-extras dl,
.d81-ls-cart__item-extras p {
	margin: 0;
	padding: 0;
}
.d81-ls-cart__item-extras dt {
	display: inline;
	font-weight: 500;
	margin-right: 0.25em;
}
.d81-ls-cart__item-extras dt::after {
	content: ":";
}
.d81-ls-cart__item-extras dd {
	display: inline;
	margin: 0 0.5em 0 0;
}
.d81-ls-cart__item-extras dd + dt {
	display: block;
	margin-top: 0.1rem;
}
.d81-ls-cart__qty {
	display: flex;
	align-items: center;
	gap: 0.3rem;
}
.d81-ls-cart__qty button {
	width: 1.5rem;
	height: 1.5rem;
	border: 1px solid var(--d81-ls-border);
	background: #fafafa;
	border-radius: 0.25rem;
	cursor: pointer;
	font-weight: 600;
	font-size: 0.9rem;
	line-height: 1;
}
.d81-ls-cart__qty button:hover { border-color: var(--d81-ls-accent); }
.d81-ls-cart__qty span { min-width: 1.5rem; text-align: center; font-size: 0.9rem; }
.d81-ls-cart__remove {
	background: none;
	border: 0;
	color: var(--d81-ls-muted);
	cursor: pointer;
	font-size: 0.9rem;
	padding: 0.25rem;
}
.d81-ls-cart__remove:hover { color: var(--d81-ls-error); }

.d81-ls-cart__totals {
	padding: 0.75rem 1rem;
	border-top: 1px solid var(--d81-ls-border);
}
.d81-ls-cart__row {
	display: flex;
	justify-content: space-between;
	font-size: 0.9rem;
	margin-bottom: 0.25rem;
}
.d81-ls-cart__row--total {
	font-size: 1rem;
	font-weight: 600;
	margin-top: 0.5rem;
	padding-top: 0.5rem;
	border-top: 1px solid var(--d81-ls-border);
}

.d81-ls-cart__actions {
	padding: 0.75rem 1rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}
.d81-ls-cart__checkout {
	width: 100%;
	text-align: center;
	text-decoration: none;
}
.d81-ls-cart__checkout[aria-disabled="true"] {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: auto;
}

/* ============================================================ Lieferzeit-Banner (inline im Content) */

.d81-ls-banner {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.5rem;
	padding: 0.6rem 1rem;
	margin: 0 0 1rem;
	background: var(--d81-ls-accent);
	color: #fff;
	font-size: 0.95rem;
	text-align: center;
	border-radius: var(--d81-ls-radius);
}

@media (max-width: 480px) {
	.d81-ls-banner { font-size: 0.85rem; padding: 0.5rem 0.8rem; }
}

.d81-ls-banner__label {
	opacity: 0.92;
}

.d81-ls-banner__value {
	font-weight: 700;
}

.d81-ls-banner--closed {
	background: #6c5d2e;
}

/* ============================================================ Bestell-Page: Container-Override (Theme-Agnostic, gilt für jede konfigurierte Bestell-Page) */

body.d81-ls-orderpage #page_content_wrapper,
body.d81-ls-orderpage .page_content_wrapper {
	width: auto;
	max-width: 1400px;
	box-sizing: border-box;
}

/* WPBakery vc_row und Capella sidebar_content auf volle Breite freigeben */
body.d81-ls-orderpage #page_content_wrapper .inner,
body.d81-ls-orderpage #page_content_wrapper .inner .sidebar_content,
body.d81-ls-orderpage #page_content_wrapper .inner .sidebar_content.full_width {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

/* XootiX Side-Cart unterdrücken auf der Bestell-Page (eigener Cart übernimmt) */
body.d81-ls-orderpage .xoo-wsc-container,
body.d81-ls-orderpage .xoo-wsc-cart-trigger,
body.d81-ls-orderpage .xoo-wsc-modal { display: none !important; }

/* ============================================================ Kasse-Override (Plugin-seitig) */

/* Wrapper-Divs der versteckten Adressfelder ausblenden — die <input type="hidden">
   selbst rendert WC ohne Wrapper, aber bei custom Themes kann ein <p>/<span> drum
   herum sein. d81-ls-hidden trifft alle. */
body.woocommerce-checkout .d81-ls-hidden,
body.woocommerce-checkout p.form-row.d81-ls-hidden,
body.woocommerce-checkout .form-row.d81-ls-hidden {
	display: none !important;
}

/* "Rechnungsadresse"-Überschrift und alle Billing-Address-Hinweis-Headlines verbergen */
body.woocommerce-checkout .woocommerce-billing-fields > h3,
body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper + h3 {
	display: none;
}

/* Coupon-Box Styling */
body.woocommerce-checkout .d81-ls-coupon {
	background: #fff8eb;
	border: 1px solid #e6d3a6;
	border-radius: var(--d81-ls-radius);
	padding: 1rem 1.1rem;
	margin: 0 0 1rem;
}

body.woocommerce-checkout .d81-ls-coupon h3 {
	margin: 0 0 0.6rem;
	font-size: 1rem;
	color: #5a3d0c;
}

body.woocommerce-checkout .d81-ls-coupon .form-row {
	margin: 0 0 0.5rem;
	padding: 0;
	width: 100%;
	float: none;
}

body.woocommerce-checkout .d81-ls-coupon input.input-text {
	width: 100%;
	padding: 0.6rem 0.8rem;
	border: 1px solid var(--d81-ls-border);
	border-radius: var(--d81-ls-radius);
	font-size: 0.95rem;
	background: #fff;
	box-sizing: border-box;
}

body.woocommerce-checkout .d81-ls-coupon__btn {
	width: 100%;
	padding: 0.7rem 1rem;
	background: var(--d81-ls-accent);
	color: #fff;
	border: 0;
	border-radius: var(--d81-ls-radius);
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease;
}
body.woocommerce-checkout .d81-ls-coupon__btn:hover:not(:disabled) {
	background: var(--d81-ls-accent-dark);
}
body.woocommerce-checkout .d81-ls-coupon__btn:disabled {
	opacity: 0.6;
	cursor: wait;
}

body.woocommerce-checkout .d81-ls-coupon__notice {
	margin: 0.75rem 0;
	font-size: 0.9rem;
}

/* AGB- und Alters-Checkboxen auffälliger gestalten —
   targets via :has(checkbox) damit unabhängig von Plugin-Naming greift */
body.woocommerce-checkout #terms_field,
body.woocommerce-checkout #legal_age_field,
body.woocommerce-checkout .wc-terms-and-conditions,
body.woocommerce-checkout .woocommerce-terms-and-conditions-wrapper,
body.woocommerce-checkout form.checkout p.form-row:has(input[type="checkbox"][name*="terms"]),
body.woocommerce-checkout form.checkout p.form-row:has(input[type="checkbox"][name*="legal"]),
body.woocommerce-checkout form.checkout p.form-row:has(input[type="checkbox"][name*="age"]),
body.woocommerce-checkout form.checkout p.form-row:has(input[type="checkbox"][name*="parcel_delivery"]),
body.woocommerce-checkout form.checkout .gzd-form-row:has(input[type="checkbox"]),
body.woocommerce-checkout form.checkout .form-row:has(label.checkbox input[type="checkbox"]) {
	background: #fff8eb !important;
	border: 1px solid #e6d3a6 !important;
	border-left: 4px solid var(--d81-ls-accent) !important;
	border-radius: var(--d81-ls-radius);
	padding: 0.95rem 1.1rem !important;
	margin: 0.75rem 0 !important;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	float: none !important;
}

body.woocommerce-checkout form.checkout p.form-row:has(input[type="checkbox"]) label,
body.woocommerce-checkout form.checkout .gzd-form-row label {
	font-weight: 500;
	color: #1a1a1a;
	line-height: 1.45;
}

body.woocommerce-checkout form.checkout input[type="checkbox"][name*="terms"],
body.woocommerce-checkout form.checkout input[type="checkbox"][name*="legal"],
body.woocommerce-checkout form.checkout input[type="checkbox"][name*="age"],
body.woocommerce-checkout form.checkout input[type="checkbox"][name*="parcel"] {
	width: 1.15rem;
	height: 1.15rem;
	margin-right: 0.55rem;
	accent-color: var(--d81-ls-accent);
	vertical-align: middle;
	cursor: pointer;
}

/* "Pflicht"-Asterisk im Label etwas hervorheben */
body.woocommerce-checkout form.checkout p.form-row:has(input[type="checkbox"][required]) .required,
body.woocommerce-checkout form.checkout .wc-terms-and-conditions .required {
	color: var(--d81-ls-error);
	font-weight: 700;
	margin-left: 0.15rem;
}

/* Tabellen-Footer (Zwischensumme/Gesamt/MwSt): einheitliche Border-Stärke
   th und td hatten unterschiedliche Borders — Theme-Override mit Specifity */
body.woocommerce-checkout table.shop_table tfoot tr th,
body.woocommerce-checkout table.shop_table tfoot tr td {
	border-bottom: 1px solid var(--d81-ls-border);
	border-top: 0;
}
body.woocommerce-checkout table.shop_table tfoot tr:last-child th,
body.woocommerce-checkout table.shop_table tfoot tr:last-child td {
	border-bottom: 0;
}

/* Notice-Bereich oben am Checkout (für Coupon-Erfolgsmeldungen unsere Notices) */
body.woocommerce-checkout .d81-ls-coupon__notice .woocommerce-error,
body.woocommerce-checkout .d81-ls-coupon__notice .woocommerce-message,
body.woocommerce-checkout .d81-ls-coupon__notice .woocommerce-info {
	margin: 0;
	padding: 0.6rem 0.8rem;
	border-radius: var(--d81-ls-radius);
	font-size: 0.9rem;
	list-style: none;
}
