/* ==========================================================================
   SHAM Dish Builder — Modal (Uber Eats / Apple-clean bottom-sheet)
   ========================================================================== */

:root {
	--sdb-bg: #ffffff;
	--sdb-ink: #1d1d1f;
	--sdb-ink-soft: #6e6e73;
	--sdb-line: #e8e8ed;
	--sdb-accent: #1d1d1f;        /* Swap to SHAM brand color */
	--sdb-accent-ink: #ffffff;
	--sdb-radius: 18px;
	--sdb-radius-card: 14px;
	--sdb-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
	--sdb-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Trigger button on the shop loop */
.sdb-open-modal {
	cursor: pointer;
}

/* ---------- Overlay ---------- */
.sdb-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
}
.sdb-modal.is-open {
	display: block;
}
.sdb-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	transition: opacity 0.32s var(--sdb-ease);
}
.sdb-modal.is-open .sdb-backdrop {
	opacity: 1;
}

/* ---------- Sheet ---------- */
.sdb-sheet {
	position: absolute !important;
	left: 50% !important;
	bottom: 0;
	transform: translate(-50%, 100%);
	width: 100%;
	max-width: 480px;
	max-height: 92vh;
	margin: 0 !important;
	background: var(--sdb-bg);
	border-radius: var(--sdb-radius) var(--sdb-radius) 0 0;
	box-shadow: var(--sdb-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: transform 0.42s var(--sdb-ease);
	-webkit-font-smoothing: antialiased;
}
.sdb-modal.is-open .sdb-sheet {
	transform: translate(-50%, 0);
}

/* Desktop: center as a card instead of bottom sheet */
@media (min-width: 768px) {
	.sdb-sheet {
		bottom: auto !important;
		top: 50% !important;
		transform: translate(-50%, -50%) scale(0.96);
		border-radius: var(--sdb-radius);
		max-height: 86vh;
		opacity: 0;
	}
	.sdb-modal.is-open .sdb-sheet {
		transform: translate(-50%, -50%) scale(1);
		opacity: 1;
	}
}

.sdb-close {
	position: absolute !important;
	top: 12px !important;
	right: 14px !important;
	left: auto !important;
	bottom: auto !important;
	z-index: 5;
	width: 34px;
	height: 34px;
	margin: 0 !important;
	padding: 0 !important;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(8px);
	font-size: 22px;
	line-height: 34px;
	text-align: center;
	color: var(--sdb-ink);
	cursor: pointer;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

/* ---------- Scroll area ---------- */
.sdb-sheet-scroll {
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 8px;
}
.sdb-dish-image {
	width: 100%;
	aspect-ratio: 16 / 9;
	background-size: cover;
	background-position: center;
	background-color: #f2f2f4;
}
.sdb-dish-image:empty {
	display: none;
}
.sdb-dish-title {
	margin: 18px 20px 4px;
	font-size: 24px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--sdb-ink);
}
.sdb-dish-desc {
	margin: 0 20px 8px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--sdb-ink-soft);
}
.sdb-dish-desc:empty {
	display: none;
}

/* ---------- Groups ---------- */
.sdb-group-block {
	padding: 16px 20px 4px;
	border-top: 8px solid #f7f7f9;
}
.sdb-group-block:first-child {
	border-top: none;
}
.sdb-group-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 16px;
	font-weight: 600;
	color: var(--sdb-ink);
	margin-bottom: 12px;
}
.sdb-group-req {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--sdb-accent-ink);
	background: var(--sdb-accent);
	padding: 3px 8px;
	border-radius: 6px;
}
.sdb-group-optional {
	font-size: 12px;
	font-weight: 400;
	color: var(--sdb-ink-soft);
}

/* Tap-cards instead of native radios */
.sdb-option-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	margin-bottom: 10px;
	border: 1.5px solid var(--sdb-line);
	border-radius: var(--sdb-radius-card);
	cursor: pointer;
	transition: border-color 0.18s var(--sdb-ease), background 0.18s var(--sdb-ease);
	user-select: none;
}
.sdb-option-card:hover {
	border-color: #c8c8cf;
}
.sdb-option-card.is-selected {
	border-color: var(--sdb-accent);
	background: #fafafa;
}
.sdb-option-card input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.sdb-option-left {
	display: flex;
	align-items: center;
	gap: 12px;
}
.sdb-option-mark {
	width: 22px;
	height: 22px;
	border: 2px solid var(--sdb-line);
	border-radius: 50%;
	flex-shrink: 0;
	position: relative;
	transition: border-color 0.18s var(--sdb-ease);
}
.sdb-option-card[data-type="checkbox"] .sdb-option-mark {
	border-radius: 6px;
}
.sdb-option-card.is-selected .sdb-option-mark {
	border-color: var(--sdb-accent);
	background: var(--sdb-accent);
}
.sdb-option-card.is-selected .sdb-option-mark::after {
	content: "";
	position: absolute;
	left: 7px;
	top: 3px;
	width: 5px;
	height: 10px;
	border: solid var(--sdb-accent-ink);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}
.sdb-option-name {
	font-size: 15px;
	color: var(--sdb-ink);
}
.sdb-option-price {
	font-size: 14px;
	font-weight: 500;
	color: var(--sdb-ink-soft);
	white-space: nowrap;
}

/* ---------- Sticky footer ---------- */
.sdb-footer {
	padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--sdb-line);
	background: var(--sdb-bg);
}
.sdb-add-btn {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	border: none;
	border-radius: var(--sdb-radius-card);
	background: var(--sdb-accent);
	color: var(--sdb-accent-ink);
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.18s var(--sdb-ease), transform 0.1s var(--sdb-ease);
}
.sdb-add-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}
.sdb-add-btn:not(:disabled):active {
	transform: scale(0.985);
}
.sdb-add-btn.is-success {
	background: #2e7d32;
}
.sdb-add-price {
	font-variant-numeric: tabular-nums;
}

/* ---------- Loading + error ---------- */
.sdb-loading {
	padding: 48px 20px;
	text-align: center;
	color: var(--sdb-ink-soft);
	font-size: 14px;
}
.sdb-error {
	margin: 12px 20px;
	padding: 12px 14px;
	border-radius: 10px;
	background: #fff3f3;
	color: #c0392b;
	font-size: 14px;
}

html.sdb-lock,
body.sdb-lock {
	overflow: hidden;
}

/* Dropdown group (v1.3.0) */
.sdb-option-select {
	width: 100%;
	padding: 13px 14px;
	border: 1.5px solid var(--sdb-line);
	border-radius: var(--sdb-radius-card);
	font-size: 15px;
	color: var(--sdb-ink);
	background: #fff;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236e6e73' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
}
.sdb-option-select:focus {
	border-color: var(--sdb-accent);
	outline: none;
}

/* Option thumbnail (v1.4.0) */
.sdb-option-thumb {
	width: 44px;
	height: 44px;
	border-radius: 10px;
	object-fit: cover;
	flex-shrink: 0;
	background: #f2f2f4;
}
