/* ========================================
   ULTRA MODERN HEADER & FOOTER
   Real Estate Theme Child
   ======================================== */

/* ========================================
   CSS CUSTOM PROPERTIES
   ======================================== */
:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --accent: #764ba2;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --danger: #ef4444;

    --dark-bg: #0f0f23;
    --dark-card: #1a1a2e;
    --dark-surface: #16213e;

    --light-bg: #ffffff;
    --light-card: #f8f9fa;
    --light-surface: #f0f4ff;

    --text-dark: #1a202c;
    --text-muted: #718096;
    --text-light: #f7fafc;

    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.18);

    --shadow-xs: 0 1px 4px rgba(0,0,0,0.06);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.20);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

    --header-height: 70px;
    --topbar-height: 42px;
    --header-total: calc(var(--topbar-height) + var(--header-height));
}

/* ========================================
   BASE RESET & BODY
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
    direction: rtl;
    text-align: right;
    color: var(--text-dark);
    background: var(--light-bg);
    transition: background 0.3s ease, color 0.3s ease;
    max-width: 100%;
    /*
     * FIX (شناور نبودن فرم درخواست بازدید و هر عنصر position:sticky دیگر
     * در دسکتاپ): این‌جا قبلاً «overflow-x: hidden» و سپس «overflow-x: clip»
     * روی خودِ body ست شده بود (برای جلوگیری از اسکرول افقی ناخواسته صفحه،
     * از جمله رفع نشتی منوی کشویی موبایل در اوپرا — نگاه کنید به قانون
     * html در پایین‌تر همین فایل).
     * طبق مشخصات CSS، وقتی overflow-x یک عنصر چیزی غیر از «visible» باشد
     * ولی overflow-y آن صراحتاً ست نشده باشد، مرورگر مقدار *مورد استفاده*‌ی
     * overflow-y را هم از «visible» به «auto» تغییر می‌دهد — این تبدیل
     * روی مقدار نهاییِ قابل‌استفاده اعمال می‌شود، نه چیزی که در CSS
     * نوشته‌ایم، پس حتی افزودن صریح «overflow-y: visible» هم آن را خنثی
     * نمی‌کند. نتیجه: <body> به یک «scroll container» مستقل تبدیل می‌شد که
     * هیچ‌وقت واقعاً خودش اسکرول نمی‌خورد (چون اسکرول واقعی صفحه در این
     * پوسته روی <html> انجام می‌شود، نه روی body). چون position: sticky در
     * تمام فرزندان (از جمله فرم «درخواست بازدید» در صفحه‌ی جزئیات ملک)
     * نسبت به نزدیک‌ترین scroll container محاسبه می‌شود، فرم هم به همین
     * scroll containerِ راکد گیر می‌کرد و هرگز واقعاً چسبان (شناور)
     * نمی‌ماند — با تست مستقیم در مرورگر همین علت تأیید شد.
     * راه‌حل: قانون overflow-x اصلاً از روی body برداشته شد. جلوگیری از
     * اسکرول افقی صفحه از قبل و به‌طور کامل روی <html> (که خودِ عنصر
     * اسکرول‌شونده‌ی واقعیِ صفحه است، پس این مشکل را ندارد) با
     * overflow-x: clip و overscroll-behavior-x: none برقرار است؛ در نتیجه
     * چیزی از آن محافظت کم نمی‌شود، فقط scroll containerِ اضافی و
     * مشکل‌سازِ روی body دیگر ساخته نمی‌شود.
     */
}

body.dark-mode {
    background: var(--dark-bg);
    color: var(--text-light);
}

/* ── تایپوگرافی محتوای مقالات/پست‌های وبلاگ ──
   این بخش قبلاً فقط برای صفحات سفارشی (about-us، contact-us و ...) با کلاس
   .am-page-content تعریف شده بود؛ پست‌های عادی وبلاگ (single.php از تم پدر)
   هیچ استایل اختصاصی نداشتند و با تنظیمات پیش‌فرض (بدون line-height و
   font-weight مناسب) نمایش داده می‌شدند که باعث می‌شد «شلوغ» و فشرده دیده شوند.
   این قانون عمومی، بدون نیاز به کلاس خاص، روی هر .entry-content در سایت اعمال می‌شود. */
.entry-content {
    font-size: 16px;
    line-height: 1.9;
    font-weight: 500;
    color: #334155;
    direction: rtl;
    text-align: justify;
}
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    color: #0f172a;
    font-weight: 700;
    line-height: 1.4;
    margin: 32px 0 14px;
}
.entry-content h2 { font-size: 22px; }
.entry-content h3 { font-size: 19px; }
.entry-content h4 { font-size: 17px; }
.entry-content p { margin: 0 0 18px; }
/* FIX: پاراگراف‌های کاملاً خالی (فقط &nbsp; یا <br> که ویرایشگر وردپرس
   معمولاً هنگام زدن Enterهای پیاپی ذخیره می‌کند) نباید فضای خالی و
   بی‌دلیل قبل از فوتر ایجاد کنند؛ چون از نظر PHP/JS خالی به‌حساب
   نمی‌آیند (trim() آن‌ها را تشخیص نمی‌دهد) ولی در مرورگر ارتفاع می‌گیرند. */
.entry-content p:empty,
.entry-content p:has(> br:only-child):not(:has(img, iframe)) {
    display: none;
}
.entry-content ul,
.entry-content ol {
    padding-right: 24px;
    margin: 0 0 18px;
}
.entry-content li {
    margin-bottom: 8px;
    padding-right: 8px;
    line-height: 1.9;
}
.entry-content a {
    color: #e2961a;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.entry-content img {
    border-radius: 12px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
}
.entry-content blockquote {
    border-right: 4px solid #f5c542;
    background: rgba(245, 197, 66, 0.06);
    margin: 24px 0;
    padding: 18px 22px;
    border-radius: 0 14px 14px 0;
    color: #475569;
}

.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Accessibility: visually hidden but screen-reader accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   SCROLL PROGRESS BAR
   ======================================== */
.scroll-progress-bar {
    position: fixed;
    top: 0;
    right: 0;
    width: 0%;
    height: 3px;
    background: var(--primary-gradient);
    z-index: 9999;
    transition: width 0.1s linear;
    border-radius: 0 0 2px 2px;
}

/* ========================================
   SITE HEADER WRAPPER
   ======================================== */
.site-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1000;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

body.dark-mode .site-header {
    background: rgba(15,15,35,0.97);
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.site-header.scrolled {
    box-shadow: var(--shadow-md);
}

body.dark-mode .site-header.scrolled {
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

/* Offset page content */
body {
    padding-top: var(--header-total);
}

/* ========================================
   TOP BAR
   ======================================== */
.header-topbar {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8ecf8 100%);
    border-bottom: 1px solid rgba(102,126,234,0.12);
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    font-size: 13px;
    transition: var(--transition);
}

body.dark-mode .header-topbar {
    background: rgba(26,26,46,0.9);
    border-bottom-color: rgba(255,255,255,0.06);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

/* Contact links */
.topbar-contact {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12.5px;
    transition: var(--transition-fast);
}

.topbar-link:hover {
    color: var(--primary);
    transform: translateY(-1px);
}

body.dark-mode .topbar-link {
    color: rgba(255,255,255,0.55);
}

body.dark-mode .topbar-link:hover {
    color: var(--primary);
}

/* Top-bar actions */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Theme toggle */
.theme-toggle-btn {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(102,126,234,0.2);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition);
    color: var(--text-muted);
}

.theme-toggle-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: scale(1.05);
}

body.dark-mode .theme-toggle-btn {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    color: var(--text-light);
}

.theme-toggle-btn .icon-sun,
.theme-toggle-btn .icon-moon {
    position: absolute;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.theme-toggle-btn .icon-moon { opacity: 0; transform: rotate(30deg) scale(0.8); }
.theme-toggle-btn .icon-sun  { opacity: 1; transform: rotate(0) scale(1); }

body.dark-mode .theme-toggle-btn .icon-moon { opacity: 1; transform: rotate(0) scale(1); }
body.dark-mode .theme-toggle-btn .icon-sun  { opacity: 0; transform: rotate(-30deg) scale(0.8); }

/* Topbar auth buttons */
.topbar-auth {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-login-btn,
.topbar-register-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.topbar-login-btn {
    color: var(--primary);
    border: 1.5px solid rgba(102,126,234,0.35);
    background: transparent;
}

.topbar-login-btn:hover {
    background: rgba(102,126,234,0.08);
    border-color: var(--primary);
}

.topbar-register-btn {
    background: var(--primary-gradient);
    color: white;
    border: 1.5px solid transparent;
    box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}

.topbar-register-btn:hover {
    box-shadow: 0 4px 16px rgba(102,126,234,0.45);
    transform: translateY(-1px);
}

/* User dropdown (topbar) */
.user-dropdown-wrap {
    position: relative;
}

.user-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 8px;
    background: white;
    border: 1px solid rgba(102,126,234,0.2);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    transition: var(--transition);
}

.user-dropdown-trigger:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

body.dark-mode .user-dropdown-trigger {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.12);
    color: var(--text-light);
}

.topbar-avatar {
    width: 26px !important;
    height: 26px !important;
    border-radius: 50%;
    object-fit: cover;
}

.user-dropdown-trigger svg {
    transition: transform 0.25s ease;
    opacity: 0.6;
}

.user-dropdown-trigger[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.user-dropdown-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    background: white;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transform-origin: top left;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 200;
}

body.dark-mode .user-dropdown-panel {
    background: var(--dark-card);
    border-color: rgba(255,255,255,0.1);
}

.user-dropdown-wrap.open .user-dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-dark);
    text-decoration: none;
    font-size: 13px;
    transition: var(--transition-fast);
}

.user-dropdown-item:hover {
    background: rgba(102,126,234,0.08);
    color: var(--primary);
}

.user-dropdown-item.logout:hover {
    background: rgba(239,68,68,0.08);
    color: var(--danger);
}

body.dark-mode .user-dropdown-item {
    color: rgba(255,255,255,0.85);
}

/* ========================================
   MAIN HEADER BAR
   ======================================== */
.header-main {
    height: var(--header-height);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header-row {
    display: flex;
    align-items: center;
    gap: 24px;
    height: var(--header-height);
}

/* Logo */
.header-logo {
    flex-shrink: 0;
}

/* لینک اصلی لوگو */
.am-site-header__logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

header-logo a img,
.am-site-header__logo img {
    max-height: 48px;
    width: auto;
    display: block;
    transition: opacity 0.2s ease;
}.

/* Override logo size to allow customizer control */
.am-site-header__logo img {
    max-height: 80px !important;
    width: auto !important;
    height: auto !important;
}


.header-logo a img:hover,
.am-site-header__logo img:hover { opacity: 0.85; }

/* ── نمایش لوگو بر اساس تم ──
   پشتیبانی از body.dark-mode (قدیمی) و html[data-theme="dark"] (جدید) */

/* پیش‌فرض: لوگوی تاریک مخفی */
.am-logo-dark { display: none; }
/* پیش‌فرض: لوگوی روشن نمایش */
.am-logo-light { display: block; }

/* حالت تاریک: لوگوی تاریک نمایش، روشن مخفی */
body.dark-mode .am-logo-dark,
html[data-theme="dark"] .am-logo-dark { display: block; }

body.dark-mode .am-logo-light,
html[data-theme="dark"] .am-logo-light { display: none; }

.logo-text {
    font-size: 22px;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: -0.5px;
}

/* ========================================
   DESKTOP NAVIGATION
   ======================================== */
.desktop-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* WP nav_menu output */
.desktop-nav .nav-list {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.desktop-nav .nav-list > li {
    position: relative;
}

.desktop-nav .nav-list > li > a {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 16px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    position: relative;
    white-space: nowrap;
}

body.dark-mode .desktop-nav .nav-list > li > a {
    color: rgba(255,255,255,0.87);
}

.desktop-nav .nav-list > li > a::after {
    content: '';
    position: absolute;
    bottom: 6px;
    right: 16px;
    left: 16px;
    height: 2px;
    background: var(--primary-gradient);
    border-radius: 2px;
    transform: scaleX(0);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
}

.desktop-nav .nav-list > li > a:hover,
.desktop-nav .nav-list > li.current-menu-item > a,
.desktop-nav .nav-list > li.current-menu-ancestor > a {
    color: var(--primary);
    background: rgba(102,126,234,0.08);
}

.desktop-nav .nav-list > li > a:hover::after,
.desktop-nav .nav-list > li.current-menu-item > a::after,
.desktop-nav .nav-list > li.current-menu-ancestor > a::after {
    transform: scaleX(1);
}

/* Dropdown arrow for items with children */
.desktop-nav .nav-list > li.menu-item-has-children > a::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-left: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg) translateY(-2px);
    opacity: 0.6;
    margin-right: 2px;
    transition: transform 0.2s ease;
}

.desktop-nav .nav-list > li.menu-item-has-children:hover > a::before {
    transform: rotate(135deg) translateY(-2px);
}

/* Submenu Dropdown */
.desktop-nav .nav-list .sub-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: white;
    border: 1px solid rgba(0,0,0,0.07);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 8px;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.97);
    transform-origin: top right;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
    z-index: 100;
}

body.dark-mode .desktop-nav .nav-list .sub-menu {
    background: var(--dark-card);
    border-color: rgba(255,255,255,0.08);
}

.desktop-nav .nav-list > li:hover > .sub-menu,
.desktop-nav .nav-list > li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.desktop-nav .nav-list .sub-menu li a {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

body.dark-mode .desktop-nav .nav-list .sub-menu li a {
    color: rgba(255,255,255,0.82);
}

.desktop-nav .nav-list .sub-menu li a:hover {
    background: rgba(102,126,234,0.09);
    color: var(--primary);
    padding-right: 18px;
}

/* ========================================
   HEADER RIGHT ACTIONS
   ======================================== */
.header-right-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Icon button base */
.hdr-icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(0,0,0,0.08);
    background: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    transition: var(--transition);
    position: relative;
}

.hdr-icon-btn:hover {
    background: rgba(102,126,234,0.08);
    border-color: rgba(102,126,234,0.3);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

body.dark-mode .hdr-icon-btn {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
}

body.dark-mode .hdr-icon-btn:hover {
    background: rgba(102,126,234,0.15);
    border-color: rgba(102,126,234,0.4);
    color: var(--primary);
}

/* Hamburger button */
.hamburger-btn {
    display: none; /* hidden on desktop */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: rgba(102,126,234,0.08);
    border: 1.5px solid rgba(102,126,234,0.2);
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 0;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.hamburger-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(102,126,234,0.4);
}

.hamburger-btn:hover .ham-line {
    background: white;
}

body.dark-mode .hamburger-btn {
    background: rgba(102,126,234,0.12);
    border-color: rgba(102,126,234,0.25);
}

/* Ham lines */
.ham-line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1), opacity 0.25s ease, width 0.25s ease;
    transform-origin: center;
}

body.dark-mode .ham-line {
    background: rgba(255,255,255,0.85);
}

/* Active (X) state */
.hamburger-btn[aria-expanded="true"] .ham-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-btn[aria-expanded="true"] .ham-line:nth-child(2) {
    opacity: 0;
    width: 0;
}

.hamburger-btn[aria-expanded="true"] .ham-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ========================================
   SEARCH BAR (slide-down)
   ======================================== */
.header-search-bar {
    max-height: 0;
    overflow: hidden;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(20px);
    border-top: 0px solid rgba(102,126,234,0.1);
    transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1), padding 0.35s ease, border-top 0.2s ease;
}

body.dark-mode .header-search-bar {
    background: rgba(15,15,35,0.98);
}

.header-search-bar.open {
    max-height: 90px;
    padding: 16px 0;
    border-top-width: 1px;
}

.search-bar-form {
    display: flex;
    align-items: center;
    gap: 0;
    max-width: 640px;
    margin: 0 auto;
    border: 1.5px solid rgba(102,126,234,0.25);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: white;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.2s ease;
}

body.dark-mode .search-bar-form {
    background: var(--dark-card);
    border-color: rgba(255,255,255,0.1);
}

.search-bar-form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102,126,234,0.12), var(--shadow-md);
}

.search-bar-form input {
    flex: 1;
    padding: 14px 20px;
    font-size: 15px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-dark);
    font-family: inherit;
}

body.dark-mode .search-bar-form input {
    color: var(--text-light);
}

.search-bar-form input::placeholder {
    color: var(--text-muted);
}

.search-bar-form button {
    padding: 0 20px;
    height: 52px;
    background: var(--primary-gradient);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: var(--transition);
}

.search-bar-form button:hover {
    opacity: 0.88;
}

/* ========================================
   MOBILE OVERLAY
   ======================================== */
.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   MOBILE NAVIGATION DRAWER
   ======================================== */
.mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: -360px; /* off-screen right (RTL) */
    width: 340px;
    max-width: 90vw;
    height: 100dvh;
    background: white;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -8px 0 48px rgba(0,0,0,0.18);
    transition: right 0.38s cubic-bezier(0.4,0,0.2,1);
    border-left: 1px solid rgba(0,0,0,0.06);
}

body.dark-mode .mobile-nav-drawer {
    background: var(--dark-card);
    border-left-color: rgba(255,255,255,0.06);
}

.mobile-nav-drawer.open {
    right: 0;
}

/* Drawer Header */
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(102,126,234,0.06) 0%, rgba(118,75,162,0.04) 100%);
}

body.dark-mode .drawer-header {
    border-bottom-color: rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.03);
}

.drawer-logo img,
.drawer-logo .logo-text {
    max-height: 40px;
}

.drawer-close-btn {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(0,0,0,0.04);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    transition: var(--transition);
    flex-shrink: 0;
}

.drawer-close-btn:hover {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.2);
    color: var(--danger);
    transform: rotate(90deg);
}

body.dark-mode .drawer-close-btn {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
}

/* Drawer Search */
.drawer-search {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}

body.dark-mode .drawer-search {
    border-bottom-color: rgba(255,255,255,0.06);
}

.drawer-search form {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--light-surface);
    border: 1.5px solid rgba(102,126,234,0.15);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

body.dark-mode .drawer-search form {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.drawer-search form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
}

.drawer-search input {
    flex: 1;
    padding: 10px 14px;
    font-size: 13.5px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-dark);
    font-family: inherit;
}

body.dark-mode .drawer-search input {
    color: var(--text-light);
}

.drawer-search input::placeholder { color: var(--text-muted); }

.drawer-search button {
    padding: 0 14px;
    height: 40px;
    background: var(--primary-gradient);
    border: none;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.drawer-search button:hover { opacity: 0.85; }

/* Drawer Menu List */
.drawer-menu-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(102,126,234,0.3) transparent;
}

.drawer-menu-body::-webkit-scrollbar { width: 4px; }
.drawer-menu-body::-webkit-scrollbar-track { background: transparent; }
.drawer-menu-body::-webkit-scrollbar-thumb { background: rgba(102,126,234,0.3); border-radius: 4px; }

/* WP nav output inside drawer */
.drawer-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.drawer-nav-list li {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.drawer-nav-list > li + li {
    margin-top: 2px;
}

.drawer-nav-list li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    position: relative;
}

body.dark-mode .drawer-nav-list li a {
    color: rgba(255,255,255,0.87);
}

.drawer-nav-list li a:hover,
.drawer-nav-list li.current-menu-item > a {
    background: rgba(102,126,234,0.1);
    color: var(--primary);
    padding-right: 20px;
}

.drawer-nav-list li.current-menu-item > a {
    background: rgba(102,126,234,0.12);
}

/* Submenu inside drawer */
.drawer-nav-list .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0 0 6px 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.drawer-nav-list li.open > .sub-menu {
    max-height: 600px;
}

.drawer-nav-list .sub-menu li a {
    padding: 10px 16px 10px 28px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-muted);
}

body.dark-mode .drawer-nav-list .sub-menu li a {
    color: rgba(255,255,255,0.55);
}

.drawer-nav-list .sub-menu li a:hover {
    color: var(--primary);
    background: rgba(102,126,234,0.07);
}

/* Toggle arrow for parent items */
.drawer-nav-list li.menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    opacity: 0.5;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.drawer-nav-list li.menu-item-has-children.open > a::after {
    transform: rotate(135deg);
    opacity: 0.8;
}

/* ========================================
   DRAWER AUTH SECTION
   ======================================== */
.drawer-auth-section {
    flex-shrink: 0;
    padding: 16px;
    border-top: 1px solid rgba(0,0,0,0.07);
    background: linear-gradient(135deg, rgba(102,126,234,0.04) 0%, rgba(118,75,162,0.03) 100%);
}

body.dark-mode .drawer-auth-section {
    border-top-color: rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.02);
}

.drawer-auth-label {
    font-size: 12.5px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 12px;
    font-weight: 500;
}

.drawer-auth-btns {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

/* Logged-in user profile card */
.drawer-user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(102,126,234,0.08);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.drawer-avatar {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50%;
    object-fit: cover;
    border: 2.5px solid rgba(102,126,234,0.3);
    flex-shrink: 0;
}

.drawer-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.drawer-username {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

body.dark-mode .drawer-username { color: var(--text-light); }

.drawer-user-role {
    font-size: 12px;
    color: var(--text-muted);
}

/* Drawer Buttons */
.drawer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition-bounce);
    border: 2px solid transparent;
}

.drawer-btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 16px rgba(102,126,234,0.35);
}

.drawer-btn-primary:hover {
    box-shadow: 0 8px 24px rgba(102,126,234,0.5);
    transform: translateY(-2px);
}

.drawer-btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: rgba(102,126,234,0.35);
}

.drawer-btn-outline:hover {
    background: rgba(102,126,234,0.08);
    border-color: var(--primary);
    transform: translateY(-1px);
}

body.dark-mode .drawer-btn-outline {
    color: rgba(130,160,255,0.9);
    border-color: rgba(102,126,234,0.3);
}

.drawer-btn-danger {
    background: rgba(239,68,68,0.08);
    color: var(--danger);
    border-color: rgba(239,68,68,0.2);
}

.drawer-btn-danger:hover {
    background: rgba(239,68,68,0.14);
    border-color: var(--danger);
    transform: translateY(-1px);
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Tablet: hide desktop nav, show hamburger */
@media (max-width: 1024px) {
    .desktop-nav {
        display: none;
    }

    .hamburger-btn {
        display: flex;
    }
}

/* Mobile: hide topbar, compact header */
@media (max-width: 768px) {
    :root {
        --topbar-height: 0px;
        --header-height: 62px;
    }

    .header-topbar {
        display: none;
    }

    .header-main {
        height: var(--header-height);
    }

    .header-row {
        height: var(--header-height);
        gap: 12px;
    }

    .mobile-nav-drawer {
        width: 100%;
        max-width: 100%;
        right: -100%;
        border-left: none;
    }

    .drawer-header {
        padding: 14px 16px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 14px;
    }

    .mobile-nav-drawer {
        border-radius: 0;
    }
}

/* Large screen: show auth buttons in topbar always */
@media (min-width: 1025px) {
    .hamburger-btn {
        display: none !important;
    }
}


/* ========================================
   ULTRA MODERN FOOTER
   ======================================== */

.ultra-modern-footer {
    position: relative;
    background: linear-gradient(135deg, #151E3F 0%, #1E2A56 45%, #2563eb 130%);
    color: white;
    overflow: hidden;
}

/* Particles Background */
.particles-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.3;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: float 20s infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(100px);
        opacity: 0;
    }
}

/* Footer Main */
/* FIX: padding-top قبلی (80px) روی دسکتاپ باعث می‌شد یک فاصله‌ی خالی
   قابل‌توجه بین شروع پس‌زمینه‌ی تیره‌ی فوتر و ردیف ستون‌ها ایجاد شود —
   این همان فضای خالی داخل فوتر است که در همه‌ی صفحات دیده می‌شود چون
   footer.php مشترک است. مقدار را جمع‌وجورتر کردیم. */
.footer-main {
    position: relative;
    z-index: 1;
    padding: 48px 0 32px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 48px;
}

.footer-grid:has(.newsletter-col--extra) {
    grid-template-columns: 1.6fr 1fr 1fr 1.3fr 1.3fr;
}

.contact-link--address {
    align-items: flex-start;
}

.footer-col {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* About Column */
.footer-logo {
    margin-bottom: 20px;
}

.footer-logo img {
    height: 48px;
    width: auto;
    filter: brightness(0) invert(1);
}

.footer-logo h3 {
    font-size: 28px;
    font-weight: 700;
    color: white;
}

.footer-desc {
    line-height: 1.8;
    opacity: 0.9;
    margin-bottom: 24px;
    max-width: 340px;
    font-size: 13.5px;
}
@media (max-width: 768px) {
    .footer-desc { max-width: 100%; }
}

/* Social Links */
.social-links {
    display: flex;
    gap: 12px;
}

.social-link {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    text-decoration: none;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.social-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Footer Title */
.footer-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    position: relative;
    padding-bottom: 12px;
    /* رنگ ثابت و صریح — قبلاً این عنوان‌ها («لینک‌های سریع»، «خدمات»،
       «راه‌های ارتباطی») رنگ خودشان را تعریف نکرده بودند و رنگ متن فوتر
       را به ارث می‌بردند؛ آن رنگ از تنظیمات ادمین («رنگ متن فوتر») می‌آید
       و می‌تواند هر مقداری باشد، در نتیجه گاهی روی پس‌زمینه‌ی فوتر تقریباً
       ناخوانا می‌شد. عنوان ستون‌ها همیشه باید کاملاً واضح و پررنگ بمانند،
       چون به بقیه‌ی عناصر ستون معنا می‌دهند. */
    color: #ffffff;
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 50px;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
}

/* Footer Links */
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links li a {
    /* رنگ ثابت به‌جای وابستگی به رنگ داینامیک فوتر — همان دلیل بالا؛
       لینک‌های «خرید ملک، اجاره ملک، ...» و «سوالات متداول، قوانین، ...»
       باید در هر ترکیب رنگی از پس‌زمینه‌ی فوتر همیشه به‌وضوح خوانا بمانند. */
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: var(--transition);
    display: inline-block;
}

.footer-links li a:hover {
    color: white;
    transform: translateX(-4px);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Newsletter */
.newsletter-desc {
    opacity: 0.9;
    margin-bottom: 20px;
    line-height: 1.6;
}

.newsletter-form {
    margin-bottom: 24px;
}

.input-group {
    position: relative;
    display: flex;
    gap: 8px;
}

.input-group input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 15px;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.input-group input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

.input-group button {
    width: 48px;
    height: 48px;
    border: none;
    background: white;
    color: #667eea;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.input-group button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.3);
}

.newsletter-message {
    display: block;
    margin-top: 12px;
    font-size: 14px;
    opacity: 0;
    transition: var(--transition);
}

.newsletter-message.show {
    opacity: 1;
}

.newsletter-message.is-error {
    color: #fca5a5;
}

/* Contact Info */
.contact-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: var(--transition);
}

.contact-link:hover {
    color: white;
    transform: translateX(-4px);
}

.contact-link svg {
    opacity: 0.7;
}

/* ========================================
   FOOTER TRUST STRIP
   ======================================== */
.footer-trust-strip {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 28px;
    padding: 22px 0;
    margin-top: 12px;
    border-top: 1px solid rgba(255,255,255,.14);
    border-bottom: 1px solid rgba(255,255,255,.14);
}
.footer-trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,.85);
    font-size: 13px;
    font-weight: 700;
}
.footer-trust-item svg { flex-shrink: 0; color: #4ade80; }
.footer-trust-item--enamad { margin-inline-start: auto; }
@media (max-width: 900px) {
    .footer-trust-strip { gap: 18px; }
    .footer-trust-item--enamad { margin-inline-start: 0; }
}

/* ========================================
   FOOTER BOTTOM
   ======================================== */

/* Footer Bottom */
.footer-bottom {
    position: relative;
    z-index: 1;
    background: rgba(0, 0, 0, 0.2);
    /* FIX (فاصله‌ی زیاد زیر فوتر): مقدار قبلی این padding-bottom برابر ۱۰۴px
       بود تا دکمه‌های شناور «بازگشت به بالا» / «بازگشت به خانه»
       (هر دو position:fixed با ارتفاع ۵۲px) روی ردیف کپی‌رایت ننشینند.
       این عدد بزرگ همان فاصله‌ی خالیِ بزرگی بود که زیر فوتر دیده می‌شد.
       راه‌حل درست‌تر (پایین‌تر در همین فایل، بخش «FAB DOCKING») این است که
       این دکمه‌ها وقتی فوتر وارد دیدرس می‌شود، از fixed به absolute سوییچ
       کنند و در همان انتهای صفحه «بشینند» (dock شوند) — این‌طوری دیگر
       نیازی به رزرو یک فضای خالیِ ثابت و بزرگ در پایین فوتر نیست. */
    padding: 24px 0 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.copyright p {
    margin: 0;
    opacity: 0.8;
}

.footer-bottom-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer-bottom-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
}

.footer-bottom-links a:hover {
    color: white;
}

.footer-bottom-links .separator {
    opacity: 0.5;
}

/* ========================================
   BACK TO TOP BUTTON
   ======================================== */

.back-to-top {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 52px;
    height: 52px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

/* FIX (تداخل با دکمه‌ی شناور چت در دسکتاپ): در صفحه‌ی تک‌ملک، دکمه‌ی
   چت (am-chat-fab, assets/css/am-chat.css) هم دقیقاً bottom:24px;left:24px
   است — یعنی همان گوشه‌ی «بازگشت به بالا». در موبایل این تداخل قبلاً حل
   شده (چون «بازگشت به بالا» در صفحه‌ی تک‌ملک موبایل کلاً مخفی می‌شود)،
   اما در دسکتاپ راه‌حلی نداشت. این‌جا به‌جای مخفی‌کردن، «بازگشت به بالا»
   را دقیقاً بالای دکمه‌ی چت می‌نشانیم (۵۲px ارتفاع دکمه‌ی چت + ۲۴px
   فاصله‌ی پایه + ۱۶px فاصله‌ی امن) تا هر دو هم‌زمان و بدون روی‌هم‌افتادن
   قابل استفاده بمانند. */
body.single-property-page .back-to-top {
    bottom: 92px;
}

/* ========================================
   BACK TO HOME BUTTON
   دقیقاً هم‌شکل با دکمه‌ی «بازگشت به بالا» ولی سمت مقابل (پایین-راست) و
   همیشه نمایان (چون خودش یک لینک ساده است، نه وابسته به اسکرول).
   ======================================== */

.am-back-home {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    text-decoration: none;
    transition: var(--transition);
    z-index: 998;
}

.am-back-home:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
    color: #fff;
}

/* ========================================
   FAB DOCKING (رفع فاصله‌ی زیاد زیر فوتر)
   ──────────────────────────────────────
   دکمه‌های شناور «بازگشت به بالا» و «بازگشت به خانه» همیشه position:fixed
   هستند تا در حین اسکرول همراه صفحه بمانند. مشکل قبلی این بود که این
   دو دکمه دقیقاً روی ردیف کپی‌رایتِ فوتر هم می‌افتادند، و راه‌حلِ قبلی
   (رزرو ۱۰۴px فضای خالی همیشگی در پایین فوتر) به قیمت یک فاصله‌ی بزرگ و
   همیشگیِ خالی زیر فوتر تمام می‌شد — حتی وقتی کاربر اصلاً پایین صفحه
   نبود.
   راه‌حل: با IntersectionObserver (در ultra-modern.js، initFooterFabDock)
   وقتی خودِ فوتر وارد دیدرس می‌شود، کلاس body.is-fab-dock-active اضافه
   می‌شود. در همین حالت این دکمه‌ها از fixed به absolute سوییچ می‌کنند؛
   چون هیچ جدِ positioned دیگری بین آن‌ها و <body> نیست، «absolute» آن‌ها
   را نسبت به کل صفحه (نه ویوپورت) در همان ۲۴px پایین‌ترِ صفحه می‌نشاند —
   یعنی دقیقاً همان‌جایی که در حالت fixed، در انتهای اسکرول قرار می‌گرفتند؛
   بدون نیاز به هیچ فضای رزروشده‌ی اضافه‌ای. */
body.is-fab-dock-active .back-to-top,
body.is-fab-dock-active .am-back-home {
    position: absolute;
}

body.is-fab-dock-active.single-property-page .back-to-top {
    bottom: 92px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }
    
    .desktop-nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    .modern-topbar {
        display: none;
    }
    
    .contact-items {
        flex-direction: column;
        gap: 12px;
    }
    
    .header-actions .action-btn:not(.mobile-menu-toggle) {
        display: none;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    /* FIX (رفع تداخل): فاصله دیگر یک عدد ثابت حدسی نیست — از متغیر واحد
       --am-bottom-stack (assets/css/am-mobile-bottom-bar.css) گرفته می‌شود
       که همیشه برابر ارتفاع واقعیِ نوار/نوارهای ثابت پایین همان صفحه است.
       این‌طوری این دکمه در هیچ صفحه‌ای — نه فقط صفحه تک‌ملک — روی نوار
       پایین یا محتوای فوتر (لینک‌های سریع/خدمات) نمی‌افتد. */
    .back-to-top {
        bottom: calc(var(--am-bottom-stack, 64px) + 16px + env(safe-area-inset-bottom, 0px));
        left: 24px;
        width: 48px;
        height: 48px;
    }

    /* در صفحه‌ی تک‌ملک این دکمه دقیقاً هم‌ارتفاع با دکمه‌ی شناور چت
       (am-chat-fab) می‌افتاد (هر دو سمت چپ). چون صفحه‌ی تک‌ملک از قبل یک
       نوار CTA ثابت («درخواست بازدید») و یک دکمه‌ی چت اختصاصی دارد،
       دکمه‌ی «بازگشت به بالا»ی عمومی این‌جا حذف می‌شود تا مثل سایت‌های
       بروز املاک، فقط یک ویجت شناور (چت) روی صفحه بماند. */
    body.single-property-page .back-to-top {
        display: none !important;
    }

    /* دکمه‌ی بازگشت به خانه دقیقاً هم‌ارتفاع با بازگشت به بالا، سمت راست
       نسخه‌ی مدرن‌شده‌ی موبایل: شیشه‌ای (glass) با حلقه‌ی گرادیانت دور
       دکمه، سایه‌ی لایه‌ای نرم‌تر و بازخورد لمسی هنگام فشردن، به‌جای
       ظاهر تخت و ساده‌ی قبلی. اندازه و فاصله از پایین همان منطق قبلی
       (هماهنگ با --am-bottom-stack) را حفظ می‌کند تا با نوار پایین یا
       دکمه‌های شناور دیگر تداخل پیدا نکند. */
    .am-back-home {
        bottom: calc(var(--am-bottom-stack, 64px) + 16px + env(safe-area-inset-bottom, 0px));
        right: 24px;
        width: 50px;
        height: 50px;
        background:
            linear-gradient(145deg, rgba(102, 126, 234, 0.92), rgba(118, 75, 162, 0.92));
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border: 1px solid rgba(255, 255, 255, 0.35);
        box-shadow:
            0 10px 26px rgba(102, 126, 234, 0.38),
            0 2px 6px rgba(15, 23, 42, 0.18),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
        animation: amBackHomeIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    }
    .am-back-home::before {
        content: '';
        position: absolute;
        inset: -4px;
        border-radius: 50%;
        background: conic-gradient(from 0deg, rgba(102, 126, 234, 0.55), rgba(118, 75, 162, 0.55), rgba(102, 126, 234, 0.55));
        opacity: 0;
        z-index: -1;
        transition: opacity 0.3s ease;
    }
    .am-back-home svg {
        width: 20px;
        height: 20px;
        stroke-width: 2.4;
        filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12));
    }
    .am-back-home:active {
        transform: scale(0.9);
        box-shadow:
            0 4px 14px rgba(102, 126, 234, 0.32),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    .am-back-home:hover::before,
    .am-back-home:focus-visible::before {
        opacity: 1;
    }
    @keyframes amBackHomeIn {
        from { opacity: 0; transform: translateY(14px) scale(0.85); }
        to { opacity: 1; transform: translateY(0) scale(1); }
    }
    @media (prefers-reduced-motion: reduce) {
        .am-back-home { animation: none; }
    }

    /* در صفحه‌ی تک‌ملک این دکمه دقیقاً روی دکمه‌ی «نصب اپلیکیشن»
       (am-pwa-install-btn، هر دو سمت راست و هم‌ارتفاع) می‌افتاد. حذف
       می‌شود تا فقط دکمه‌ی نصب اپ آن سمت باقی بماند. */
    body.single-property-page .am-back-home {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .main-header {
        padding: 12px 0;
    }
    
    .logo-primary {
        font-size: 20px;
    }
    
    .footer-main {
        padding: 40px 0 24px;
    }
    
    .mobile-menu {
        width: 100%;
    }
}
/* ==================== MOBILE MENU OVERLAY ==================== */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}
body.single-property .rep-single-wrapper {
    margin-top: 100px;
}
/* استایل دکمه‌های ورود/ثبت‌نام در منوی موبایل */
.mobile-menu-actions {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.mobile-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

body.dark-mode .mobile-menu-actions {
    border-top-color: rgba(255, 255, 255, 0.05);
}
/* ═══════════════════════════════════════════════════════════
   AM REAL ESTATE — HEADER STYLES
   ultra-modern.css
═══════════════════════════════════════════════════════════ */

/* ── CSS Variables ───────────────────────────────────────── */
:root {
    --am-primary:        #2563eb;
    --am-primary-dark:   #1d4ed8;
    --am-accent:         #f59e0b;

    /* Light mode */
    --am-bg:             #ffffff;
    --am-bg-alt:         #f8fafc;
    --am-topbar-bg:      #1e293b;
    --am-topbar-text:    #cbd5e1;
    --am-header-bg:      #ffffff;
    --am-header-shadow:  0 2px 20px rgba(0,0,0,.08);
    --am-text:           #1e293b;
    --am-text-muted:     #64748b;
    --am-border:         #e2e8f0;
    --am-drawer-bg:      #ffffff;
    --am-overlay-bg:     rgba(15,23,42,.55);
    --am-search-bg:      #f1f5f9;

    /* Transitions */
    --am-transition:     0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --am-transition-fast:0.15s ease;

    /* Sizes */
    --am-topbar-h:       42px;
    --am-header-h:       72px;
    --am-drawer-w:       340px;
    --am-container-max:  1280px;
    --am-radius:         10px;
    --am-radius-sm:      6px;
}

/* رنگ‌شمای صریح: از تیره‌سازی خودکار مرورگر (Force/Auto-Dark اندروید)
   روی عناصر فرم بومی (select/input) جلوگیری می‌کند — همان چیزی که باعث
   می‌شد فیلدهای فرم جستجو در حالت تاریک به‌صورت جعبه‌های سیاه با
   حاشیه‌ی نورانی آبی و بدون هماهنگی با رنگ‌بندی سایت نمایش داده شوند. */
/* FIX: در بعضی مرورگرهای موبایل (مثل اوپرا)، کل صفحه به‌صورت افقی هم
   اسکرول می‌خورد — معمولاً چون یک عنصر (مثلاً منوی کشویی موبایل که با
   transform: translateX(100%) بیرون از صفحه پنهان می‌شود، یا یک ردیف flex
   بدون wrap) کمی از عرض viewport بیرون می‌زند. چون هیچ‌جای پوسته یک
   overflow-x امن روی html/body نداشت، این بیرون‌زدگی به‌جای بریده‌شدن،
   باعث اسکرول افقی کل صفحه می‌شد و همین باعث می‌شد نوارهای ثابت پایین
   صفحه (چون based on موقعیت اسکرول‌شده محاسبه/رندر می‌شوند) با منوی خود
   مرورگر تداخل پیدا کنند. html/body عرضشان را دقیقاً به عرض viewport
   محدود می‌کنیم تا این اسکرول افقی ناخواسته امکان‌پذیر نباشد. */
html {
    overflow-x: hidden;
    /* FIX-OPERA: نسخه‌ی قطعی‌تر overflow-x برای مرورگرهای پشتیبان (توضیح کامل
       در قانون body بالاتر). */
    overflow-x: clip;
    overscroll-behavior-x: none;
    max-width: 100%;
    color-scheme: light;
}
html[data-theme="dark"] { color-scheme: dark; }


/* Dark mode variables */
[data-theme="dark"] {
    --am-bg:             #0f172a;
    --am-bg-alt:         #1e293b;
    --am-topbar-bg:      #020617;
    --am-topbar-text:    #94a3b8;
    --am-header-bg:      #0f172a;
    --am-header-shadow:  0 2px 20px rgba(0,0,0,.4);
    --am-text:           #f1f5f9;
    --am-text-muted:     #94a3b8;
    --am-border:         #1e293b;
    --am-drawer-bg:      #0f172a;
    --am-search-bg:      #1e293b;
}

/* ── Container ───────────────────────────────────────────── */
.am-container {
    width: 100%;
    max-width: var(--am-container-max);
    margin-inline: auto;
    padding-inline: 1.5rem;
}

/* ── Accessibility ───────────────────────────────────────── */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ══════════════════════════════════════════════════════════
   TOP BAR
══════════════════════════════════════════════════════════ */
.am-topbar {
    background: var(--am-topbar-bg);
    color: var(--am-topbar-text);
    height: var(--am-topbar-h);
    font-size: .8125rem;
    position: relative;
    z-index: 100;
    transition: background var(--am-transition);
}

.am-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 1rem;
}

.am-topbar__contact {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.am-topbar__link {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    color: var(--am-topbar-text);
    text-decoration: none;
    transition: color var(--am-transition-fast);
}

.am-topbar__link:hover,
.am-topbar__link:focus-visible {
    color: #ffffff;
}

.am-topbar__actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.am-topbar__login,
.am-topbar__register {
    padding: .2rem .75rem;
    border-radius: var(--am-radius-sm);
    font-size: .8rem;
    font-weight: 500;
    transition: background var(--am-transition-fast), color var(--am-transition-fast);
}

.am-topbar__login {
    border: 1px solid rgba(255,255,255,.2);
}

.am-topbar__login:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.am-topbar__register {
    background: var(--am-primary);
    color: #fff !important;
    border: 1px solid var(--am-primary);
}

.am-topbar__register:hover {
    background: var(--am-primary-dark);
    border-color: var(--am-primary-dark);
}

/* ── Theme Toggle Button ─────────────────────────────────── */
.am-theme-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    background: rgba(255,255,255,.15);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--am-transition);
    overflow: hidden;
}

.am-theme-toggle:hover {
    background: rgba(255,255,255,.25);
}

.am-theme-toggle:focus-visible {
    outline: 2px solid var(--am-accent);
    outline-offset: 2px;
}

.am-icon-sun,
.am-icon-moon {
    position: absolute;
    transition: opacity var(--am-transition), transform var(--am-transition);
    color: var(--am-topbar-text);
}

/* Light mode: خورشید نشان بده، ماه پنهان */
.am-icon-sun  { opacity: 1; transform: rotate(0deg) scale(1); }
.am-icon-moon { opacity: 0; transform: rotate(90deg) scale(.5); }

/* Dark mode: ماه نشان بده، خورشید پنهان */
[data-theme="dark"] .am-icon-sun  { opacity: 0; transform: rotate(-90deg) scale(.5); }
[data-theme="dark"] .am-icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* ── User Menu ───────────────────────────────────────────── */
.am-user-menu {
    position: relative;
}

.am-user-menu__trigger {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--am-topbar-text);
    padding: .25rem .5rem;
    border-radius: var(--am-radius-sm);
    transition: background var(--am-transition-fast);
}

.am-user-menu__trigger:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.am-avatar {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.2);
}

.am-user-menu__name {
    font-size: .8125rem;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.am-user-menu__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 160px;
    background: var(--am-header-bg);
    border: 1px solid var(--am-border);
    border-radius: var(--am-radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    list-style: none;
    padding: .375rem 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--am-transition), transform var(--am-transition), visibility var(--am-transition);
    z-index: 200;
}

.am-user-menu__dropdown[data-open="true"],
.am-user-menu:focus-within .am-user-menu__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.am-user-menu__dropdown a {
    display: block;
    padding: .5rem 1rem;
    font-size: .875rem;
    color: var(--am-text);
    text-decoration: none;
    transition: background var(--am-transition-fast), color var(--am-transition-fast);
}

.am-user-menu__dropdown a:hover {
    background: var(--am-bg-alt);
    color: var(--am-primary);
}

/* ══════════════════════════════════════════════════════════
   MAIN HEADER
══════════════════════════════════════════════════════════ */
.am-header {
    position: sticky;
    top: 0;
    z-index: 99;
    background: var(--am-header-bg);
    box-shadow: var(--am-header-shadow);
    height: var(--am-header-h);
    transition: background var(--am-transition), box-shadow var(--am-transition), height var(--am-transition);
}

/* Scrolled state — هدر کوچک‌تر می‌شه */
.am-header.is-scrolled {
    --am-header-h: 60px;
    box-shadow: 0 4px 30px rgba(0,0,0,.12);
}

.am-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--am-header-h);
    gap: 1.5rem;
    transition: height var(--am-transition);
}

/* ── Logo ────────────────────────────────────────────────── */
.am-header__logo {
    flex-shrink: 0;
}

.am-header__logo img,
.am-header__logo .custom-logo {
    height: 44px;
    width: auto;
    display: block;
    transition: height var(--am-transition);
}

.am-header.is-scrolled .am-header__logo img,
.am-header.is-scrolled .am-header__logo .custom-logo {
    height: 36px;
}

.am-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--am-text);
    text-decoration: none;
    letter-spacing: -.025em;
    transition: color var(--am-transition-fast);
}

.am-logo-text:hover {
    color: var(--am-primary);
}

/* ── لوگوی برندشده: آیکون + اسم + شعار ────────────────────── */
.am-logo-text--branded {
    display: flex;
    align-items: center;
    gap: 10px;
}
.am-logo-text__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--am-primary);
    color: #fff;
    flex-shrink: 0;
}
.am-logo-text__meta {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.am-logo-text__name {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--am-text);
}
.am-logo-text__tagline {
    font-size: .7rem;
    font-weight: 500;
    color: var(--am-text-muted);
}
@media (max-width: 640px) {
    .am-logo-text__tagline { display: none; }
}

/* ── Desktop Nav ─────────────────────────────────────────── */
.am-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.am-nav__list {
    display: flex;
    align-items: center;
    gap: .25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.am-nav__list li {
    position: relative;
}

.am-nav__list > li > a {
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: .5rem .875rem;
    font-size: .9375rem;
    font-weight: 500;
    color: var(--am-text);
    text-decoration: none;
    border-radius: var(--am-radius-sm);
    transition: color var(--am-transition-fast), background var(--am-transition-fast);
    white-space: nowrap;
}

.am-nav__list > li > a:hover,
.am-nav__list > li > a:focus-visible,
.am-nav__list > li.current-menu-item > a {
    color: var(--am-primary);
    background: rgba(37,99,235,.08);
}

/* Active indicator underline */
.am-nav__list > li > a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: .875rem;
    right: .875rem;
    height: 2px;
    background: var(--am-primary);
    border-radius: 2px;
    transform: scaleX(0);
    transition: transform var(--am-transition);
}

.am-nav__list > li > a:hover::after,
.am-nav__list > li.current-menu-item > a::after {
    transform: scaleX(1);
}

/* Dropdown */
.am-nav__list .sub-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    background: var(--am-header-bg);
    border: 1px solid var(--am-border);
    border-radius: var(--am-radius);
    box-shadow: 0 8px 30px rgba(0,0,0,.12);
    list-style: none;
    padding: .375rem 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--am-transition), transform var(--am-transition), visibility var(--am-transition);
    z-index: 150;
}

.am-nav__list li:hover > .sub-menu,
.am-nav__list li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.am-nav__list .sub-menu a {
    display: block;
    padding: .5rem 1rem;
    font-size: .875rem;
    color: var(--am-text);
    text-decoration: none;
    transition: background var(--am-transition-fast), color var(--am-transition-fast);
}

.am-nav__list .sub-menu a:hover {
    background: var(--am-bg-alt);
    color: var(--am-primary);
    padding-right: 1.25rem;
}

/* ── Header Tools ────────────────────────────────────────── */
.am-header__tools {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}

/* ── Icon Button (shared) ────────────────────────────────── */
.am-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: var(--am-radius-sm);
    cursor: pointer;
    color: var(--am-text);
    transition: background var(--am-transition-fast), color var(--am-transition-fast), transform var(--am-transition-fast);
}

.am-btn-icon:hover {
    background: var(--am-bg-alt);
    color: var(--am-primary);
}

.am-btn-icon:focus-visible {
    outline: 2px solid var(--am-primary);
    outline-offset: 2px;
}

.am-btn-icon:active {
    transform: scale(.93);
}

/* ── دکمه علاقه‌مندی (heart) و پیل ورود/ثبت‌نام ─────────────── */
.am-header__map-btn { text-decoration: none; }
.am-header__tool-hidden-desktop { display: none; }
@media (max-width: 900px) {
    .am-header__tool-hidden-desktop { display: inline-flex; }
}

.am-btn-heart {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--am-border);
    background: var(--am-header-bg);
    color: var(--am-text);
}
.am-btn-heart:hover {
    color: #e11d48;
    border-color: #e11d48;
    background: rgba(225,29,72,.06);
}

.am-theme-toggle-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--am-border);
    background: var(--am-header-bg);
}
.am-theme-toggle-btn .am-icon-sun,
.am-theme-toggle-btn .am-icon-moon {
    position: absolute;
    color: var(--am-text);
}
.am-theme-toggle-btn:hover { border-color: var(--am-primary); color: var(--am-primary); }
.am-theme-toggle-btn:hover .am-icon-sun,
.am-theme-toggle-btn:hover .am-icon-moon { color: var(--am-primary); }

.am-btn-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 20px;
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--am-transition-fast), color var(--am-transition-fast), transform var(--am-transition-fast);
}
.am-btn-pill--auth {
    background: var(--am-text);
    color: var(--am-header-bg);
}
.am-btn-pill--auth:hover {
    background: var(--am-primary);
    color: #fff;
    transform: translateY(-1px);
}
.am-btn-pill--account {
    background: var(--am-bg-alt);
    color: var(--am-text);
    padding-left: 16px;
    padding-right: 6px;
}
.am-btn-pill--account:hover { background: var(--am-border); }
.am-btn-pill__avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: block;
}
.am-btn-pill__icon { display: none; }

@media (max-width: 640px) {
    .am-btn-pill--auth span,
    .am-btn-pill--account span { display: none; }
    .am-btn-pill--auth,
    .am-btn-pill--account { padding: 0; width: 40px; justify-content: center; }
    .am-btn-pill--auth .am-btn-pill__icon { display: inline-flex; }
}

/* ── Hamburger ───────────────────────────────────────────── */
.am-hamburger {
    display: none;
    position: relative;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: var(--am-bg-alt);
    border: 1px solid var(--am-border);
    overflow: hidden;
    transition: background var(--am-transition-fast), border-color var(--am-transition-fast), transform var(--am-transition-fast);
}

.am-hamburger::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--am-primary), var(--am-accent));
    opacity: 0;
    transition: opacity var(--am-transition-fast);
}

.am-hamburger:hover {
    border-color: transparent;
    transform: translateY(-1px);
}
.am-hamburger:hover::before { opacity: 1; }

.am-hamburger:active { transform: scale(.93); }

.am-hamburger__line {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--am-text);
    border-radius: 2px;
    position: relative;
    z-index: 1;
    transition: transform .35s cubic-bezier(.65,0,.35,1),
                opacity .25s ease,
                width .35s cubic-bezier(.65,0,.35,1),
                background .25s ease;
    transform-origin: center;
}

.am-hamburger:hover .am-hamburger__line {
    background: #fff;
}

/* خط وسط کمی کوتاه‌تر برای ظاهر مدرن‌تر شبیه اپ */
.am-hamburger__line:nth-child(2) { width: 14px; align-self: flex-end; margin-right: 4px; }

.am-hamburger.is-active { background: transparent; border-color: transparent; }
.am-hamburger.is-active::before { opacity: 1; }
.am-hamburger.is-active .am-hamburger__line { background: #fff; }

/* X animation */
.am-hamburger.is-active .am-hamburger__line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
    width: 20px;
}
.am-hamburger.is-active .am-hamburger__line:nth-child(2) {
    opacity: 0;
    width: 0;
}
.am-hamburger.is-active .am-hamburger__line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ══════════════════════════════════════════════════════════
   SEARCH BAR
══════════════════════════════════════════════════════════ */
.am-search-bar {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--am-search-bg);
    border-top: 1px solid var(--am-border);
    padding: 1rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity var(--am-transition), transform var(--am-transition), visibility var(--am-transition);
    z-index: 98;
}

.am-search-bar.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.am-search-bar__form {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.am-search-bar__input {
    flex: 1;
    height: 44px;
    padding: 0 1rem;
    background: var(--am-bg);
    border: 1px solid var(--am-border);
    border-radius: var(--am-radius);
    font-size: 1rem;
    color: var(--am-text);
    outline: none;
    transition: border-color var(--am-transition-fast), box-shadow var(--am-transition-fast);
}

.am-search-bar__input:focus {
    border-color: var(--am-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.am-search-bar__submit {
    height: 44px;
    padding: 0 1.25rem;
    background: var(--am-primary);
    color: #fff;
    border: none;
    border-radius: var(--am-radius);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    font-size: .875rem;
    font-weight: 500;
    transition: background var(--am-transition-fast);
}

.am-search-bar__submit:hover {
    background: var(--am-primary-dark);
}

.am-search-bar__close {
    composes: am-btn-icon;
    /* fallback اگر CSS Modules نیست */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: var(--am-radius-sm);
    cursor: pointer;
    color: var(--am-text-muted);
    transition: color var(--am-transition-fast);
}

.am-search-bar__close:hover {
    color: var(--am-text);
}

/* ══════════════════════════════════════════════════════════
   MOBILE DRAWER
══════════════════════════════════════════════════════════ */
.am-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    max-width: 88vw;
    height: 100%;
    background: var(--am-drawer-bg);
    z-index: 10001; /* باید بالاتر از هر لایه‌ی نقشه (leaflet-popup-pane: 700) و پنل شناور (9990) بماند */
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    transform: translateX(105%);
    transition: transform .5s cubic-bezier(.16,1,.3,1);
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-bottom: 2rem;
    border-top-left-radius: 22px;
    border-bottom-left-radius: 22px;
    box-shadow: -18px 0 55px -18px rgba(15,23,42,.35);
    scrollbar-width: thin;
    scrollbar-color: var(--am-border) transparent;
}

.am-drawer::-webkit-scrollbar { width: 5px; }
.am-drawer::-webkit-scrollbar-thumb { background: var(--am-border); border-radius: 10px; }

.am-drawer.is-open {
    transform: translateX(0);
}

/* برچسب نور تزئینی بالای درور برای حس مدرن */
.am-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1.35rem 1.25rem 1.5rem;
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, var(--am-primary), #7c3aed 60%, var(--am-accent));
    z-index: 1;
    border-bottom-left-radius: 26px;
    overflow: hidden;
}

.am-drawer__header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120px 90px at 85% -20%, rgba(255,255,255,.35), transparent 70%);
    pointer-events: none;
}

.am-drawer__header-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.am-drawer__header-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: rgba(255,255,255,.18);
    backdrop-filter: blur(6px);
    color: #fff;
    flex-shrink: 0;
}
.am-drawer__header-logo img { width: 24px; height: 24px; object-fit: contain; display: block; }

.am-drawer__header-meta {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
}

.am-drawer__header-title {
    color: #fff;
    font-size: .95rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.am-drawer__header-sub {
    color: rgba(255,255,255,.8);
    font-size: .7rem;
    font-weight: 500;
}

.am-drawer__header #am-drawer-close {
    position: relative;
    z-index: 1;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 11px;
    background: rgba(255,255,255,.16);
    color: #fff;
    backdrop-filter: blur(6px);
}
.am-drawer__header #am-drawer-close:hover {
    background: rgba(255,255,255,.3);
    color: #fff;
}

.am-drawer__search {
    padding: 1.1rem 1.25rem .9rem;
    border-bottom: 1px solid var(--am-border);
}

.am-drawer__search input {
    width: 100%;
    height: 46px;
    padding: 0 1rem 0 1rem;
    padding-inline-start: 2.75rem;
    background: var(--am-bg-alt);
    border: 1.5px solid transparent;
    border-radius: 999px;
    font-size: .9rem;
    color: var(--am-text);
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    transition: border-color var(--am-transition-fast), box-shadow var(--am-transition-fast), background-color var(--am-transition-fast);
}

.am-drawer__search input:focus {
    border-color: var(--am-primary);
    background-color: var(--am-bg);
    box-shadow: 0 0 0 4px rgba(37,99,235,.14);
}

/* منو داخل drawer */
.am-drawer__nav {
    list-style: none;
    margin: 0;
    padding: .75rem .75rem .25rem;
}

.am-drawer__nav > li {
    opacity: 0;
    transform: translateX(14px);
}

.am-drawer.is-open .am-drawer__nav > li {
    animation: amNavItemIn .5s cubic-bezier(.22,1,.36,1) forwards;
}

.am-drawer.is-open .am-drawer__nav > li:nth-child(1)  { animation-delay: .08s; }
.am-drawer.is-open .am-drawer__nav > li:nth-child(2)  { animation-delay: .12s; }
.am-drawer.is-open .am-drawer__nav > li:nth-child(3)  { animation-delay: .16s; }
.am-drawer.is-open .am-drawer__nav > li:nth-child(4)  { animation-delay: .20s; }
.am-drawer.is-open .am-drawer__nav > li:nth-child(5)  { animation-delay: .24s; }
.am-drawer.is-open .am-drawer__nav > li:nth-child(6)  { animation-delay: .28s; }
.am-drawer.is-open .am-drawer__nav > li:nth-child(7)  { animation-delay: .32s; }
.am-drawer.is-open .am-drawer__nav > li:nth-child(8)  { animation-delay: .36s; }

@keyframes amNavItemIn {
    to { opacity: 1; transform: translateX(0); }
}

.am-drawer__nav li a {
    position: relative;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .7rem .85rem;
    margin: .1rem 0;
    border-radius: 13px;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--am-text);
    text-decoration: none;
    transition: color var(--am-transition-fast), background var(--am-transition-fast), transform var(--am-transition-fast);
}

/* نقطه‌ی تزئینی گرادیانی قبل از هر آیتم */
.am-drawer__nav > li > a::before {
    content: "";
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--am-primary), var(--am-accent));
    opacity: .55;
    transition: opacity var(--am-transition-fast), transform var(--am-transition-fast);
}

.am-drawer__nav li a:hover,
.am-drawer__nav li.current-menu-item > a {
    color: #fff;
    background: linear-gradient(135deg, var(--am-primary), var(--am-primary-dark));
    transform: translateX(-3px);
}
.am-drawer__nav li a:hover::before,
.am-drawer__nav li.current-menu-item > a::before {
    opacity: 1;
    background: #fff;
    transform: scale(1.2);
}

/* فلش برای آیتم‌های دارای زیرمنو */
.am-drawer__nav li.menu-item-has-children > a::after {
    content: "";
    margin-inline-start: auto;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    opacity: .55;
    transform: rotate(45deg);
    transition: transform var(--am-transition-fast);
}

.am-drawer__nav li.menu-item-has-children.open > a::after {
    transform: rotate(-135deg);
}

/* sub-menu در drawer */
.am-drawer__nav .sub-menu {
    list-style: none;
    padding: 0;
    margin: .2rem 0 .3rem;
    background: var(--am-bg-alt);
    border-radius: 13px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height var(--am-transition), opacity var(--am-transition-fast);
}

.am-drawer__nav .sub-menu.is-open {
    max-height: 500px;
    opacity: 1;
}

.am-drawer__nav .sub-menu a {
    padding-inline-start: 2.5rem;
    font-size: .85rem;
    font-weight: 500;
    border-radius: 0;
}
.am-drawer__nav .sub-menu a::before {
    width: 5px;
    height: 5px;
    opacity: .4;
}
.am-drawer__nav .sub-menu li:first-child a { border-top-left-radius: 13px; border-top-right-radius: 13px; }
.am-drawer__nav .sub-menu li:last-child a  { border-bottom-left-radius: 13px; border-bottom-right-radius: 13px; }

/* احراز هویت در drawer */
.am-drawer__auth {
    display: flex;
    flex-direction: column;
    gap: 0;
    /* قبلاً margin-top:auto بود و همیشه کارت کاربر را به ته درور می‌چسباند؛
       وقتی منو کم‌آیتم است (مثلاً فقط ۲-۳ لینک)، این باعث یک فاصله‌ی خالی
       و عجیب بین منو و کارت کاربر می‌شد. حالا فاصله‌ی ثابت و معقول دارد
       و طبیعی زیر منو قرار می‌گیرد، صرف‌نظر از تعداد آیتم‌های منو. */
    margin-top: 2.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--am-border);
}

/* ── کارت کاربر (لاگین‌شده) ──────────────────────────────── */
.am-drawer__user-card {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin: 0 1.25rem 1rem;
    padding: .9rem 1rem;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(37, 99, 235, .09), rgba(245, 158, 11, .07));
    border: 1px solid var(--am-border);
    opacity: 0;
    transform: translateY(12px);
}

.am-drawer.is-open .am-drawer__user-card {
    animation: amUserCardIn .55s .18s cubic-bezier(.22, 1, .36, 1) forwards;
}

.am-drawer__user-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    padding: 2.5px;
    background: linear-gradient(135deg, var(--am-primary), var(--am-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    animation: amAvatarPulse 2.6s ease-in-out infinite;
}

.am-drawer__user-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--am-drawer-bg);
    display: block;
    object-fit: cover;
}

.am-drawer__user-status {
    position: absolute;
    bottom: 1px;
    left: 1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--am-drawer-bg);
}

.am-drawer__user-meta {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
}

.am-drawer__user-greeting {
    font-size: .75rem;
    font-weight: 500;
    color: var(--am-text-muted);
}

.am-drawer__username {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.3;
    color: var(--am-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.am-drawer__user-actions {
    display: flex;
    flex-direction: column;
    gap: .625rem;
    padding: 0 1.25rem 1.25rem;
    opacity: 0;
    transform: translateY(12px);
}

.am-drawer.is-open .am-drawer__user-actions {
    animation: amUserCardIn .55s .28s cubic-bezier(.22, 1, .36, 1) forwards;
}

.am-drawer__guest-actions {
    display: flex;
    flex-direction: column;
    gap: .625rem;
    padding: 0 1.25rem 1.25rem;
}

@keyframes amUserCardIn {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes amAvatarPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .28); }
    50%      { box-shadow: 0 0 0 7px rgba(37, 99, 235, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .am-drawer__user-card,
    .am-drawer__user-actions { animation: none !important; opacity: 1; transform: none; }
    .am-drawer__user-avatar-wrap { animation: none !important; }
}

/* ── Shared Buttons ──────────────────────────────────────── */
.am-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    padding: 0 1.25rem;
    border-radius: 13px;
    font-size: .9375rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: background var(--am-transition-fast), color var(--am-transition-fast), border-color var(--am-transition-fast), transform var(--am-transition-fast), box-shadow var(--am-transition-fast);
}

.am-btn:active { transform: scale(.97); }

.am-btn--primary {
    background: linear-gradient(135deg, var(--am-primary), var(--am-primary-dark));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 20px -6px rgba(37,99,235,.55);
}

.am-btn--primary:hover {
    box-shadow: 0 10px 24px -6px rgba(37,99,235,.65);
    transform: translateY(-2px);
}

.am-btn--outline {
    background: transparent;
    color: var(--am-primary);
    border-color: var(--am-border);
}

.am-btn--outline:hover {
    background: var(--am-primary);
    border-color: var(--am-primary);
    color: #fff;
    transform: translateY(-2px);
}

.am-btn--ghost {
    background: transparent;
    color: var(--am-text-muted);
    border-color: var(--am-border);
}

.am-btn--ghost:hover {
    background: var(--am-bg-alt);
    color: var(--am-text);
}

/* دکمه‌ی «ثبت ملک» در بالای درور — پیل گرادیانی با آیکون */
.am-drawer__add-property {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin: 1.1rem 1.25rem 0;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--am-accent), #f97316);
    color: #fff !important;
    font-weight: 800;
    font-size: .9375rem;
    box-shadow: 0 10px 24px -8px rgba(245,158,11,.55);
    transition: transform var(--am-transition-fast), box-shadow var(--am-transition-fast);
}
.am-drawer__add-property::before {
    content: "";
    width: 18px;
    height: 18px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E") center / contain no-repeat;
    flex-shrink: 0;
}
.am-drawer__add-property:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -8px rgba(245,158,11,.65);
}

/* دکمه‌ی «ثبت ملک» در خودِ هدر دسکتاپ — CTA اصلی سایت باید همیشه دیده شود،
   نه فقط داخل درور موبایل که با یک کلیک اضافه باز می‌شود. */
.am-header__add-property {
    display: flex;
    align-items: center;
    gap: .4rem;
    height: 40px;
    padding: 0 1.1rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--am-accent), #f97316);
    color: #fff !important;
    font-weight: 800;
    font-size: .875rem;
    white-space: nowrap;
    box-shadow: 0 8px 18px -6px rgba(245,158,11,.5);
    transition: transform var(--am-transition-fast), box-shadow var(--am-transition-fast);
}
.am-header__add-property-icon {
    width: 16px;
    height: 16px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E") center / contain no-repeat;
    flex-shrink: 0;
}
.am-header__add-property:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -6px rgba(245,158,11,.6);
    color: #fff !important;
}
/* در موبایل همان دکمه بالای درور هست؛ برای جلوگیری از تکرار و شلوغی نوار هدر، این‌جا مخفی می‌شود */
@media (max-width: 900px) {
    .am-header__add-property { display: none; }
}

/* ══════════════════════════════════════════════════════════
   OVERLAY
══════════════════════════════════════════════════════════ */
.am-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(15,23,42,.6), rgba(30,41,59,.5));
    z-index: 10000; /* هم‌راستا با am-drawer، باید بالاتر از تمام لایه‌های نقشه بماند */
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--am-transition), visibility var(--am-transition);
    backdrop-filter: blur(4px);
}

.am-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1024px) {
    .am-nav {
        display: none;
    }

    .am-hamburger {
        display: flex;
    }

    .am-topbar__contact {
        gap: .75rem;
    }
}

/* Mobile */
@media (max-width: 640px) {
    :root {
        --am-topbar-h: 38px;
    }

    .am-topbar__contact {
        display: none;
    }

    .am-topbar__actions {
        margin-inline: auto;
    }

    .am-topbar__login,
    .am-topbar__register {
        font-size: .75rem;
        padding: .15rem .6rem;
    }

    .am-header__logo img,
    .am-header__logo .custom-logo {
        height: 36px;
    }

    .am-container {
        padding-inline: 1rem;
    }

    .am-header__tools {
        gap: .35rem;
    }

    /* فاصله‌ی امن از نوار وضعیت/بریدگی گوشی؛ روی دستگاه‌های بدون
       بریدگی این مقدار صفر است و هیچ فاصله‌ی اضافه‌ای ایجاد نمی‌کند */
    .am-header {
        padding-top: env(safe-area-inset-top, 0px);
        height: calc(var(--am-header-h) + env(safe-area-inset-top, 0px));
    }
}

@media (max-width: 360px) {
    .am-header__tools {
        gap: .2rem;
    }
    .am-btn-icon,
    .am-theme-toggle-btn,
    .am-hamburger {
        width: 38px;
        height: 38px;
    }
}

/* ══════════════════════════════════════════════════════════
   BODY LOCK (when drawer open)
══════════════════════════════════════════════════════════ */
body.am-drawer-open {
    overflow: hidden;
}

/* ══════════════════════════════════════════════════════════
   SCROLL REVEAL ANIMATION (header entrance)
══════════════════════════════════════════════════════════ */
@keyframes am-slideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.am-header {
    animation: am-slideDown .4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.am-topbar {
    animation: am-slideDown .3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ═══════════════════════════════════════════════════════════
   FLOATING SIDE PANEL
═══════════════════════════════════════════════════════════ */

.am-floating-panel {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9990;
    display: flex;
    align-items: center;
    direction: ltr;
}

/* تب باز/بسته */
.am-panel__tab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 72px;
    background: var(--am-primary);
    color: #fff;
    border: none;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    box-shadow: 3px 0 16px rgba(37,99,235,.35);
    transition: width var(--am-transition), background var(--am-transition), box-shadow var(--am-transition);
    flex-shrink: 0;
    padding: 0;
    outline: none;
}

.am-panel__tab:hover,
.am-panel__tab:focus-visible {
    width: 34px;
    background: var(--am-primary-dark);
    box-shadow: 4px 0 20px rgba(37,99,235,.5);
}

.am-panel__tab:focus-visible {
    outline: 2px solid var(--am-accent);
    outline-offset: 2px;
}

.am-panel__tab svg {
    transition: transform var(--am-transition);
    flex-shrink: 0;
}

/* چرخش آیکون وقتی باز است */
.am-floating-panel.is-open .am-panel__tab svg {
    transform: rotate(180deg) scaleX(-1);
}

/* بدنه پنل */
.am-panel__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--am-header-bg);
    border-radius: 0 12px 12px 0;
    padding: 14px 10px;
    box-shadow: 4px 0 24px rgba(0,0,0,.12), 0 0 0 1px var(--am-border);
    /* بسته: بیرون از صفحه */
    transform: translateX(-110%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.38s cubic-bezier(0.34,1.26,0.64,1), opacity 0.28s ease;
    min-width: 80px;
}

.am-floating-panel.is-open .am-panel__body {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* آیتم */
.am-panel__item {
    display: flex;
    justify-content: center;
}

/* دکمه‌های داخل پنل */
.am-panel__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 8px;
    border: none;
    border-radius: var(--am-radius-sm);
    cursor: pointer;
    text-decoration: none;
    background: transparent;
    color: var(--am-text);
    font-size: .7rem;
    font-weight: 500;
    font-family: inherit;
    width: 60px;
    transition: background var(--am-transition-fast), color var(--am-transition-fast), transform var(--am-transition-fast);
    position: relative;
    line-height: 1.2;
    text-align: center;
}

.am-panel__btn:hover {
    background: var(--am-bg-alt);
    transform: translateX(2px);
}

/* آیکون‌ها */
.am-fp-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--am-bg-alt);
    transition: background var(--am-transition-fast), box-shadow var(--am-transition-fast);
    flex-shrink: 0;
}

.am-panel__btn:hover .am-fp-icon {
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

/* تم toggle */
.am-panel__btn--theme {
    color: var(--am-text-muted);
}

.am-panel__btn--theme:hover {
    color: var(--am-accent);
}

.am-panel__btn--theme:hover .am-fp-icon {
    background: rgba(245,158,11,.1);
}

/* آیکون خورشید/ماه */
.am-fp-icon--sun,
.am-fp-icon--moon {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: auto;
    border-radius: 50%;
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.34,1.26,0.64,1);
}

.am-panel__btn--theme .am-fp-icon {
    position: relative;
    height: 36px;
    width: 36px;
}

/* حالت روشن: خورشید */
.am-fp-icon--sun  { opacity: 1; transform: rotate(0deg) scale(1); }
.am-fp-icon--moon { opacity: 0; transform: rotate(-90deg) scale(.5); }

/* حالت تاریک: ماه */
[data-theme="dark"] .am-fp-icon--sun  { opacity: 0; transform: rotate(90deg) scale(.5); }
[data-theme="dark"] .am-fp-icon--moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* ورود */
.am-panel__btn--login:hover { color: var(--am-primary); }
.am-panel__btn--login:hover .am-fp-icon { background: rgba(37,99,235,.1); color: var(--am-primary); }

/* ثبت‌نام */
.am-panel__btn--register:hover { color: #10b981; }
.am-panel__btn--register:hover .am-fp-icon { background: rgba(16,185,129,.1); color: #10b981; }

/* حساب کاربری */
.am-panel__btn--account:hover { color: var(--am-primary); }
.am-panel__btn--account:hover .am-fp-icon { background: rgba(37,99,235,.1); }

/* خروج */
.am-panel__btn--logout:hover { color: #ef4444; }
.am-panel__btn--logout:hover .am-fp-icon { background: rgba(239,68,68,.1); color: #ef4444; }

/* آواتار */
.am-fp-avatar {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50%;
    object-fit: cover;
}

/* خط جدا‌کننده */
.am-panel__divider {
    height: 1px;
    background: var(--am-border);
    margin: 2px 4px;
}

/* لیبل */
.am-panel__label {
    font-size: .68rem;
    color: var(--am-text-muted);
    white-space: nowrap;
    transition: color var(--am-transition-fast);
}

.am-panel__btn:hover .am-panel__label {
    color: inherit;
}

/* انیمیشن ورود آیتم‌ها با تاخیر */
.am-floating-panel.is-open .am-panel__item:nth-child(1) { transition-delay: 0.03s; }
.am-floating-panel.is-open .am-panel__item:nth-child(2) { transition-delay: 0.07s; }
.am-floating-panel.is-open .am-panel__item:nth-child(3) { transition-delay: 0.11s; }
.am-floating-panel.is-open .am-panel__item:nth-child(4) { transition-delay: 0.15s; }
.am-floating-panel.is-open .am-panel__item:nth-child(5) { transition-delay: 0.19s; }

/* dark mode */
[data-theme="dark"] .am-panel__body {
    box-shadow: 4px 0 24px rgba(0,0,0,.4), 0 0 0 1px var(--am-border);
}

[data-theme="dark"] .am-panel__tab {
    box-shadow: 3px 0 16px rgba(37,99,235,.5);
}

/* موبایل: کوچک‌تر */
@media (max-width: 640px) {
    .am-panel__btn {
        width: 52px;
        padding: 8px 4px;
    }
    .am-panel__body {
        padding: 10px 6px;
    }
}
/* Override logo size to allow customizer control */
.am-site-header__logo img {
    max-height: 80px !important;
    width: auto !important;
    height: auto !important;
}

/* ============================================================
   MOBILE FOOTER — فوتر مخصوص موبایل
   فقط در صفحات زیر 768px نمایش داده می‌شود
   ============================================================ */

/* پنهان کردن فوتر دسکتاپ در موبایل */
@media (max-width: 768px) {
    .desktop-footer {
        display: none !important;
    }
}

/* نمایش فوتر موبایل فقط در موبایل */
.mobile-footer {
    display: none;
    background: #12142b;
    color: #fff;
    direction: rtl;
    font-family: inherit;
}

@media (max-width: 768px) {
    .mobile-footer {
        display: block;
    }
}

/* ---- بخش بالایی: لوگو + شبکه‌های اجتماعی ---- */
.mf-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 20px 18px;
}

.mf-logo {
    display: flex;
    align-items: center;
}

.mf-logo img {
    height: 32px;
    width: auto;
    filter: brightness(0) invert(1);
}

.mf-logo-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #a78bfa, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mf-social {
    display: flex;
    gap: 8px;
}

.mf-social-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: background 0.2s, transform 0.2s, color 0.2s;
}

.mf-social-btn svg {
    width: 16px;
    height: 16px;
}

.mf-social-btn:active {
    background: rgba(167, 139, 250, 0.25);
    color: #fff;
    transform: scale(0.93);
}

/* ---- دکمه‌های تماس سریع ---- */
.mf-quick-contact {
    display: flex;
    gap: 10px;
    padding: 4px 20px 20px;
}

.mf-contact-btn {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.15s ease, background 0.2s ease;
    overflow: hidden;
}

.mf-contact-btn__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
}

.mf-contact-btn__icon svg {
    width: 14px;
    height: 14px;
}

.mf-contact-btn:hover {
    transform: translateY(-2px);
}

.mf-contact-btn:active {
    transform: scale(0.97) translateY(0);
    opacity: 0.9;
}

/* دکمه «تماس تلفنی» — گرادیان نرم با حلقه‌ی پالسِ ملایم دور دکمه */
.mf-call {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.38);
}
.mf-call:hover {
    box-shadow: 0 12px 26px rgba(102, 126, 234, 0.46);
}

.mf-call-ring {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55);
    animation: mfCallPulse 2.4s ease-out infinite;
    pointer-events: none;
}

@keyframes mfCallPulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45); }
    70%  { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* دکمه «ثبت تیکت پشتیبانی» — جایگزین دکمه تماس تلفنی وقتی از تنظیمات فعال شود */
.mf-ticket {
    background: linear-gradient(135deg, #10b981, #0891b2);
    color: #fff;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.32);
}
.mf-ticket:hover {
    box-shadow: 0 12px 26px rgba(16, 185, 129, 0.4);
}
.mf-ticket .mf-contact-btn__icon {
    background: rgba(255, 255, 255, 0.2);
}

.mf-email {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.mf-email:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.22);
}
.mf-email .mf-contact-btn__icon {
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 380px) {
    .mf-contact-btn__text { font-size: 12.5px; }
}

/* ---- نوار اعتمادسازی یکپارچه ---- */
.mf-trust-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.mf-trust-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    white-space: nowrap;
}

.mf-trust-chip svg {
    flex-shrink: 0;
    color: #34d399;
}

.mf-trust-chip--enamad {
    padding: 2px 6px;
    background: transparent;
}

.mf-trust-chip--enamad img,
.mf-trust-chip--enamad iframe {
    max-height: 30px;
    width: auto;
    border-radius: 6px;
    display: block;
}

/* ---- آکاردئون لینک‌ها — نسخه‌ی مدرن: کارت‌های گرد و مجزا با آیکون،
   به‌جای ردیف‌های تخت با خط جداکننده‌ی ساده ---- */
.mf-accordion {
    padding: 4px 20px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mf-accordion-item {
    border-bottom: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.mf-accordion-item:has(.mf-accordion-btn[aria-expanded="true"]) {
    background: rgba(167, 139, 250, 0.08);
    border-color: rgba(167, 139, 250, 0.25);
}

.mf-accordion-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    direction: rtl;
    position: relative;
}

.mf-accordion-btn:active {
    opacity: 0.7;
}

.mf-accordion-btn__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.22), rgba(96, 165, 250, 0.22));
    color: #c4b5fd;
}

.mf-accordion-btn__label {
    flex: none;
}

.mf-chevron {
    transition: transform 0.3s ease;
    flex-shrink: 0;
    opacity: 0.5;
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.mf-accordion-btn[aria-expanded="true"] .mf-chevron {
    transform: translateY(-50%) rotate(180deg);
    opacity: 0.9;
}

.mf-accordion-body {
    list-style: none;
    margin: 0;
    padding: 0 10px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
}

.mf-accordion-body.open {
    max-height: 300px;
    padding: 0 10px 10px;
}

.mf-accordion-body li a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 8px;
    margin: 0 4px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 13.5px;
    transition: color 0.2s, background 0.2s;
}

.mf-link-icon {
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.mf-accordion-body li a:active .mf-link-icon {
    opacity: 1;
}

.mf-accordion-body li a:active {
    color: #c4b5fd;
    background: rgba(255, 255, 255, 0.05);
}

/* ---- بخش کپی‌رایت ---- */
.mf-bottom {
    padding: 18px 20px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.mf-bottom p {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.4);
    max-width: 280px;
}

.mf-bottom-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.mf-bottom-links a {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
}

.mf-bottom-links a:active {
    color: #a78bfa;
}

.mf-bottom-links span {
    opacity: 0.3;
    font-size: 11px;
}

/* ---- فضای رزروشده در انتهای فوتر ----
   دکمه‌های شناور (بازگشت به بالا، بازگشت به خانه، نصب اپلیکیشن) روی
   نوار پایین سایت (--am-bottom-stack) سوار می‌شوند و کمی بالاتر از آن
   می‌نشینند. بدون این فاصله‌ی خالی، وقتی صفحه تا انتها اسکرول شود این
   دکمه‌ها دقیقاً روی متن کپی‌رایت می‌افتند — همان چیزی که در گزارش
   کاربر «به‌هم‌ریختگی فوتر موبایل» دیده می‌شد. */
.mf-fab-clearance {
    height: 0;
}

@media (max-width: 768px) {
    .mf-fab-clearance {
        height: 64px;
    }
}

/* ---- نوار شناور تماس فوری (Sticky CTA) — فقط موبایل ---- */
.mf-sticky-cta {
    display: none;
}

@media (max-width: 768px) {
    .mf-sticky-cta {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 997;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
        background: rgba(15, 15, 30, 0.72);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
    }
}

.mf-sticky-cta__btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px;
    border-radius: 14px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 14.5px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(102, 126, 234, 0.4);
    overflow: hidden;
    transition: transform 0.15s, opacity 0.2s;
}

.mf-sticky-cta__btn:active {
    transform: scale(0.97);
    opacity: 0.9;
}

.mf-sticky-cta__pulse {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    animation: mfCallPulse 2.4s ease-out infinite;
    pointer-events: none;
}
