/* ==========================================================================
   Marketplace Base Theme — essentials only.
   Visual "sections" (hero, category grid, footer, etc.) bring their own
   scoped styles via snippet shortcodes — this file stays small on purpose.
   ========================================================================== */

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

:root {
	--blue: #0064d2;
	--red: #e53238;
	--yellow: #f5af02;
	--green: #86b817;
	--dark: #1a1a1a;
	--gray-text: #555;
	--gray-bg: #f7f8fa;
	--border: #e5e7eb;
	--radius: 10px;
}

body {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--dark);
	background: #fff;
	line-height: 1.5;
}

.mbt-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.mbt-fullwidth { width: 100%; }
.mbt-page { padding-top: 40px; padding-bottom: 60px; }

/* Buttons (shared vocabulary so snippet sections can reuse these classes) */
.mbt-btn {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 10px 18px; border-radius: 6px; text-decoration: none;
	font-weight: 700; font-size: 14px; cursor: pointer; border: 2px solid transparent;
}
.mbt-btn-primary { background: var(--red); color: #fff; }
.mbt-btn-primary:hover { background: #c92a2f; }
.mbt-btn-outline { background: transparent; color: var(--blue); border-color: var(--blue); }
.mbt-btn-outline:hover { background: var(--blue); color: #fff; }

/* Fallback footer (used only until a [ymb_footer] snippet exists) */
.mbt-fallback-footer { background: var(--dark); color: #ccc; text-align: center; padding: 24px 20px; margin-top: 40px; font-size: 13px; }

/* Card grid — used by taxonomy.php and reusable by any snippet section */
.mbt-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin: 20px 0; }
.mbt-card { display: block; text-decoration: none; color: inherit; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: box-shadow .15s, transform .15s; }
.mbt-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.08); transform: translateY(-2px); }
.mbt-card-img img { width: 100%; height: 160px; object-fit: cover; display: block; }
.mbt-noimg, .mbt-noimg-large { background: var(--gray-bg); color: #999; display: flex; align-items: center; justify-content: center; }
.mbt-noimg { height: 160px; }
.mbt-noimg-large { height: 380px; border-radius: var(--radius); }
.mbt-card-body { padding: 10px 12px; }
.mbt-card-body h4 { margin: 0 0 6px; font-size: 15px; }
.mbt-card-price { color: var(--green); font-weight: 700; margin: 0; }

/* Single listing */
.mbt-breadcrumb { font-size: 13px; color: var(--gray-text); margin-bottom: 20px; }
.mbt-breadcrumb a { color: var(--blue); text-decoration: none; }
.mbt-listing-layout { display: grid; grid-template-columns: 1.7fr 1fr; gap: 36px; align-items: start; }
@media (max-width: 900px) { .mbt-listing-layout { grid-template-columns: 1fr; } }

.mbt-gallery-frame { position: relative; border-radius: 18px; overflow: hidden; background: var(--gray-bg); }
.mbt-gallery img#mbt-gallery-current { width: 100%; height: 420px; object-fit: cover; display: block; }
@media (max-width: 640px) { .mbt-gallery img#mbt-gallery-current { height: 280px; } }
.mbt-gallery-nav {
	position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%;
	background: rgba(255,255,255,.9); border: none; font-size: 22px; line-height: 1; cursor: pointer;
	display: flex; align-items: center; justify-content: center; color: var(--dark); box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.mbt-gallery-prev { left: 14px; }
.mbt-gallery-next { right: 14px; }
.mbt-gallery-counter { position: absolute; right: 14px; bottom: 14px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.mbt-gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mbt-thumb-btn { border: 2px solid transparent; padding: 0; background: none; cursor: pointer; border-radius: 8px; overflow: hidden; }
.mbt-thumb-btn img { width: 64px; height: 64px; object-fit: cover; display: block; }
.mbt-thumb-btn.mbt-thumb-active { border-color: var(--blue); }
.mbt-noimg-large { height: 420px; border-radius: 18px; font-weight: 600; }

.mbt-badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.mbt-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; }
.mbt-badge-cat { background: #eaf2ff; color: #003d99; }
.mbt-badge-condition { background: #e9f9f0; color: #128a45; }

.mbt-listing-title { font-size: 26px; font-weight: 800; margin: 12px 0 10px; line-height: 1.3; }
.mbt-listing-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--gray-text); margin-bottom: 22px; }
.mbt-meta-item { display: flex; align-items: center; gap: 5px; }
.mbt-meta-dot { opacity: .5; }
.mbt-section-heading { font-size: 17px; font-weight: 800; margin: 26px 0 12px; }
.mbt-desc-text { font-size: 14.5px; line-height: 1.7; color: #333; }

.mbt-seller-card, .mbt-safety-tips { background: var(--gray-bg); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; }
.mbt-safety-tips h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 10px; font-size: 14px; font-weight: 800; }
.mbt-safety-tips ul { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--gray-text); line-height: 1.7; }

.mbt-listing-side-sticky { position: sticky; top: 90px; }
@media (max-width: 900px) { .mbt-listing-side-sticky { position: static; } }

/* Pagination */
.page-numbers { display: inline-block; padding: 8px 12px; border: 1px solid var(--border); border-radius: 4px; text-decoration: none; color: var(--dark); margin-right: 6px; }
.page-numbers.current { background: var(--blue); color: #fff; border-color: var(--blue); }

@media (max-width: 700px) {
	.mbt-card-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* ==========================================================================
   HEADER — built directly into the theme (no external snippet dependency).

   THE FIX: previously the icon row (heart, bell, Add button, hamburger)
   had a combined width that could exceed narrow phone screens, pushing
   the hamburger off-canvas entirely. The structural fix: the LOGO is the
   only flexible/shrinking element (it truncates with an ellipsis if
   needed); the ICON ROW is fixed-size and never shrinks or gets pushed
   off — so on any screen width, all icons stay visible and only the
   logo text adapts. This can't overflow regardless of brand name length
   or screen size.
   ========================================================================== */

.mbt-header {
	border-bottom: 1px solid var(--border);
	background: #fff;
	position: sticky;
	top: 0;
	z-index: 999;
}
.mbt-header-row1 {
	max-width: 1200px;
	margin: 0 auto;
	padding: 14px 20px;
	display: flex;
	align-items: center;
	gap: 12px;
}

/* Logo: the ONLY element allowed to shrink/truncate. */
.mbt-logo {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 22px;
	font-weight: 800;
	color: var(--blue);
	text-decoration: none;
}
.mbt-logo img { display: block; height: 40px; width: auto; }
.mbt-logo-accent { color: var(--red); }

/* Desktop nav: fixed size, sits between logo and icons. Hidden on mobile. */
.mbt-nav-desktop { flex: 0 0 auto; }
.mbt-nav-desktop ul { list-style: none; display: flex; gap: 22px; margin: 0; padding: 0; }
.mbt-nav-desktop a { text-decoration: none; font-weight: 600; color: var(--dark); font-size: 15px; }
.mbt-nav-desktop a:hover { color: var(--blue); }

/* Icon row: FIXED size, never shrinks, never wraps, always fully visible. */
.mbt-icon-row {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 16px;
}
.mbt-icon-link { position: relative; color: var(--dark); display: flex; text-decoration: none; flex-shrink: 0; }
.mbt-icon-link svg { width: 22px; height: 22px; }
.mbt-icon-badge {
	position: absolute; top: -6px; right: -8px; background: var(--red); color: #fff;
	font-size: 10px; font-weight: 800; min-width: 16px; height: 16px; border-radius: 8px;
	display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.mbt-add-btn {
	flex-shrink: 0;
	display: inline-flex; align-items: center; gap: 7px;
	background: var(--yellow); color: #1a1a1a; border: none;
	padding: 9px 14px; border-radius: 8px; font-weight: 800; font-size: 13px;
	text-decoration: none; white-space: nowrap;
}
.mbt-add-btn:hover { background: #d99902; }
.mbt-add-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.mbt-login-link { flex-shrink: 0; font-weight: 700; color: var(--blue); text-decoration: none; font-size: 14px; white-space: nowrap; }

/* Row 2 — persistent search, present on every page (not just the homepage
   hero), so buyers can search from anywhere on the site. */
.mbt-header-row2 { max-width: 1200px; margin: 0 auto; padding: 0 20px 12px; display: flex; gap: 10px; align-items: center; }
.mbt-header-search { flex: 1; display: flex; align-items: center; background: var(--gray-bg); border: 1.5px solid transparent; border-radius: 999px; padding: 4px 4px 4px 16px; transition: border-color .15s, background .15s; }
.mbt-header-search:focus-within { background: #fff; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,100,210,.1); }
.mbt-header-search svg { color: var(--gray-text); flex-shrink: 0; }
.mbt-header-search input { flex: 1; border: none; background: none; padding: 10px; font-size: 14.5px; font-family: inherit; outline: none; min-width: 0; color: var(--dark); }
.mbt-header-search button { background: var(--blue); color: #fff; border: none; padding: 10px 22px; border-radius: 999px; font-weight: 700; font-size: 13.5px; cursor: pointer; flex-shrink: 0; }
.mbt-categories-btn { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 999px; border: 1.5px solid var(--border); background: #fff; cursor: pointer; color: var(--dark); text-decoration: none; }
.mbt-categories-btn svg { width: 18px; height: 18px; }

/* At 800px and below: hide the desktop nav + "Log In" text link (the
   bottom tab bar covers navigation on mobile instead). Icon row itself
   keeps the "never overflows" guarantee — the Post Ad button just
   shrinks to an icon-only square rather than disappearing, matching the
   reference design, and gets breathing room from the other icons. */
@media (max-width: 800px) {
	.mbt-nav-desktop { display: none; }
	.mbt-login-link { display: none; }
	.mbt-icon-row { gap: 18px; }
	.mbt-add-btn { width: 40px; height: 40px; padding: 9px; justify-content: center; }
	.mbt-add-text { display: none; }
	body { padding-bottom: 64px; } /* room for the fixed bottom tab bar */
}

/* ==========================================================================
   MOBILE APP-STYLE BOTTOM TAB BAR — replaces the old hamburger/off-canvas
   menu on phones. Everything (Home, Chats, Post Ad, Saved, Account) is one
   thumb-reach away instead of hidden behind a menu button. Desktop keeps
   the top nav instead; this bar only renders under 800px.
   ========================================================================== */
.mbt-bottom-nav { display: none; }
@media (max-width: 800px) {
	.mbt-bottom-nav {
		display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 999;
		background: #fff; border-top: 1px solid var(--border);
		padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
		justify-content: space-around; align-items: flex-end;
	}
	.mbt-bottom-nav-item {
		display: flex; flex-direction: column; align-items: center; gap: 3px;
		text-decoration: none; color: var(--gray-text); font-size: 10.5px; font-weight: 700;
		flex: 1; position: relative; padding-top: 4px;
	}
	.mbt-bottom-nav-item.mbt-bottom-nav-active { color: var(--blue); }
	.mbt-bottom-nav-item svg { width: 21px; height: 21px; }
	.mbt-bottom-nav-badge {
		position: absolute; top: 0; right: 22%; background: var(--red); color: #fff;
		font-size: 9px; font-weight: 800; min-width: 14px; height: 14px; border-radius: 7px;
		display: flex; align-items: center; justify-content: center; padding: 0 3px;
	}
	.mbt-bottom-nav-fab-wrap { flex: 1; display: flex; justify-content: center; }
	.mbt-bottom-nav-fab-wrap a { text-decoration: none; display: flex; flex-direction: column; align-items: center; }
	.mbt-bottom-nav-fab {
		width: 50px; height: 50px; border-radius: 50%; background: var(--yellow); color: #1a1a1a;
		display: flex; align-items: center; justify-content: center; margin-top: -26px;
		box-shadow: 0 6px 16px rgba(245,175,2,.5); border: 4px solid #fff;
	}
	.mbt-bottom-nav-fab svg { width: 22px; height: 22px; }
	.mbt-bottom-nav-fab-label { display: block; text-align: center; font-size: 10.5px; font-weight: 700; color: var(--gray-text); margin-top: 2px; }
}
