*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
	--primary:   #4A1594;
	--primary-d: #3a1070;
	--primary-l: #f3eeff;
	--white:     #ffffff;
	--text:      #1a1a2e;
	--sub:       #6b7280;
	--border:    #e5e7eb;
	--card-bg:   #f9f9fb;
	--radius:    14px;
	--shadow:    0 2px 12px rgba(74,21,148,.10);
}

html, body {
	height: 100%;
	background: #ede9f8;
	font-family: 'Inter', sans-serif;
	color: var(--text);
	-webkit-tap-highlight-color: transparent;
}

/* ── App Shell ──────────────────────────────────────────── */
#app {
	max-width: 480px;
	margin: 0 auto;
	min-height: 100vh;
	background: var(--white);
	position: relative;
}

@media (min-width: 768px) {
	#app { max-width: 70vw; box-shadow: 0 0 60px rgba(74,21,148,.12); }
}

@media (min-width: 1200px) {
	#app { max-width: 900px; }
}

/* ── Navbar ─────────────────────────────────────────────── */
#navbar {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--primary);
	padding: 10px 14px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.nav-brand {
	font-size: 18px;
	font-weight: 800;
	color: #fff;
	letter-spacing: -0.5px;
	white-space: nowrap;
	flex-shrink: 0;
}

.nav-location {
	display: flex;
	align-items: center;
	gap: 4px;
	cursor: pointer;
	background: rgba(255,255,255,0.15);
	border-radius: 20px;
	padding: 5px 10px;
	min-width: 0;
	flex-shrink: 1;
	overflow: hidden;
	transition: background .2s;
	border: none;
}

.nav-location:active { background: rgba(255,255,255,0.25); }
.nav-location svg    { flex-shrink: 0; }

.nav-loc-text {
	font-size: 11px;
	color: rgba(255,255,255,0.9);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 90px;
}

.nav-right {
	display: flex;
	align-items: center;
	gap: 7px;
	margin-left: auto;
	flex-shrink: 0;
}


.nav-icon-btn {
	position: relative;
	background: rgba(255,255,255,0.18);
	border: none;
	border-radius: 50%;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: #fff;
	text-decoration: none;
	flex-shrink: 0;
}

.cart-badge {
	position: absolute;
	top: -3px;
	right: -3px;
	background: #ff3b3b;
	color: #fff;
	font-size: 9px;
	font-weight: 700;
	border-radius: 50%;
	width: 16px;
	height: 16px;
	display: none;
	align-items: center;
	justify-content: center;
}

.nav-login-btn {
	background: #fff;
	color: var(--primary);
	border: none;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 700;
	padding: 5px 12px;
	cursor: pointer;
	white-space: nowrap;
	text-decoration: none;
	flex-shrink: 0;
}

/* ── Language selector ──────────────────────────────────── */
.nav-lang {
	position: relative;
	flex-shrink: 0;
}

.nav-lang-btn {
	display:      flex;
	align-items:  center;
	gap:          4px;
	background:   rgba(255,255,255,0.18);
	border-radius:20px;
	padding:      6px 10px;
	border:       none;
	cursor:       pointer;
	color:        rgba(255,255,255,0.9);
	font-size:    11px;
	font-weight:  700;
	font-family:  'Inter', sans-serif;
	transition:   background .15s;
	white-space:  nowrap;
}
.nav-lang-btn:hover { background: rgba(255,255,255,0.28); }

.lang-chev {
	transition: transform .2s;
}
.nav-lang.open .lang-chev {
	transform: rotate(180deg);
}

.lang-menu {
	position:      absolute;
	top:           calc(100% + 8px);
	right:         0;
	background:    #fff;
	border-radius: 14px;
	box-shadow:    0 8px 32px rgba(0,0,0,.18);
	overflow:      hidden;
	min-width:     160px;
	z-index:       300;
	display:       none;
	animation:     langFadeIn .15s ease;
}
[dir="rtl"] .lang-menu { right: auto; left: 0; }

.nav-lang.open .lang-menu { display: block; }

@keyframes langFadeIn {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.lang-opt {
	display:     flex;
	align-items: center;
	gap:         10px;
	padding:     12px 16px;
	font-size:   14px;
	font-weight: 500;
	color:       #374151;
	text-decoration: none;
	transition:  background .12s;
	border-bottom: 1px solid #f5f5f5;
}
.lang-opt:last-child { border-bottom: none; }
.lang-opt:hover    { background: #f9f7ff; }
.lang-opt.active   { color: #4A1594; font-weight: 700; background: #f3edff; }

.lang-flag { font-size: 18px; line-height: 1; }

/* ── Location Dialog ────────────────────────────────────── */
#loc-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999;
	background: rgba(0,0,0,0.55);
	align-items: center;
	justify-content: center;
	padding: 20px;
}

#loc-overlay.open { display: flex; }

.loc-dialog {
	background: #fff;
	width: 100%;
	max-width: 400px;
	border-radius: 20px;
	padding: 28px 24px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.25);
	animation: popIn .25s ease;
}

@keyframes popIn {
	from { transform: scale(0.92); opacity: 0; }
	to   { transform: scale(1);    opacity: 1; }
}

.loc-icon-wrap {
	width: 58px;
	height: 58px;
	background: var(--primary-l);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 14px;
}

.loc-dialog h3 {
	text-align: center;
	font-size: 17px;
	font-weight: 700;
	margin-bottom: 5px;
	color: var(--text);
}

.loc-sub {
	text-align: center;
	font-size: 12px;
	color: var(--sub);
	margin-bottom: 20px;
	line-height: 1.5;
}

.loc-search-wrap {
	position: relative;
	margin-bottom: 12px;
}

.loc-search-wrap svg {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
}

#place-input {
	width: 100%;
	padding: 11px 12px 11px 38px;
	border: 1.5px solid var(--border);
	border-radius: 12px;
	font-size: 13px;
	font-family: 'Inter', sans-serif;
	outline: none;
	color: var(--text);
	transition: border-color .2s;
}

#place-input:focus         { border-color: var(--primary); }
#place-input::placeholder  { color: #aaa; }

.loc-divider {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
	color: var(--sub);
	font-size: 11px;
}

.loc-divider::before,
.loc-divider::after {
	content: '';
	flex: 1;
	height: 1px;
	background: var(--border);
}

.loc-btn-gps {
	width: 100%;
	background: var(--primary);
	color: #fff;
	border: none;
	border-radius: 12px;
	padding: 13px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-family: 'Inter', sans-serif;
	transition: background .2s;
}

.loc-btn-gps:hover:not(:disabled) { background: var(--primary-d); }
.loc-btn-gps:disabled              { opacity: 0.55; cursor: not-allowed; }

.loc-err {
	font-size: 11px;
	color: #dc2626;
	text-align: center;
	margin-top: 10px;
	line-height: 1.4;
	display: none;
}

/* ── Search Modal ───────────────────────────────────────── */
#search-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 998;
	background: var(--white);
	flex-direction: column;
}

#search-modal.open { display: flex; }

.search-modal-header {
	background: var(--primary);
	padding: 12px 14px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.search-modal-back {
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 4px;
	display: flex;
}

.search-modal-input {
	flex: 1;
	background: rgba(255,255,255,0.2);
	border: none;
	border-radius: 10px;
	padding: 9px 14px;
	color: #fff;
	font-size: 14px;
	font-family: 'Inter', sans-serif;
	outline: none;
}

.search-modal-input::placeholder { color: rgba(255,255,255,0.55); }

#search-results { flex: 1; overflow-y: auto; padding: 16px; }

.search-empty {
	color: #9ca3af;
	font-size: 13px;
	text-align: center;
	margin-top: 40px;
}

/* ── Skeleton ────────────────────────────────────────────── */
.sk {
	background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
	background-size: 200% 100%;
	animation: shimmer 1.5s infinite;
	border-radius: 10px;
}

@keyframes shimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* ── Content ─────────────────────────────────────────────── */
#content { padding-bottom: 30px; }

/* hidden until JS confirms location is set */
#banners-section,
#cates-section,
#trending-section,
#stores-section { display: none; }

.section { padding: 20px 16px 0; }

.section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.section-title { font-size: 15px; font-weight: 700; }

/* ── Inline Search Bar ───────────────────────────────────── */
.inline-search {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 14px 16px 0;
	background: #f3f4f6;
	border-radius: 50px;
	padding: 12px 18px;
	cursor: pointer;
	border: 1.5px solid var(--border);
	color: #9ca3af;
	font-size: 14px;
	font-family: 'Inter', sans-serif;
	transition: background .15s, border-color .15s;
	user-select: none;
}

.inline-search:hover    { background: var(--primary-l); border-color: var(--primary); }
.inline-search span     { color: #9ca3af; flex: 1; }

/* ── Banners ─────────────────────────────────────────────── */
.banner-section-wrap { padding: 14px 0 0; }

.banners-wrap {
	display: flex;
	gap: 12px;
	overflow-x: auto;
	padding: 0 16px 6px;
	scroll-snap-type: x mandatory;
	scroll-padding-left: 16px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	user-select: none;
}

.banners-wrap::-webkit-scrollbar { display: none; }

.banner-card {
	flex-shrink: 0;
	width: 78%;
	aspect-ratio: 16/9;
	border-radius: 14px;
	overflow: hidden;
	background: #e5e7eb;
	scroll-snap-align: start;
}

.banner-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Categories ──────────────────────────────────────────── */
.cate-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
}

.cate-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	cursor: pointer;
}

.cate-thumb {
	width: 100%;
	aspect-ratio: 1;
	border-radius: 12px;
	object-fit: cover;
	border: 2.5px solid transparent;
	transition: border-color .2s;
}

.cate-thumb-empty {
	width: 100%;
	aspect-ratio: 1;
	border-radius: 12px;
	background: var(--primary-l);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	border: 2.5px solid transparent;
	transition: border-color .2s;
}

.cate-name {
	font-size: 10px;
	font-weight: 500;
	text-align: center;
	color: var(--text);
	line-height: 1.3;
}

.cate-item.active .cate-thumb,
.cate-item.active .cate-thumb-empty { border-color: var(--primary); }
.cate-item.active .cate-name        { color: var(--primary); font-weight: 700; }

.cate-sk { aspect-ratio: 1; border-radius: 12px; }

/* ── Trending (horizontal scroll cards) ──────────────────── */
.store-scroll {
	display: flex;
	gap: 12px;
	overflow-x: auto;
	padding: 0 16px 6px;
	scroll-padding-left: 16px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	user-select: none;
}

.store-scroll::-webkit-scrollbar { display: none; }

.store-card-sm {
	flex-shrink: 0;
	width: 165px;
	background: var(--card-bg);
	border-radius: var(--radius);
	overflow: hidden;
	cursor: pointer;
	text-decoration: none;
	box-shadow: var(--shadow);
	display: block;
}

.store-card-sm .sc-img {
	width: 100%;
	height: 100px;
	object-fit: cover;
	display: block;
	background: var(--primary-l);
}

.store-card-sm .sc-img-empty {
	width: 100%;
	height: 100px;
	background: var(--primary-l);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 32px;
}

.store-card-sm .sc-info { padding: 8px 10px 10px; }

.store-card-sm .sc-name {
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--text);
}

.store-card-sm .sc-meta {
	font-size: 11px;
	color: var(--sub);
	margin-top: 3px;
	display: flex;
	gap: 5px;
	align-items: center;
}

.sc-star { color: #f59e0b; font-weight: 600; }

/* ── All Stores (list) ───────────────────────────────────── */
.store-list { display: flex; flex-direction: column; gap: 10px; }

.store-card {
	display: flex;
	gap: 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	cursor: pointer;
	text-decoration: none;
	padding: 12px;
	align-items: center;
	transition: box-shadow .2s;
}

.store-card:active { box-shadow: var(--shadow); }

.store-thumb {
	width: 70px;
	height: 70px;
	border-radius: 10px;
	object-fit: cover;
	flex-shrink: 0;
	background: var(--primary-l);
}

.store-thumb-empty {
	width: 70px;
	height: 70px;
	border-radius: 10px;
	background: var(--primary-l);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 26px;
	flex-shrink: 0;
}

.store-info  { flex: 1; min-width: 0; }

.store-name {
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: var(--text);
}

.store-addr {
	font-size: 11px;
	color: var(--sub);
	margin-top: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.store-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }

.store-tag {
	font-size: 10px;
	background: var(--primary-l);
	color: var(--primary);
	border-radius: 20px;
	padding: 2px 7px;
	font-weight: 500;
}

.store-meta  { display: flex; gap: 8px; align-items: center; margin-top: 6px; }

.store-stat  { font-size: 11px; color: var(--sub); display: flex; align-items: center; gap: 2px; }
.store-stat .star { color: #f59e0b; }

.store-sk { height: 94px; border-radius: var(--radius); }

/* ── No location state ───────────────────────────────────── */
#no-location { padding: 60px 24px; text-align: center; display: none; }
#no-location svg   { margin-bottom: 14px; opacity: .8; }
#no-location h3    { font-size: 18px; font-weight: 700; margin-bottom: 7px; }
#no-location p     { font-size: 13px; color: var(--sub); margin-bottom: 18px; line-height: 1.5; }

.set-loc-btn {
	display: inline-block;
	background: var(--primary);
	color: #fff;
	border: none;
	border-radius: 12px;
	padding: 12px 28px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	font-family: 'Inter', sans-serif;
}

/* ── Misc ────────────────────────────────────────────────── */
.no-stores { text-align: center; padding: 36px 20px; color: var(--sub); font-size: 13px; }

.loader { display: flex; justify-content: center; padding: 28px; }

.spinner {
	width: 30px;
	height: 30px;
	border: 3px solid var(--primary-l);
	border-top-color: var(--primary);
	border-radius: 50%;
	animation: spin .7s linear infinite;
}

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

/* ── Skeleton size helpers ───────────────────────────────── */
.banner-sk-item {
	flex-shrink: 0;
	width: 78%;
	aspect-ratio: 16/9;
	border-radius: 14px;
}

.trend-sk-item {
	flex-shrink: 0;
	width: 165px;
	height: 148px;
	border-radius: 14px;
}

/* ── Google Places dropdown style fix ───────────────────── */
.pac-container {
	z-index: 9999 !important;
	font-family: 'Inter', sans-serif !important;
	border-radius: 10px !important;
	border: 1px solid #e5e7eb !important;
	box-shadow: 0 8px 24px rgba(0,0,0,.12) !important;
	margin-top: 4px !important;
}

.pac-item { padding: 10px 14px !important; font-size: 13px !important; cursor: pointer !important; }
.pac-item:hover { background: #f3eeff !important; }
.pac-item-query { color: #1a1a2e !important; font-weight: 600 !important; }

/* ── Desktop overrides (768px+) ─────────────────────────── */
@media (min-width: 768px) {

	/* Section spacing — breathable on desktop */
	.section          { padding: 36px 24px 0; }
	.section-header   { margin-bottom: 20px; }
	.banner-section-wrap { margin: 20px 0; }

	/* Banners — 2 visible at a time, horizontal scroll */
	.banner-card,
	.banner-sk-item { width: calc(50% - 6px); }

	/* Drag-to-scroll cursors */
	.banners-wrap             { cursor: grab; }
	.banners-wrap.is-dragging { cursor: grabbing; }
	.store-scroll             { cursor: grab; }
	.store-scroll.is-dragging { cursor: grabbing; }

	/* Section titles — bigger */
	.section-title            { font-size: 20px; font-weight: 800; }

	/* Category section title — bigger still */
	#cates-section .section-title { font-size: 26px; }

	/* Category item name — bigger on desktop */
	.cate-name { font-size: 13px; font-weight: 600; }

	/* All Stores — 2 per row */
	.store-list {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 16px;
	}

	/* Store card — vertical card layout (image top, info below) */
	.store-card {
		flex-direction: column;
		align-items: flex-start;
		padding: 0;
		overflow: hidden;
	}

	.store-thumb {
		width: 100%;
		height: 180px;
		border-radius: 0;
	}

	.store-thumb-empty {
		width: 100%;
		height: 180px;
		border-radius: 0;
		font-size: 40px;
	}

	.store-info {
		padding: 14px;
		width: 100%;
	}

	.store-name { font-size: 17px; }
	.store-addr { font-size: 13px; margin-top: 4px; }
	.store-tags { margin-top: 8px; }
	.store-tag  { font-size: 12px; padding: 3px 9px; }
	.store-meta { margin-top: 10px; gap: 12px; }
	.store-stat { font-size: 13px; }

	/* Skeleton — taller to match vertical card */
	.store-sk { height: 260px; }
}
