/* ===== MOBILE STYLESHEET ============================================
 * Cabaz Natura — mobile entry (mobile.php)
 * Single-file mobile UI built on jQuery + plain JS, sharing the same
 * PHP backend endpoints as the desktop site.
 * ==================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Georgia&display=swap');

:root {
	--m-bg: #faf7f1;
	--m-surface: #ffffff;
	--m-olive: #64692D;
	--m-olive-light: #9CA56D;
	--m-olive-stroke: #717745;
	--m-red: #B84850;
	--m-orange: #D58548;
	--m-text: #333;
	--m-muted: #888;
	--m-divider: rgba(100,105,45,.15);
	--m-tab-h: 64px;
	--m-top-h: 56px;
	--m-radius: 14px;
	--m-radius-sm: 10px;
	--m-shadow: 0 2px 12px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	background: var(--m-bg);
	color: var(--m-text);
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
	font-weight: 300;
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

button { background: none; border: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ===== Top bar ===== */
.m-topbar {
	position: sticky;
	top: 0;
	z-index: 50;
	height: var(--m-top-h);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 14px;
	background: var(--m-bg);
	border-bottom: 1px solid var(--m-divider);
}
.m-icon-btn {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--m-olive);
	font-size: 18px;
	position: relative;
}
.m-logo img { height: 40px; }
.m-topbar-right { display: flex; align-items: center; gap: 6px; }
.m-lang { font-size: 13px; color: var(--m-olive); font-weight: 400; padding: 0 6px; }
.m-badge {
	position: absolute;
	top: 4px;
	right: 4px;
	background: var(--m-red);
	color: white;
	font-size: 10px;
	font-weight: 700;
	min-width: 16px;
	height: 16px;
	border-radius: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
}

/* Top bar removed — hide any legacy markup that might still be served */
.m-topbar { display: none; }

/* ===== Body & screens ===== */
.m-scroll {
	min-height: calc(100vh - var(--m-tab-h));
	padding-bottom: calc(var(--m-tab-h) + 80px);
}
.m-page { padding: 16px; }
.m-page-title {
	font-family: Georgia, serif;
	font-style: italic;
	font-weight: 700;
	font-size: 32px;
	color: var(--m-olive);
	margin: 0 0 6px;
	line-height: 1.1;
}
.m-eyebrow {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 1.6px;
	color: var(--m-red);
	text-transform: uppercase;
	margin: 0 0 10px;
}
.m-page-subtitle {
	color: var(--m-muted);
	font-size: 14px;
	margin: 4px 0 18px;
}

/* ===== Hero (Cabaz screen) — full-bleed logo on top, thin green band with the week below ===== */
.m-hero {
	display: flex;
	flex-direction: column;
	/* Bleed edge-to-edge inside .m-page (which has 16px padding on top+sides).
	 * Negative top margin cancels the parent's top padding too. */
	margin: -16px -16px 14px;
	color: var(--m-olive);
	background: transparent;
	overflow: hidden;
}
.m-hero-icon {
	background: var(--m-bg);
	/* Zero top padding — the SVG artwork already carries its own
	 * whitespace above the wordmark. */
	padding: 0 16px;
	text-align: center;
}
.m-hero-icon img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
}
.m-hero-band {
	background: linear-gradient(135deg, #e8e6cf 0%, #d4d8b3 100%);
	padding: 10px 16px;
	text-align: center;
}
.m-hero-week {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 1.6px;
	color: var(--m-red);
	text-transform: uppercase;
	margin: 0;
}
.m-hero-text {
	font-size: 14px;
	color: var(--m-text);
	margin-bottom: 14px;
	max-width: 28em;
}
.m-cta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--m-red);
	color: white;
	padding: 10px 18px;
	border-radius: 24px;
	font-size: 14px;
	font-weight: 600;
}
.m-cta i { font-size: 12px; }

/* ===== Category chips ===== */
.m-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 4px 0;
	margin: 0 0 14px;
}
.m-chip {
	border: 1px solid var(--m-olive);
	border-radius: 20px;
	padding: 6px 14px;
	font-size: 13px;
	color: var(--m-olive);
	white-space: nowrap;
	background: transparent;
}
.m-chip.active {
	background: var(--m-olive);
	color: white;
}

/* ===== Product list — 2 per row, ~92px tall.
 * Grid areas: photo on the left (spans both rows),
 * name+price top-right, stepper bottom-right. ===== */
.m-products {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}
.m-product {
	display: grid;
	grid-template-columns: 56px 1fr;
	grid-template-rows: 1fr auto;
	grid-template-areas:
		"img body"
		"img stepper";
	align-items: center;
	gap: 4px 8px;
	padding: 8px 8px;
	background: var(--m-surface);
	border-radius: var(--m-radius-sm);
	box-shadow: var(--m-shadow);
	min-height: 92px;
	min-width: 0;
}
.m-product-body { grid-area: body; min-width: 0; align-self: end; }
.m-product > .m-stepper { grid-area: stepper; justify-self: end; }
.m-product-img {
	grid-area: img;
	width: 56px;
	height: 56px;
	background: #f3efe6;
	border-radius: 10px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	align-self: center;
}
.m-product-img img { width: 100%; height: 100%; object-fit: cover; }
.m-product-name {
	font-size: 13px;
	font-weight: 500;
	color: var(--m-olive);
	margin: 0 0 1px;
	line-height: 1.2;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	word-break: break-word;
}
.m-product-price {
	font-size: 12px;
	color: var(--m-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Keep basket sheet items horizontal (they use .m-basket-item, not .m-product) */
.m-basket-item .m-product-body { flex: 1; }
.m-basket-item .m-product-name { -webkit-line-clamp: initial; overflow: visible; display: block; }
.m-basket-item .m-product-img { flex: 0 0 44px; }
.m-stepper {
	display: inline-flex;
	align-items: center;
	gap: 1px;
	background: #f6f2ea;
	border-radius: 20px;
	padding: 2px;
}
.m-stepper button {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: white;
	font-size: 13px;
	font-weight: 600;
	color: var(--m-olive);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.m-stepper input {
	width: 32px;
	text-align: center;
	border: none;
	background: transparent;
	font-size: 11px;
	font-weight: 600;
	color: var(--m-olive);
	-moz-appearance: textfield;
	padding: 0;
}
/* Basket sheet keeps the larger, roomier stepper */
.m-basket-item .m-stepper { gap: 4px; }
.m-basket-item .m-stepper button { width: 28px; height: 28px; font-size: 16px; }
.m-basket-item .m-stepper input { width: 30px; font-size: 14px; }
.m-stepper input::-webkit-outer-spin-button,
.m-stepper input::-webkit-inner-spin-button {
	-webkit-appearance: none; margin: 0;
}

/* ===== FAB ===== */
.m-fab {
	position: fixed;
	right: 16px;
	bottom: calc(var(--m-tab-h) + 12px);
	z-index: 40;
	background: var(--m-olive);
	color: white;
	border-radius: 24px;
	padding: 10px 16px 10px 12px;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	box-shadow: 0 6px 18px rgba(100,105,45,.35);
	transition: transform .2s, opacity .2s;
}
.m-fab[hidden] { display: none; }
.m-fab-ico {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: rgba(255,255,255,.18);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
}
.m-fab-label { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.m-fab-small { font-size: 10px; opacity: .85; text-transform: uppercase; letter-spacing: 1px; }
.m-fab-big { font-size: 13px; font-weight: 600; }

/* ===== Bottom tab bar ===== */
.m-tabbar {
	position: fixed;
	left: 0; right: 0; bottom: 0;
	z-index: 50;
	height: var(--m-tab-h);
	background: var(--m-surface);
	border-top: 1px solid var(--m-divider);
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	padding-bottom: env(safe-area-inset-bottom);
}
.m-tab {
	/* Grid with a FIXED icon row + flexible label row. Guarantees every
	 * icon sits at the same y regardless of how many lines the label
	 * wraps to. */
	display: grid;
	grid-template-rows: 20px auto;
	justify-items: center;
	align-items: center;
	gap: 4px;
	font-size: 10px;
	line-height: 1.1;
	color: var(--m-muted);
	position: relative;
	text-align: center;
	padding: 8px 2px 0;
}
.m-tab i {
	display: block;
	font-size: 16px;
	line-height: 1;
}
.m-tab span { display: block; align-self: start; }
.m-tab.active { color: var(--m-olive); }
.m-tab.active::before {
	content: '';
	position: absolute;
	top: 6px;
	width: 4px; height: 4px;
	border-radius: 50%;
	background: var(--m-olive);
}

/* ===== Sheet (modal) ===== */
.m-sheet-backdrop {
	position: fixed;
	inset: 0;
	z-index: 90;
	background: rgba(0,0,0,.4);
	opacity: 0;
	transition: opacity .25s;
}
.m-sheet-backdrop.show { opacity: 1; }
.m-sheet-backdrop[hidden] { display: none; }
.m-sheet {
	position: fixed;
	left: 0; right: 0; bottom: 0;
	z-index: 100;
	background: var(--m-bg);
	border-radius: 18px 18px 0 0;
	max-height: 85vh;
	display: flex;
	flex-direction: column;
	transform: translateY(100%);
	transition: transform .3s ease-out;
	padding-bottom: env(safe-area-inset-bottom);
}
.m-sheet.show { transform: translateY(0); }
.m-sheet[hidden] { display: none; }
.m-sheet-grabber {
	width: 40px;
	height: 4px;
	background: rgba(0,0,0,.18);
	border-radius: 2px;
	margin: 8px auto 0;
}
.m-sheet-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 18px 8px;
}
.m-sheet-title {
	font-family: Georgia, serif;
	font-style: italic;
	font-size: 22px;
	color: var(--m-olive);
	margin: 0;
}
.m-sheet-close {
	font-size: 24px;
	color: var(--m-muted);
	width: 32px;
	height: 32px;
	border-radius: 50%;
}
.m-sheet-body {
	flex: 1;
	overflow-y: auto;
	padding: 6px 18px 20px;
}

/* ===== Cards (used by static pages, account, basket items) ===== */
.m-card {
	background: var(--m-surface);
	border: 1px solid var(--m-orange);
	border-radius: var(--m-radius-sm);
	padding: 14px 16px;
	margin-bottom: 12px;
}
.m-card-title {
	font-size: 14px;
	font-weight: 700;
	color: var(--m-olive);
	margin: 0 0 6px;
}
.m-card-text { font-size: 14px; color: var(--m-text); }

/* ===== Como Funciona steps ===== */
.m-step {
	display: flex;
	gap: 14px;
	background: var(--m-surface);
	border: 1px solid var(--m-orange);
	border-radius: var(--m-radius-sm);
	padding: 14px;
	margin-bottom: 12px;
}
.m-step-num {
	font-family: Georgia, serif;
	font-style: italic;
	font-size: 22px;
	color: var(--m-red);
	font-weight: 700;
	min-width: 32px;
}
.m-step-body { flex: 1; }
.m-step-title {
	font-size: 14px;
	font-weight: 700;
	color: var(--m-olive);
	margin: 0 0 4px;
}
.m-step-text { font-size: 13px; color: var(--m-text); margin: 0; }

/* ===== Forms (login, billing) ===== */
.m-form { display: flex; flex-direction: column; gap: 12px; }
.m-field { display: flex; flex-direction: column; gap: 4px; }
.m-field label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 1px;
	color: var(--m-olive);
	text-transform: uppercase;
}
.m-field input, .m-field textarea {
	font-family: inherit;
	font-size: 15px;
	padding: 12px 14px;
	border-radius: 10px;
	border: 1px solid var(--m-divider);
	background: var(--m-surface);
	width: 100%;
}
.m-field input:focus, .m-field textarea:focus {
	outline: none;
	border-color: var(--m-olive);
}
.m-btn-primary {
	background: var(--m-olive);
	color: white;
	padding: 14px;
	border-radius: 10px;
	font-weight: 700;
	font-size: 14px;
	letter-spacing: .5px;
	text-transform: uppercase;
	width: 100%;
	margin-top: 6px;
}
.m-btn-secondary {
	background: var(--m-surface);
	color: var(--m-olive);
	padding: 12px;
	border: 1px solid var(--m-olive);
	border-radius: 10px;
	font-weight: 600;
	font-size: 14px;
	width: 100%;
}
.m-btn-danger {
	background: var(--m-red);
	color: white;
	padding: 14px;
	border-radius: 10px;
	font-weight: 700;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: .5px;
	width: 100%;
}

/* ===== Basket sheet items ===== */
.m-basket-items { display: flex; flex-direction: column; gap: 10px; }
.m-basket-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px;
	background: var(--m-surface);
	border-radius: var(--m-radius-sm);
	border: 1px solid var(--m-divider);
}
.m-basket-remove {
	color: var(--m-red);
	font-size: 18px;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 1px solid var(--m-red);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.m-basket-totals {
	margin: 14px 0 12px;
	border-top: 1px solid var(--m-divider);
	padding-top: 12px;
}
.m-total-row {
	display: flex;
	justify-content: space-between;
	font-size: 13px;
	margin-bottom: 4px;
	color: var(--m-text);
}
.m-total-row.grand {
	font-weight: 700;
	font-size: 16px;
	color: var(--m-olive);
	margin-top: 8px;
}
.m-basket-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 14px;
}

/* ===== Basket extras: closed banner, voucher, invalid message ===== */
.m-closed-banner {
	background: #f8d7da;
	color: #7a1d24;
	border-radius: var(--m-radius-sm);
	padding: 12px 14px;
	margin-bottom: 14px;
	font-size: 14px;
	font-weight: 500;
}
.m-invalid-msg {
	background: #fff4d6;
	border-left: 3px solid var(--m-orange);
	color: #6b4a10;
	border-radius: var(--m-radius-sm);
	padding: 12px 14px;
	margin: 10px 0;
	font-size: 13px;
	line-height: 1.45;
}
.m-invalid-msg div { margin-top: 4px; }
.m-total-row.grand {
	border-top: 1px solid var(--m-divider);
	padding-top: 8px;
	margin-top: 8px;
}
.m-voucher {
	color: var(--m-red);
	font-style: italic;
	font-size: 11px;
}
.m-total-row.m-voucher span:last-child { color: var(--m-red); }

/* ===== Product detail sheet ===== */
.m-detail-head {
	display: flex;
	gap: 12px;
	align-items: center;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--m-divider);
	margin-bottom: 10px;
}
.m-detail-head img {
	width: 64px;
	height: 64px;
	border-radius: var(--m-radius-sm);
	object-fit: cover;
}
.m-detail-body {
	font-size: 14px;
	line-height: 1.5;
	color: var(--m-text);
}
.m-detail-body p { margin: 0 0 8px; }

/* Product card image / body clickable */
#m-products [data-detail="1"] { cursor: pointer; }

/* "Ver versão desktop" — subtle bottom link on every screen */
.m-view-toggle {
	text-align: center;
	padding: 20px 0 8px;
	font-size: 12px;
	color: var(--m-muted);
}
.m-view-toggle a {
	color: var(--m-olive);
	text-decoration: underline;
}

/* ===== Loading ===== */
.m-loading {
	text-align: center;
	color: var(--m-muted);
	padding: 40px 0;
	font-size: 14px;
}

/* ===== Payment options ===== */
.m-payment-opts { display: flex; flex-direction: column; gap: 8px; }
.m-pay-opt {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #f6f2ea;
	padding: 12px 14px;
	border-radius: 10px;
	font-size: 14px;
	color: var(--m-olive);
	cursor: pointer;
}
.m-pay-opt input[type="radio"] { accent-color: var(--m-red); }


/* ===== Order list (account) ===== */
.m-order {
	background: var(--m-surface);
	border: 1px solid var(--m-divider);
	border-radius: var(--m-radius-sm);
	padding: 12px 14px;
	margin-bottom: 8px;
}
.m-order-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 14px;
}
.m-order-date { color: var(--m-muted); font-size: 12px; }
.m-order-id { font-weight: 600; color: var(--m-olive); }
.m-order-total { font-weight: 700; color: var(--m-olive); }
.m-order-detail {
	display: none;
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid var(--m-divider);
	font-size: 13px;
}
.m-order-detail.open { display: block; }
.m-order-detail .item {
	display: flex;
	justify-content: space-between;
	color: var(--m-red);
	padding: 3px 0;
}
