/* Tokens for navbar live in design-system.css — both --primary-brand /
   --brand-dark / --border-color and the canonical --ds-* names work. */

/* Box-Style Navbar - Not Full Screen */
.modern-navbar {
  position: fixed;
  /* When the profile-completion banner is rendered, body sets
     --ds-banner-h to its height so the navbar shifts down and the two
     never overlap. Default banner height is 0. */
  top: calc(20px + var(--ds-banner-h, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--ds-z-navbar);
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
  backdrop-filter: blur(16px);
  /* Explicit transition list — `transition: all 0.6s` was forcing layout
     thrash on every state change and felt sluggish on mid-tier phones. */
  transition: background var(--ds-normal),
              border-color var(--ds-normal),
              border-radius var(--ds-normal),
              box-shadow var(--ds-normal),
              transform var(--ds-normal),
              width var(--ds-normal),
              top var(--ds-normal);
  height: 70px;
  width: 95%;
  max-width: 1200px;
  /* Note: no `overflow: hidden` here — that clipped the absolutely-positioned
     `.dropdown-menu` so dropdowns appeared not to open on hover. Brand-text
     overflow on narrow phones is clipped on `.navbar-brand` itself. */
  overflow: visible;
  will-change: transform;
}

/* Owner feedback: navbar stays box-style on every page (no full-width). */

/* Add padding to body for property listing page */
body.property-listing-page {
  padding-top: calc(var(--ds-navbar-h) + var(--ds-banner-h, 0px));
  transition: padding-top 0.3s ease-in-out;
}

/* Add padding to body for property detail page */
body.property-detail-page {
  padding-top: calc(var(--ds-navbar-h) + var(--ds-banner-h, 0px));
  transition: padding-top 0.3s ease-in-out;
}

/* Remove padding when navbar is hidden on property detail page */
body.property-detail-page.navbar-hidden {
  padding-top: 0;
}

/* Remove padding when navbar is hidden */
body.property-listing-page.navbar-hidden {
  padding-top: 0;
}

/* Make sidebar sticky and adjust position when navbar is hidden */
body.property-listing-page .sticky-sidebar {
  position: sticky;
  top: calc(var(--ds-navbar-h) + var(--ds-space-4));
  transition: top 0.3s ease-in-out;
}

body.property-listing-page.navbar-hidden .sticky-sidebar {
  top: 20px;
}


/* Sticky navbar when search is visible - Full Width */
.modern-navbar.search-visible {
  /* Profile banner (when present) sits above; --ds-banner-h pushes the
     sticky navbar down by the same amount so it doesn't overlay the banner. */
  top: var(--ds-banner-h, 0px);
  left: 0;
  transform: translateX(0);
  width: 100%;
  max-width: none;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(20px);
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  position: relative;
  transition: padding var(--ds-normal), max-width var(--ds-normal);
  gap: 1.5rem;
}

/* Full width container when navbar is sticky */
.modern-navbar.search-visible .navbar-container {
  max-width: none;
  padding: 0 3rem;
}

/* Brand Section */
.navbar-brand {
  flex-shrink: 1;
  min-width: 0;
  z-index: 10;
  position: relative;
  margin-right: 1rem;
  opacity: 1;
  /* Replaces the navbar-wide `overflow: hidden` so brand text still clips at
     narrow widths without trapping the dropdown menus. */
  overflow: hidden;
  transform: translateX(0) scale(1);
  transition: opacity 0.5s cubic-bezier(0.25, 0.8, 0.25, 1),
              transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1),
              margin 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
  will-change: transform, opacity, margin;
}

.modern-navbar.search-focused .navbar-brand {
  margin-right: 3rem;
  transform: translateX(0) scale(0.95);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--primary-text);
  transition: all 0.3s ease;
}

.brand-link:hover {
  text-decoration: none;
  color: var(--primary-brand);
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ds-brand-50) 0%, #fff 100%);
  border: 1px solid var(--ds-brand-100);
  color: var(--ds-brand);
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}
.brand-icon img {
  width: 24px;
  height: 24px;
  display: block;
}
.brand-link:hover .brand-icon {
  transform: rotate(-4deg) scale(1.06);
  box-shadow: 0 6px 16px rgba(0, 166, 147, 0.18);
}

.brand-text {
  font-size: var(--ds-text-2xl);
  font-weight: 800;
  color: var(--primary-brand);
}

/* Navigation */
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  margin: 0 auto 0 2rem;
  flex: 1;
  justify-content: flex-start;
  opacity: 1;
  transform: translateX(0) scale(1);
  transition: opacity 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0.1s,
              transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0.1s;
  will-change: transform, opacity;
}

/* Search focused state - adjust layout */
.modern-navbar.search-focused .navbar-nav {
  opacity: 0;
  transform: translateX(-30px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.6, 1),
              transform 0.4s cubic-bezier(0.4, 0, 0.6, 1);
}

/* Hide nav elements when search is visible and focused */
.modern-navbar.search-visible.search-focused .navbar-nav {
  display: none;
}

/* Simple search mode - only logo and search */
.modern-navbar.search-simple .navbar-nav,
.modern-navbar.search-simple .navbar-actions {
  display: none;
}

.modern-navbar.search-simple .navbar-search.visible {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}

/* Ensure search is hidden by default */
.navbar-search {
  display: none;
  opacity: 0;
  pointer-events: none;
}

/* Only show search when explicitly visible */
.modern-navbar.search-visible .navbar-search.visible,
.modern-navbar.search-simple .navbar-search.visible {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}

/* Force show search in simple mode */
.modern-navbar.search-simple .navbar-search {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}

.modern-navbar.search-simple .navbar-search.visible {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* Also ensure search-visible state shows search */
.modern-navbar.search-visible .navbar-search {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.8rem 0.5rem;
  color: var(--primary-text);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--ds-text-base);
  transition: all 0.3s ease;
  position: relative;
  border-radius: 8px;
}

.nav-link:hover {
  color: var(--primary-brand);
  text-decoration: none;
  background: rgba(0, 166, 147, 0.05);
}
.nav-link:focus-visible,
.brand-link:focus-visible,
.user-btn:focus-visible,
.auth-btn:focus-visible,
.post-ad-btn-new:focus-visible,
.dropdown-item:focus-visible {
  outline: 2px solid var(--ds-brand);
  outline-offset: 2px;
  border-radius: var(--ds-radius-sm);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary-brand);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.nav-link:hover::after {
  transform: scaleX(1);
}

/* Enhanced Dropdown Menus */
.dropdown {
  position: relative;
}

/* Invisible hover bridge across the visual gap between the trigger and the
   menu. Without this, the cursor leaves `.dropdown` while traversing the
   8px gap and the menu vanishes before the user can reach it. */
.dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 0.6rem;
  background: transparent;
}

.dropdown-toggle i {
  font-size: var(--ds-text-xs);
  transition: transform 0.3s ease;
}

.dropdown:hover .dropdown-toggle i,
.dropdown:focus-within .dropdown-toggle i {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 12px;
  box-shadow: var(--ds-shadow-lg);
  padding: 0.75rem 0;
  min-width: 280px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 200ms var(--ds-ease),
              transform 200ms var(--ds-ease),
              visibility 200ms var(--ds-ease);
  z-index: var(--ds-z-dropdown);
  margin-top: 0.5rem;
  white-space: nowrap;
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.5rem;
  color: var(--primary-text);
  text-decoration: none;
  font-size: var(--ds-text-sm);
  transition: background var(--ds-fast), color var(--ds-fast),
              transform var(--ds-fast);
  border-radius: 8px;
  margin: 0 0.5rem;
  font-family: inherit;
  text-align: inherit;
}
.dropdown-item--button {
  width: calc(100% - 1rem);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: var(--ds-text-sm);
}

.dropdown-item:hover {
  background: rgba(0, 166, 147, 0.08);
  color: var(--primary-brand);
  text-decoration: none;
  transform: translateX(-5px);
}

.dropdown-item i {
  width: 16px;
  text-align: center;
  color: var(--secondary-text);
  font-size: var(--ds-text-sm);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.5rem 0;
}

/* Search bar — sits inline inside the navbar shell, never absolute.
   The previous version used position:absolute + translate(-50%) which
   broke out of the contained navbar bounds and overflowed on scroll. */
.navbar-search {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 520px;
  margin: 0 1.25rem;
  opacity: 0;
  pointer-events: none;
  display: none;
  transition: opacity var(--ds-normal);
}

.navbar-search.visible {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}

/* Focused / scrolled-sticky / simple states all keep the search inline.
   On scroll the nav links + actions are hidden, so we center the search by
   pushing it with auto margins on both sides — otherwise the input clings
   to the left of the navbar (after the right-side brand in RTL) and looks
   "out of" the navbar. */
.modern-navbar.search-focused .navbar-search,
.modern-navbar.search-visible .navbar-search,
.modern-navbar.search-visible.search-focused .navbar-search,
.modern-navbar.search-simple .navbar-search {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  flex: 0 1 520px;
  min-width: 0;
  max-width: 520px;
  margin-inline: auto;
  display: flex;
  justify-content: center;
}

.search-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ds-radius-pill);
  width: 100%;
}

/* Pill input that fits the navbar height (70px shell - 12px breathing).
   No translate-Y on hover so the input stays stable inside the navbar.
   Logical inline padding so the button-side reserves room in RTL — the
   magnifier sits at `inset-inline-start: 6px`, i.e. the visual right edge
   in fa-IR; the physical-`padding-left` it used to use reserved space on
   the wrong side and the placeholder slid under the button. */
.search-input {
  width: 100%;
  padding: 0.6rem 1rem;
  padding-inline-start: 2.75rem;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-pill);
  font-size: var(--ds-text-sm);
  color: var(--primary-text);
  background: var(--ds-surface-2);
  text-align: right;
  direction: rtl;
  font-weight: 500;
  outline: none;
  height: 42px;
  box-sizing: border-box;
  transition: background var(--ds-fast), border-color var(--ds-fast), box-shadow var(--ds-fast);
}

.search-input:hover {
  background: var(--ds-surface);
  border-color: var(--ds-brand-100);
}

.search-input:focus {
  background: var(--ds-surface);
  border-color: var(--ds-brand);
  box-shadow: 0 0 0 3px rgba(0, 166, 147, 0.12);
}

.search-input::placeholder {
  color: rgba(125, 139, 148, 0.6);
  text-align: right;
  font-weight: 400;
  font-size: var(--ds-text-base);
  transition: all 0.3s ease;
}

.search-input:focus::placeholder {
  color: rgba(125, 139, 148, 0.4);
  transform: translateX(5px);
}

.search-input:hover::placeholder {
  color: rgba(125, 139, 148, 0.5);
}

.search-container .search-btn {
  position: absolute;
  inset-inline-start: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ds-brand);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--ds-fast);
  font-size: var(--ds-text-sm);
}

.search-container .search-btn:hover { background: var(--ds-brand-700); }

/* User Actions */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-shrink: 0;
  margin-left: 1.5rem;
  opacity: 1;
  transform: translateX(0) scale(1);
  transition: opacity 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0.15s,
              transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0.15s;
  will-change: transform, opacity;
}

.modern-navbar.search-focused .navbar-actions {
  opacity: 0;
  transform: translateX(30px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.6, 1),
              transform 0.4s cubic-bezier(0.4, 0, 0.6, 1);
}

/* Hide user actions when search is visible and focused but show only the post ad button */
.modern-navbar.search-visible.search-focused .navbar-actions {
  display: flex;
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

.modern-navbar.search-visible.search-focused .navbar-actions .auth-btn,
.modern-navbar.search-visible.search-focused .navbar-actions .user-menu,
.modern-navbar.search-visible.search-focused .navbar-actions .auth-dropdown,
.modern-navbar.search-visible.search-focused .navbar-actions .register-btn {
  display: none;
}

/* Keep only the post ad button visible in search mode */
.modern-navbar.search-visible.search-focused .navbar-actions .post-ad-btn-new {
  display: flex;
}

.auth-btn {
  padding: 0.7rem 1.5rem;
  border-radius: 28px;
  text-decoration: none;
  font-weight: 600;
  font-size: var(--ds-text-sm);
  transition: all 0.3s ease;
  text-align: center;
  white-space: nowrap;
}

.login-btn {
  color: var(--primary-text);
  border: 1px solid var(--border-color);
  background: transparent;
}

.login-btn:hover {
  color: var(--primary-brand);
  border-color: var(--primary-brand);
  text-decoration: none;
}

.signup-btn {
  color: white;
  background: var(--primary-brand);
  border: 1px solid var(--primary-brand);
}

.signup-btn:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 166, 147, 0.3);
}

/* Register Button - White with Green Border */
.register-btn {
  color: var(--primary-brand);
  background: white;
  border: 2px solid var(--primary-brand);
}

.register-btn:hover {
  background: var(--primary-brand);
  border-color: var(--primary-brand);
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 166, 147, 0.3);
}

/* Anonymous auth group: ghost "ورود" link + outlined "ثبت‌نام" pill. */
.auth-btns { gap: 0.25rem; }
.auth-link-login {
  color: var(--primary-text);
  font-weight: 600;
  font-size: var(--ds-text-sm);
  padding: 0.7rem 0.95rem;
  border-radius: 28px;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease;
}
.auth-link-login:hover {
  color: var(--ds-brand);
  background: var(--ds-brand-50);
}

/* Login/Register Dropdown Button */
.login-register-btn {
  color: var(--primary-text);
  background: white;
  border: 1px solid var(--border-color);
  padding: 0.7rem 1.5rem;
  border-radius: 28px;
  font-weight: 600;
  font-size: var(--ds-text-sm);
  transition: all 0.3s ease;
  text-align: center;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.login-register-btn:hover {
  color: var(--primary-brand);
  border-color: var(--primary-brand);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 166, 147, 0.1);
}

.login-register-btn i.fa-chevron-down {
  font-size: var(--ds-text-xs);
  transition: transform 0.3s ease;
}

.auth-menu:hover .login-register-btn i.fa-chevron-down {
  transform: rotate(180deg);
}

/* Auth Dropdown */
.auth-dropdown {
  right: 0;
  min-width: 180px;
}

/* Enhanced Post Ad Button */
.post-ad-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 2rem;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 30px;
  font-weight: 700;
  font-size: var(--ds-text-base);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.3);
  text-decoration: none;
}

.post-ad-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 107, 53, 0.4);
  text-decoration: none;
  color: white;
}

/* New Post Ad Button - Green Style */
.post-ad-btn-new {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  background: var(--primary-brand);
  color: white;
  border: 2px solid transparent;
  border-radius: 24px;
  font-weight: 600;
  font-size: var(--ds-text-sm);
  cursor: pointer;
  transition: background var(--ds-fast), color var(--ds-fast),
              transform var(--ds-fast), box-shadow var(--ds-fast);
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(0, 166, 147, 0.3);
  text-decoration: none;
}
.post-ad-btn-new__text { line-height: 1; }

.post-ad-btn-new:hover {
  background: var(--brand-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 166, 147, 0.4);
  text-decoration: none;
  color: white;
}

/* Tablet (≤980 px): the «ثبت آگهی رایگان» wording collides with search +
   user menu. Collapse to icon only and rely on aria-label. */
@media (max-width: 980px) {
  .post-ad-btn-new { padding: 0.55rem 0.7rem; }
  .post-ad-btn-new__text { display: none; }
  .post-ad-btn-new i { font-size: var(--ds-text-base); }
}


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

.user-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 28px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--primary-text);
  white-space: nowrap;
}

.user-btn:hover {
  border-color: var(--primary-brand);
  color: var(--primary-brand);
  box-shadow: 0 2px 8px rgba(0, 166, 147, 0.1);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--primary-brand);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ds-text-sm);
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.user-name {
  font-weight: 500;
  font-size: var(--ds-text-sm);
}

.user-dropdown {
  right: 0;
  min-width: 240px;
}

.user-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-dropdown .dropdown-item i {
  width: 16px;
  text-align: center;
  color: var(--secondary-text);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
}

.mobile-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background: var(--primary-text);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 1px;
  transform-origin: center;
}

.mobile-toggle-btn.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-toggle-btn.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scale(0);
}

.mobile-toggle-btn.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Enhanced Mobile Menu */
.mobile-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--primary-bg);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  padding: 1.5rem;
  display: none;
  border-radius: 0 0 20px 20px;
}

.mobile-search {
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.mobile-search .search-input {
  padding: 1rem 3.5rem 1rem 1.25rem;
  font-size: var(--ds-text-base);
  background: var(--secondary-bg);
  border-radius: 16px;
  border: 2px solid var(--border-color);
  min-height: 52px;
}

.mobile-search .search-btn {
  width: 40px;
  height: 40px;
  right: 0.75rem;
}

.mobile-nav-section {
  margin-bottom: 2rem;
}

.mobile-section-title {
  font-size: var(--ds-text-lg);
  font-weight: 700;
  color: var(--primary-brand);
  margin-bottom: 1rem;
  padding: 0 0.5rem;
  border-bottom: 2px solid var(--primary-brand);
  display: inline-block;
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.mobile-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 0.5rem;
  margin-top: 1rem;
}

.mobile-action-btn.primary {
  background: var(--primary-brand);
  color: white;
  border-color: var(--primary-brand);
}

.mobile-action-btn.primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: white;
}

.mobile-action-btn.post-ad {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.mobile-action-btn.post-ad:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: white;
}

.mobile-action-btn.logout {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fecaca;
}

.mobile-action-btn.logout:hover {
  background: #fecaca;
  border-color: #dc2626;
  color: #dc2626;
}

/* Mobile User Info Section */
.mobile-user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--secondary-bg);
  border-radius: 16px;
  margin-bottom: 1.5rem;
  border: 2px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Mobile Auth Section */
.mobile-auth-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--secondary-bg);
  border-radius: 16px;
  border: 2px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.mobile-auth-title {
  font-size: var(--ds-text-lg);
  font-weight: 700;
  color: var(--primary-brand);
  margin-bottom: 1rem;
  padding: 0 0.5rem;
  border-bottom: 2px solid var(--primary-brand);
  display: inline-block;
  text-align: center;
  width: 100%;
}

.mobile-user-avatar {
  width: 48px;
  height: 48px;
  background: var(--primary-brand);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ds-text-lg);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 166, 147, 0.2);
  overflow: hidden;
}

.mobile-user-avatar .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.mobile-user-name {
  font-weight: 600;
  color: var(--primary-text);
  font-size: var(--ds-text-lg);
}

.mobile-divider {
  height: 1px;
  background: var(--border-color);
  margin: 1rem 0;
  opacity: 0.6;
}

/* Enhanced Mobile Action Buttons */
.mobile-action-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-start;
  text-align: right;
  padding: 1rem 1.5rem;
  font-size: var(--ds-text-base);
  min-height: 56px;
  border-radius: 16px;
  transition: all 0.3s ease;
  font-weight: 600;
  margin: 0.5rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  color: var(--primary-text);
  border: 1px solid var(--border-color);
  background: var(--primary-bg);
}

.mobile-action-btn:active {
  transform: scale(0.96) translateY(1px);
}

.mobile-action-btn:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
  text-decoration: none;
}

.mobile-action-btn i {
  width: 16px;
  text-align: center;
  color: var(--secondary-text);
  flex-shrink: 0;
}

.mobile-nav-item {
  padding: 1.2rem 1rem;
  font-size: var(--ds-text-base);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.3s ease;
  border-radius: 12px;
  margin: 0.25rem 0;
  background: transparent;
  border: 1px solid transparent;
  min-height: 52px;
  font-weight: 500;
  text-align: center;
  justify-content: center;
  text-decoration: none;
  color: var(--primary-text);
}

.mobile-nav-item:hover,
.mobile-nav-item:active {
  background: rgba(0,166,147,0.08);
  border-color: rgba(0,166,147,0.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,166,147,0.15);
  text-decoration: none;
}

.mobile-nav-item i {
  width: 16px;
  text-align: center;
  color: var(--secondary-text);
  flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .modern-navbar {
    width: 98%;
    top: 15px;
  }
  
  .modern-navbar.search-visible {
    width: 100%;
    top: 0;
    transition: opacity var(--ds-normal), transform var(--ds-normal),
                width 0.6s cubic-bezier(0.25, 0.8, 0.25, 1),
                top 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
  }
  
  .navbar-container {
    padding: 0 1.5rem;
    gap: 1rem;
    transition: opacity var(--ds-normal), transform var(--ds-normal),
                padding 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
  }
  
  .modern-navbar.search-visible .navbar-container {
    padding: 0 2rem;
  }

  .navbar-nav {
    gap: 1.8rem;
    margin-left: 1.5rem;
  }

  .navbar-search {
    max-width: 350px;
    margin: 0 1.5rem;
  }
  
  .modern-navbar.search-visible .navbar-search {
    margin: 0 1.5rem;
    justify-content: center;
  }
  
  .modern-navbar.search-visible .search-container {
    max-width: 450px;
  }

  .navbar-actions {
    gap: 1rem;
    margin-left: 1rem;
  }

  .modern-navbar.search-focused .navbar-search {
    width: calc(100% - 300px);
    max-width: 450px;
  }
  
  .modern-navbar.search-visible.search-focused .navbar-search {
    width: 100%;
    max-width: none;
    margin: 0 1.5rem;
  }
}

@media (max-width: 768px) {
  .modern-navbar {
    width: 98%;
    top: 10px;
    height: 65px;
    border-radius: 16px;
  }
  
  .modern-navbar.search-visible {
    width: 100%;
    top: 0;
    border-radius: 0;
  }
  
  .navbar-container {
    padding: 0 1rem;
    gap: 0.75rem;
    height: 65px;
  }
  
  .modern-navbar.search-visible .navbar-container {
    padding: 0 1.5rem;
  }

  .navbar-nav,
  .navbar-actions .auth-btn {
    display: none;
  }
  
  /* Hide actions in simple search mode on mobile */
  .modern-navbar.search-simple .navbar-actions {
    display: none;
  }

  .navbar-search {
    display: none;
  }
  
  /* Show search when navbar is in full width mode */
  .modern-navbar.search-visible .navbar-search.visible {
    display: flex !important;
  }
  
  .modern-navbar.search-simple .navbar-search.visible {
    display: flex !important;
  }

  /* Mobile search focused state */
  .modern-navbar.search-focused .navbar-search {
    display: block;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translateX(-50%) translateY(-50%);
    margin: 0;
    max-width: calc(100% - 2rem);
    width: calc(100% - 2rem);
    flex: none;
    z-index: 5;
    opacity: 1;
    pointer-events: auto;
  }
  
  /* Mobile search when navbar is sticky */
  .modern-navbar.search-visible .navbar-search,
  .modern-navbar.search-simple .navbar-search {
    display: flex;
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    margin: 0 1rem;
    max-width: none;
    width: calc(100% - 2rem);
    flex: 1;
    opacity: 1;
    pointer-events: auto;
    justify-content: center;
  }
  
  .modern-navbar.search-visible .search-container,
  .modern-navbar.search-simple .search-container {
    max-width: none;
    width: 100%;
  }
  
  .modern-navbar.search-visible.search-focused .navbar-search {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    margin: 0 1rem;
    width: calc(100% - 2rem);
  }

  .mobile-menu-toggle {
    display: block;
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    order: -1;
    margin-right: 0.5rem;
  }

  .navbar-actions {
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }

  .post-ad-btn {
    padding: 0.7rem 1.2rem;
    font-size: var(--ds-text-sm);
    gap: 0.5rem;
    white-space: nowrap;
    border-radius: 25px;
    font-weight: 600;
  }
  
  .post-ad-btn-new {
    padding: 0.5rem 0.8rem;
    font-size: var(--ds-text-xs);
    gap: 0.3rem;
    white-space: nowrap;
    border-radius: 20px;
    font-weight: 600;
  }
  
  .register-btn {
    padding: 0.4rem 0.7rem;
    font-size: var(--ds-text-xs);
    gap: 0.3rem;
  }

  .navbar-brand {
    margin-right: auto;
    margin-left: 0.5rem;
    flex-shrink: 0;
    flex: 1;
    display: flex;
    justify-content: flex-start;
  }

  .brand-text {
    font-size: var(--ds-text-xl);
  }

  .brand-icon { width: 34px; height: 34px; }
  .brand-icon img { width: 22px; height: 22px; }

  /* Enhanced User Menu Mobile */
  .user-menu {
    position: relative;
  }

  .user-btn {
    padding: 0.5rem 0.8rem;
    gap: 0.5rem;
    font-size: var(--ds-text-sm);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
  }

  .user-name {
    font-size: var(--ds-text-sm);
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .user-avatar {
    width: 28px;
    height: 28px;
    font-size: var(--ds-text-xs);
    flex-shrink: 0;
  }

  .user-dropdown {
    right: 0;
    min-width: 200px;
    margin-top: 0.5rem;
  }

  /* Enhanced Mobile Menu */
  .mobile-menu {
    padding: 2rem 1.5rem;
    max-height: calc(100vh - 65px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    background: var(--primary-bg);
    border-radius: 0 0 20px 20px;
  }
  
  .mobile-menu.active {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 576px) {
  .modern-navbar {
    width: 98%;
    top: 8px;
    height: 60px;
    border-radius: 14px;
  }

  .navbar-container {
    padding: 0 0.75rem;
    gap: 0.25rem;
    height: 60px;
  }

  .brand-text {
    font-size: var(--ds-text-base);
    white-space: nowrap;
  }

  .brand-icon { width: 30px; height: 30px; border-radius: 9px; }
  .brand-icon img { width: 18px; height: 18px; }

  .navbar-brand {
    margin-inline-start: 0.5rem;
    margin-inline-end: 0.25rem;
    padding-inline-end: 0.25rem;
  }

  .post-ad-btn {
    padding: 0.5rem 0.8rem;
    font-size: var(--ds-text-xs);
    border-radius: 20px;
    gap: 0.3rem;
  }

  .navbar-actions {
    gap: 0.25rem;
    margin-left: 0.25rem;
  }

  /* User button even more compact */
  .user-btn {
    padding: 0.4rem 0.6rem;
    gap: 0.4rem;
    max-width: 100px;
  }

  .user-name {
    font-size: var(--ds-text-xs);
    max-width: 50px;
  }

  .user-avatar {
    width: 24px;
    height: 24px;
    font-size: var(--ds-text-xs);
  }

  /* Mobile menu toggle smaller */
  .mobile-toggle-btn {
    padding: 0.4rem;
  }

  .hamburger-line {
    width: 20px;
    height: 1.5px;
  }

  /* Mobile menu improvements for small screens */
  .mobile-menu {
    padding: 1rem 0.75rem;
  }

  .mobile-nav-item {
    padding: 0.9rem 0;
    font-size: var(--ds-text-sm);
  }

  .mobile-action-btn {
    padding: 0.75rem 0.8rem;
    font-size: var(--ds-text-sm);
    min-height: 42px;
  }
}

/* Ultra small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
  .modern-navbar {
    width: 98%;
    top: 5px;
    padding: 0 0.5rem;
    gap: 0.5rem;
    height: 60px;
  }

  .brand-text {
    font-size: var(--ds-text-lg);
  }

  .brand-icon { width: 30px; height: 30px; border-radius: 8px; }
  .brand-icon img { width: 18px; height: 18px; }

  .post-ad-btn {
    padding: 0.5rem 0.8rem;
    font-size: var(--ds-text-xs);
  }

  .user-btn {
    padding: 0.4rem 0.6rem;
    max-width: 90px;
  }

  .user-name {
    max-width: 45px;
    font-size: var(--ds-text-xs);
  }

  .user-avatar {
    width: 22px;
    height: 22px;
    font-size: var(--ds-text-xs);
  }

  .mobile-toggle-btn {
    padding: 0.4rem;
  }

  .hamburger-line {
    width: 18px;
    height: 2px;
  }

  .mobile-menu-toggle {
    margin-right: 0.25rem;
  }

  .navbar-brand {
    margin-left: 0.25rem;
  }
}

/* Animation for mobile menu */
.mobile-menu.active {
  display: block;
  animation: slideDown 0.3s ease;
}

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

/* Enhanced search bar entrance animation */
@keyframes searchEntrance {
  0% {
    opacity: 0;
    transform: translateY(-16px) scale(0.92);
    filter: blur(4px);
  }
  50% {
    opacity: 0.7;
    filter: blur(2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes searchExit {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-16px) scale(0.92);
    filter: blur(4px);
  }
}

/* Navbar transformation animations */
@keyframes navbarToSticky {
  0% {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  }
  100% {
    top: 0;
    left: 0;
    transform: translateX(0);
    width: 100%;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }
}

@keyframes navbarToFloating {
  0% {
    top: 0;
    left: 0;
    transform: translateX(0);
    width: 100%;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }
  100% {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  }
}

/* Scroll behavior */
.modern-navbar.scrolled {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* Enhanced navbar with search visible */
.modern-navbar.search-visible {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

.modern-navbar.search-visible .navbar-container {
  height: 70px; /* Maintain height for smooth transition */
}

/* Search focused state - Zillow-like clean interface */
.modern-navbar.search-focused {
  background: var(--primary-bg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(16px);
}

.modern-navbar.search-focused .navbar-container {
  position: relative;
  overflow: hidden;
}

/* Focus styles for accessibility */
.nav-link:focus,
.auth-btn:focus,
.post-ad-btn:focus,
.user-btn:focus,
.mobile-toggle-btn:focus {
  outline: 2px solid var(--primary-brand);
  outline-offset: 2px;
}

/* Improved mobile touch targets */
@media (max-width: 768px) {
  .mobile-toggle-btn {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .mobile-nav-item {
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  /* Better mobile navbar layout distribution */
  .navbar-container {
    display: flex;
    align-items: center;
  }

  .mobile-menu-toggle {
    flex-shrink: 0;
  }

  .navbar-brand {
    flex: 1;
    display: flex;
    justify-content: flex-start;
    align-items: center;
  }

  .navbar-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }
}
