/* ============================================================
   MELNO PUBLIC THEME — Vazirmatn · Dark/Light · Mobile-first
   ============================================================ */

/* ---------- Vazirmatn ---------- */
@font-face { font-family: 'Vazirmatn'; font-style: normal; font-weight: 300; font-display: swap; src: url('../fonts/vazirmatn/Vazirmatn-Light.woff2') format('woff2'); }
@font-face { font-family: 'Vazirmatn'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/vazirmatn/Vazirmatn-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Vazirmatn'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/vazirmatn/Vazirmatn-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Vazirmatn'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/vazirmatn/Vazirmatn-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'Vazirmatn'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/vazirmatn/Vazirmatn-Bold.woff2') format('woff2'); }
@font-face { font-family: 'Vazirmatn'; font-style: normal; font-weight: 900; font-display: swap; src: url('../fonts/vazirmatn/Vazirmatn-Black.woff2') format('woff2'); }

/* ---------- Tokens (dark default) ---------- */
:root {
	--brand:        #0ea5a4;   /* teal-600 */
	--brand-strong: #0d9494;
	--brand-soft:   rgba(14, 165, 164, 0.14);
	--brand-ring:   rgba(14, 165, 164, 0.28);
	--danger:       #ef5350;
	--warn:         #f4a261;

	--bg:           #0a0f16;
	--bg-2:         #0e141d;
	--surface:      #121a26;
	--surface-2:    #16202e;
	--surface-3:    #1b2735;
	--line:         #1f2b3a;
	--line-2:       #2b3a4d;
	--text:         #e8eef6;
	--text-2:       #9db0c3;
	--text-3:       #66788c;
	--shadow-lg:    0 18px 44px rgba(2, 6, 12, 0.5);
	--shadow-md:    0 8px 22px rgba(2, 6, 12, 0.35);
	--shadow-sm:    0 2px 10px rgba(2, 6, 12, 0.3);
	--nav-h:        64px;
	--font: 'Vazirmatn', Tahoma, Arial, sans-serif;
}

[data-theme='light'] {
	--bg:        #f2f5f9;
	--bg-2:      #e9eef4;
	--surface:   #ffffff;
	--surface-2: #f6f8fb;
	--surface-3: #eef2f7;
	--line:      #e2e8f0;
	--line-2:    #cdd8e4;
	--text:      #101826;
	--text-2:    #4b5c70;
	--text-3:    #8595a8;
	--shadow-lg: 0 18px 44px rgba(15, 40, 70, 0.14);
	--shadow-md: 0 8px 22px rgba(15, 40, 70, 0.1);
	--shadow-sm: 0 2px 10px rgba(15, 40, 70, 0.08);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { overflow-x: clip; }
body {
	font-family: var(--font) !important;
	background: var(--bg);
	color: var(--text-2);
	line-height: 1.75;
	font-size: 14.5px;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	transition: background-color .3s ease, color .3s ease;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: var(--text); }
h1, h2, h3, h4 { color: var(--text); line-height: 1.45; }
::selection { background: var(--brand-soft); color: var(--text); }

.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 768px) { .container { padding-inline: 24px; } }

/* ---------- Header / Navbar ---------- */
.site-header {
	position: sticky; top: 0; z-index: 1000;
	background: color-mix(in srgb, var(--bg) 82%, transparent);
	-webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
	border-bottom: 1px solid var(--line);
}
.site-header .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--nav-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.15rem; color: var(--text); }
.brand .logo-mark {
	width: 40px; height: 40px; border-radius: 12px; flex: none;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--brand-soft);
	color: var(--brand);
	overflow: hidden;
	box-shadow: 0 4px 14px var(--brand-ring);
}
.brand .logo-mark img { width: 30px; height: 30px; object-fit: contain; display: block; }
[data-theme='light'] .brand .logo-mark { background: #ffffff; color: #0f1720; }
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.15; text-align: right; }
.brand .brand-text .bt-name { font-weight: 900; font-size: 1.05rem; color: var(--text); }
.brand .brand-text .bt-tag { font-weight: 500; color: var(--text-3); font-size: .72rem; white-space: nowrap; }
.brand small { font-weight: 500; color: var(--text-3); font-size: .72rem; display: block; line-height: 1.2; }

.header-links { display: none; align-items: center; gap: 4px; }
.header-links > a {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 9px 14px; border-radius: 10px;
	color: var(--text-2); font-weight: 500; font-size: .93rem;
	transition: color .2s, background-color .2s;
}
.header-links > a i { font-size: 1rem; color: var(--text-3); transition: color .2s; }
.header-links > a:hover { color: var(--text); background: var(--surface-2); }
.header-links > a.active { color: var(--brand); background: var(--brand-soft); }
.header-links > a.active i { color: var(--brand); }

.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
	width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line);
	background: var(--surface-2); color: var(--text-2); cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem;
	transition: all .2s ease;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand-ring); background: var(--brand-soft); }

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
	font-weight: 700; font-size: .92rem; cursor: pointer; line-height: 1.4;
	transition: all .2s ease; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px var(--brand-ring); }
.btn-primary:hover { background: var(--brand-strong); transform: translateY(-1px); }
.btn-ghost { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--line-2); background: var(--surface-3); }
.btn-danger-ghost { background: transparent; border-color: rgba(239, 83, 80, .35); color: var(--danger); }
.btn-danger-ghost:hover { background: rgba(239, 83, 80, .1); }
.btn-block { width: 100%; }

/* ---------- Mobile bottom navigation ---------- */
.bottom-nav {
	position: fixed; bottom: 0; left: 0; right: 0; z-index: 1100;
	display: grid; grid-template-columns: repeat(4, 1fr);
	background: color-mix(in srgb, var(--bg) 92%, transparent);
	-webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
	border-top: 1px solid var(--line);
	padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
	display: flex; flex-direction: column; align-items: center; gap: 3px;
	padding: 6px 2px; border-radius: 12px;
	color: var(--text-3); font-size: .68rem; font-weight: 600;
	transition: color .2s;
}
.bottom-nav a i { font-size: 1.25rem; line-height: 1; }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav a.nav-cta { color: #fff; }
.bottom-nav a.nav-cta .bn-icon {
	width: 44px; height: 44px; margin-top: -18px; border-radius: 50%;
	background: linear-gradient(135deg, var(--brand), #22d3ee);
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 6px 18px var(--brand-ring); font-size: 1.2rem;
	border: 4px solid var(--bg);
}
@media (max-width: 991px) { body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); } }
@media (min-width: 992px) { .bottom-nav { display: none; } }

/* Hide the header auth buttons (ثبت آگهی / ورود / حساب من) on mobile; keep only the theme toggle. */
@media (max-width: 991px) { .header-auth-btns { display: none; } }

/* ---------- Page header ---------- */
.page-head { padding: 28px 0 20px; }
.page-head h1 { font-size: 1.55rem; font-weight: 900; letter-spacing: -.3px; }
.page-head p { color: var(--text-3); font-size: .95rem; margin-top: 2px; }

/* ---------- Chips / badges ---------- */
.chip {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 4px 11px; border-radius: 999px;
	font-size: .74rem; font-weight: 700; line-height: 1.6;
	background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line);
}
.chip-brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip-warn  { background: rgba(244, 162, 97, .14); color: #f4a261; border-color: transparent; }
.chip-danger{ background: rgba(239, 83, 80, .14); color: var(--danger); border-color: transparent; }

/* Label badges (ویژه/منصفانه/دلالی/فوری) */
.label-badge {
	position: absolute; top: 10px; left: 10px; z-index: 3;
	display: inline-flex; align-items: center; gap: 5px;
	padding: 5px 11px; border-radius: 999px;
	font-size: .72rem; font-weight: 800; color: #fff;
	backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}
.label-badge.lb-1 { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #2b1a00; }
.label-badge.lb-2 { background: linear-gradient(135deg, #0d9488, #34d399); }
.label-badge.lb-3 { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.label-badge.lb-4 { background: linear-gradient(135deg, #ef4444, #f87171); }

/* ---------- Cards ---------- */
.card {
	background: var(--surface); border: 1px solid var(--line);
	border-radius: 18px; box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
@media (min-width: 768px) { .card-pad { padding: 28px; } }

/* ---------- Forms ---------- */
.field label { display: block; font-size: .88rem; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.field .req { color: var(--danger); }
.input, select.input, textarea.input {
	width: 100%; padding: 11px 14px;
	background: var(--bg-2); color: var(--text);
	border: 1px solid var(--line); border-radius: 12px;
	transition: border-color .2s, box-shadow .2s;
	-webkit-appearance: none; appearance: none;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.input::placeholder { color: var(--text-3); }
select.input {
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%239db0c3' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
	background-repeat: no-repeat; background-position: left 12px center; background-size: 15px 11px;
	padding-left: 36px;
}
.form-grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }

/* radio / checkbox pills */
.pill-group { display: flex; flex-wrap: wrap; gap: 10px; }
.pill { position: relative; cursor: pointer; }
.pill input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pill span {
	display: inline-flex; align-items: center; gap: 7px;
	padding: 8px 16px; border-radius: 999px;
	background: var(--bg-2); border: 1px solid var(--line);
	color: var(--text-2); font-size: .9rem; font-weight: 600;
	transition: all .2s ease;
}
.pill input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.pill input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-ring); }

/* ---------- Alerts ---------- */
.alert { padding: 13px 17px; border-radius: 13px; font-size: .92rem; font-weight: 500; margin-bottom: 18px; border: 1px solid transparent; }
.alert-success { color: #34d399; background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .22); }
.alert-error   { color: #f87171; background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .22); }
[data-theme='light'] .alert-success { color: #067a52; background: rgba(13, 148, 136, .08); border-color: rgba(13, 148, 136, .2); }
[data-theme='light'] .alert-error   { color: #c0392b; background: rgba(239, 83, 80, .07); border-color: rgba(239, 83, 80, .2); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 30px 0 26px; margin-top: 40px; text-align: center; color: var(--text-3); font-size: .85rem; }
.site-footer p + p { margin-top: 4px; }

/* ---------- Scroll-to-top ---------- */
#scrollTopBtn {
	display: none; position: fixed; bottom: calc(84px + env(safe-area-inset-bottom)); left: 16px; z-index: 1050;
	width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
	background: var(--surface); color: var(--brand); border: 1px solid var(--line);
	box-shadow: var(--shadow-md); font-size: 1.05rem;
}
#scrollTopBtn.show { display: flex; align-items: center; justify-content: center; }
@media (min-width: 992px) { #scrollTopBtn { bottom: 25px; } }
