/* Base Styles */
html {
  scrollbar-gutter: stable;
}

body {
  scrollbar-gutter: stable;
}

/* Utility Styles */
.gradient-red-radial { background: radial-gradient(circle, #cc0000, transparent); border-radius: 50%; }
.gradient-red-dark-radial { background: radial-gradient(circle, #D32F2F, transparent); border-radius: 50%; }
.gradient-blue-radial { background: radial-gradient(circle, #1967D2, transparent); border-radius: 50%; }
.gradient-blue-light { background: linear-gradient(135deg, #F0F4FF 0%, #E8EFFF 100%); }
.gradient-red-light { background: linear-gradient(135deg, #FFF5F5 0%, #FFF0F0 100%); }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.scrollbar-hide::-webkit-scrollbar { display: none !important; }
.scrollbar-hide { -ms-overflow-style: none !important; scrollbar-width: none !important; }

/* Mobile breadcrumb fix: allow horizontal scroll but hide scrollbar */
@media (max-width: 639px) {
  .breadcrumb-nav { 
    overflow-x: auto !important; 
    -webkit-overflow-scrolling: touch !important; 
  }
}

.press { transition: transform 0.15s; }
.press:active { transform: scale(0.96); }
.press-sm { transition: transform 0.15s; }
.press-sm:active { transform: scale(0.94); }

.grad-text { background: linear-gradient(to bottom right, #e01414, #ff5a5a); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Skeleton loader animation */
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.8; } }
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

/* Prevent layout shift during dynamic card injection & lazy image loading */
#listingGrid { 
  contain: layout style; 
}
.card-container { 
  contain: layout style paint; 
}

/* Prevent image loading layout shift in injected cards - reserve space with aspect ratio */
.slide-item {
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-item img {
  aspect-ratio: 1;
  display: block;
}

.slide-item iframe {
  display: block !important;
  min-height: 240px;
}

@media (min-width: 640px) {
  .slide-item {
    min-height: 300px;
  }
  .slide-item iframe {
    min-height: 300px;
  }
}

.inner-profile-card {
  contain: layout paint;
}

/* Reveal elements - show immediately, no delays */
.reveal { opacity: 1; transform: none; visibility: visible; }
.reveal.in { opacity: 1; transform: none; }
.reveal-d1, .reveal-d2, .reveal-d3, .reveal-d4 { transition: none; transition-delay: 0; }

/* Hero section reveals - disable all transforms to prevent layout jumping */
#heroSection .reveal { 
  transform: none !important; 
  opacity: 0 !important; 
  transition: opacity 0.35s ease-out !important; 
  will-change: opacity;
}
#heroSection .reveal.in { 
  transform: none !important; 
  opacity: 1 !important; 
}
#heroSection .reveal-d1 { transition-delay: 20ms; }
#heroSection .reveal-d2 { transition-delay: 40ms; }
#heroSection .reveal-d3 { transition-delay: 60ms; }
#heroSection .reveal-d4 { transition-delay: 80ms; }

/* Mobile: Show all hero content instantly (no animation) */
@media (max-width: 639px) {
  #heroSection .reveal {
    opacity: 1 !important;
    transition: none !important;
  }
  #heroSection .reveal-d1,
  #heroSection .reveal-d2,
  #heroSection .reveal-d3,
  #heroSection .reveal-d4 {
    transition-delay: 0ms !important;
  }
}

/* Popular tags container styling */
#popularTagsSection { display: flex; flex-direction: column; justify-content: center; width: 100%; }
#popularTagsSection .popular-heading { margin: 0; line-height: 1.2; }
#popularTagsSection .w-16 { margin-top: 4px; margin-bottom: 8px; }
#popularTagsSection #popularTagsContainer { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  flex-wrap: wrap;
  width: 100%;
}

/* Mobile-specific: disable reveal animation on popular tags section to prevent jump */
@media (max-width: 639px) {
  /* Force ALL hero section reveal elements visible from start on mobile */
  #heroSection .reveal { 
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    visibility: visible !important;
  }
  #heroSection .reveal.in { 
    opacity: 1 !important;
    transform: none !important;
  }
  
  /* Force popular tags to be visible immediately on mobile - don't wait for reveal animation */
  #heroSection #popularTagsSection { 
    opacity: 1 !important; 
    transform: none !important;
    transition: none !important;
    will-change: auto !important;
    animation: none !important;
    visibility: visible !important;
  }
  /* Ensure it stays visible even before reveal class fires */
  #heroSection #popularTagsSection.reveal { 
    opacity: 1 !important; 
    transform: none !important;
    transition: none !important;
    visibility: visible !important;
  }
  #heroSection #popularTagsSection.reveal.in { 
    opacity: 1 !important; 
    transform: none !important;
    transition: none !important;
    visibility: visible !important;
  }
  /* Disable all delay classes on mobile for popular tags */
  #heroSection #popularTagsSection.reveal-d1,
  #heroSection #popularTagsSection.reveal-d2, 
  #heroSection #popularTagsSection.reveal-d3, 
  #heroSection #popularTagsSection.reveal-d4 { 
    transition: none !important;
    transition-delay: 0ms !important; 
    animation: none !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  /* Also fix the dots and city label section to prevent cascading shifts */
  #heroSection .mt-7.reveal { 
    opacity: 1 !important; 
    transform: none !important;
    transition: none !important;
    visibility: visible !important;
  }
  #heroSection .mt-7.reveal.in { 
    opacity: 1 !important; 
    transform: none !important;
    visibility: visible !important;
  }
  
  /* Fixed height container for popular tags on mobile to prevent layout shift */
  #popularTagsContainer {
    min-height: 72px; /* Fixed height for 2 rows of pills (24px + 8px gap + 24px + padding) */
    align-content: flex-start; /* Align content to top */
  }
  
  /* Line clamp for long tag text on mobile - show only 1 line */
  .pop-tags-wrap a {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
  }
}

/* Mobile Menu Fix - Prevent content overlapping when menu is open */
.menu-open-body #popularCategoriesContainer,
.menu-open-body #searchForm,
.menu-open-body [id^="popularCategories"],
.menu-open-body .search-section-wrap,
.menu-open-body #stateStickyBar {
  z-index: 1 !important;
}

.menu-open-body #mainNav {
  z-index: 1000 !important;
}

/* Layout & Base Font Fixes */
@media (max-width: 1023px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* Sticky Search & Mobile Filter/Sheet Utilities */
.sticky-search { position: sticky; top: 58px; z-index: 40; background: transparent; transition: all 0.3s; padding-bottom: 1rem !important; }
.sticky-search.scrolled-past { background: rgba(255, 255, 255, 0.86); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(0,0,0,0.05); padding-top: 0.5rem; padding-bottom: 1rem; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }

.city-chip { padding: 0.5rem 1rem; border-radius: 9999px; border: 1px solid #e2e8f0; background: #f8fafc; font-size: 0.75rem; font-weight: 700; color: #64748b; white-space: nowrap; transition: all 0.2s; }
.city-chip:active { transform: scale(0.95); }
.city-chip.sel { border-color: #e01414; background: #fff5f5; color: #e01414; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }

#mainNav { transition: background .35s ease, box-shadow .35s ease, backdrop-filter .35s ease, -webkit-backdrop-filter .35s ease, border-bottom-color .35s ease; background: transparent; border-bottom: 1px solid transparent; box-shadow: 0 0 0 rgba(0,0,0,0); margin: 0; padding: 0; }

/* Business & Feature Cards */
.biz-card { background:#fff; border-radius:20px; border:1px solid rgba(0,0,0,0.06); transition:all .28s ease; cursor:pointer; overflow:hidden; }
.biz-card:active { transform:scale(0.98); }
.feat-card { background:#fff; border-radius:22px 22px 16px 16px; overflow:hidden; border:1px solid rgba(0,0,0,0.06); transition:all .3s ease; min-width:52vw; max-width:300px; }
.feat-card:active { transform:scale(0.98); }
@media (min-width:640px) { .feat-card { min-width:0; max-width:none; width:100%; } }

@media (hover:hover) and (pointer:fine) { 
  .city-card:hover { transform:translateY(-8px); box-shadow:0 32px 64px rgba(0,0,0,0.22); } 
  .feat-card:hover { transform:translateY(-8px); box-shadow:0 24px 52px rgba(0,0,0,0.14); } 
  .biz-card:hover { transform:translateY(-6px); box-shadow:0 22px 48px rgba(0,0,0,0.12); border-color:rgba(224,20,20,0.15); } 
  .stat-card:hover { transform:translateY(-6px); box-shadow:0 18px 44px rgba(224,20,20,0.14); } 
}

@keyframes heartPop { 0%{transform:scale(1)} 40%{transform:scale(1.5)} 70%{transform:scale(0.9)} 100%{transform:scale(1)} }
.heart-btn.liked .fa-heart { color:#e01414; animation:heartPop .4s ease; }
@media (max-width:767px) { .heart-btn { display:none !important; } }

.open-dot { width:7px; height:7px; border-radius:50%; background:#22c55e; position:relative; }
.open-dot::before { content:''; position:absolute; inset:-2px; border-radius:50%; background:rgba(34,197,94,0.4); animation:pulseRing 2s ease-out infinite; }
@keyframes pulseRing { 0%{transform:scale(1);opacity:1} 80%,100%{transform:scale(2.5);opacity:0} }

.foot-acc-body { max-height:0; overflow:hidden; transition:max-height .35s ease; }
.foot-acc-body.open { max-height:300px; }
.foot-acc-icon { transition:transform .3s ease; }
.foot-acc-open .foot-acc-icon { transform:rotate(180deg); }

/* Sticky/Scrolled Navbar Logic */
.sticky-nav #mainNav:not(.scrolled) { background: rgba(255,255,255,0.86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom-color: rgba(0,0,0,0.06); }
#mainNav.scrolled { background: #ffffff !important; box-shadow: 0 2px 8px rgba(0,0,0,0.08); border-bottom-color: rgba(0,0,0,0.06) !important; }

/* Desktop Scrolled Menu Item Colors */
#mainNav.scrolled .nav-link { color: #1a1a1a !important; }
#mainNav.scrolled .nav-link:hover { color: #e01414 !important; background-color: rgba(224,20,20,0.05) !important; }
#mainNav.scrolled #deskHeaderSearchBtn { color: #4b5563 !important; }
#mainNav.scrolled #deskHeaderSearchBtn:hover { background-color: #f3f4f6 !important; color: #111827 !important; }
#mainNav.scrolled #menuBtn { color: #4b5563 !important; }
#mainNav.scrolled #menuBtn:hover { background-color: #f3f4f6 !important; }

/* Menu Icon Morph */
#menuIco { transition: transform .3s cubic-bezier(.34,1.3,.64,1), opacity .2s ease; display: inline-block; }
#menuIco.is-open { transform: rotate(90deg) scale(0.9); }

#searchPanel {
  will-change: transform;
  contain: layout style paint;
}

/* Default hidden state for search overlay */
#searchOverlay { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; }
#searchOverlay.on { opacity: 1 !important; visibility: visible !important; pointer-events: auto !important; }
#searchOverlay.on #searchPanel { transform: translateY(0) !important; transition: transform 0.42s ease-out !important; }

/* Desktop Navbar Dynamic Button States */
/* Default (Transparent/Dark Hero) */
#mainNav:not(.scrolled) .nav-btn-outline { color: rgba(255,255,255,0.9); border-color: rgba(255,255,255,0.35); background: transparent; }
#mainNav:not(.scrolled) .nav-btn-outline:hover { background: rgba(255,255,255,0.12); color: #fff; }
#mainNav:not(.scrolled) .nav-btn-solid { background: rgba(255,255,255,0.18); color: #fff; border: 1px solid rgba(255,255,255,0.3); }
#mainNav:not(.scrolled) .nav-btn-solid:hover { background: rgba(255,255,255,0.28); }

/* Sticky/Scrolled State Override for Buttons */
.sticky-nav #mainNav:not(.scrolled) .nav-btn-outline,
#mainNav.scrolled .nav-btn-outline { color: #bc0d0d; border-color: rgba(188,13,13,0.3); background: transparent; }
.sticky-nav #mainNav:not(.scrolled) .nav-btn-outline:hover,
#mainNav.scrolled .nav-btn-outline:hover { background: rgba(188,13,13,0.05); color: #9c0a0a; }

.sticky-nav #mainNav:not(.scrolled) .nav-btn-solid,
#mainNav.scrolled .nav-btn-solid { background: #bc0d0d; color: #fff; border: none; box-shadow: 0 4px 12px rgba(188,13,13,0.2); }
.sticky-nav #mainNav:not(.scrolled) .nav-btn-solid:hover,
#mainNav.scrolled .nav-btn-solid:hover { background: #9c0a0a; box-shadow: 0 6px 16px rgba(188,13,13,0.3); }

#mobileDrawer {
  background: #ffffff;
  border-top: 1px solid rgba(0,0,0,0.07);
  box-shadow: 0 16px 40px rgba(0,0,0,0.14), 0 4px 12px rgba(0,0,0,0.06);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  transform-origin: top center;
  pointer-events: none;
  will-change: max-height, opacity, transform;
  contain: layout style paint;
  transition: max-height .28s cubic-bezier(.4,0,.2,1), opacity .2s ease, transform .24s ease;
}
#mobileDrawer.drawer-open { opacity: 1; transform: translateY(0); pointer-events: all; }
#mobileDrawer a:not(.nav-cta), #mobileDrawer button:not(.nav-cta) { color: #1f2937; }
#mobileDrawer a:not(.nav-cta):hover, #mobileDrawer button:not(.nav-cta):hover { color: #e01414; background: rgba(224,20,20,0.06); }

.drawer-item { opacity: 0; transform: translateX(-10px); transition: opacity .16s ease, transform .18s ease; }
#mobileDrawer.drawer-open .drawer-item { opacity: 1; transform: translateX(0); }
#mobileDrawer.drawer-open .drawer-item:nth-child(1) { transition-delay: .04s; }
#mobileDrawer.drawer-open .drawer-item:nth-child(2) { transition-delay: .09s; }
#mobileDrawer.drawer-open .drawer-item:nth-child(3) { transition-delay: .14s; }
#mobileDrawer.drawer-open .drawer-item:nth-child(4) { transition-delay: .19s; }
#mobileDrawer.drawer-open .drawer-item:nth-child(5) { transition-delay: .24s; }
#mobileDrawer.drawer-open .drawer-item:nth-child(6) { transition-delay: .27s; }
#mobileDrawer.drawer-open .drawer-item:nth-child(7) { transition-delay: .30s; }
#mobileDrawer.drawer-open .drawer-item:nth-child(8) { transition-delay: .33s; }
#mobileDrawer.drawer-open .drawer-item:nth-child(9) { transition-delay: .36s; }
#mobileDrawer.drawer-open .drawer-item:nth-child(10) { transition-delay: .42s; }
#mobileDrawer.drawer-open .drawer-item:nth-child(11) { transition-delay: .45s; }

@media (max-width: 767px) {
  #searchOverlay {
    background: rgba(15, 23, 42, 0.42) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  #searchOverlay.on #searchPanel {
    transition-duration: .28s !important;
  }

  #mobileDrawer {
    box-shadow: 0 10px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.05);
  }

  #mobileDrawer.drawer-open .drawer-item:nth-child(n) {
    transition-delay: 0s !important;
  }
}

.mob-nav-btn { color: #9ba3af; }
.mob-icon { font-size: 22px !important; color: #9ba3af; transition: all .2s ease; }
.mob-label { font-size: 11px !important; font-weight: 700 !important; color: #9ba3af; transition: color .2s ease; }
.mob-nav-btn.active .mob-style-icon, .mob-nav-btn.active .mob-icon { color: #e01414; }
.mob-nav-btn.active .mob-style-label, .mob-nav-btn.active .mob-label { color: #e01414; }

/* FAB styling */
.mob-nav-fab { width: 56px !important; height: 56px !important; border-radius: 9999px; background: linear-gradient(135deg, #e01414, #9b1111); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 25px rgba(224, 20, 20, 0.4); transform: translateY(-20px); border: 4px solid #ffffff; transition: all 0.2s ease; overflow: hidden; cursor: pointer; }

@media (max-width: 1024px) {
  footer.bg-red-600 { margin-bottom: 10px !important; }
}
#scrollToTopBtn {
  position: fixed;
  bottom: 2rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.8);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 40;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  margin-bottom: 2rem;
}
#scrollToTopBtn:hover { transform: translateY(0) scale(1.1); box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4); }
#scrollToTopBtn:active { transform: translateY(2px) scale(1.05); }
#scrollToTopBtn.show { opacity: 1; visibility: visible; transform: translateY(0) scale(1); animation: jump 1.5s ease-in-out infinite; }
@keyframes jump { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-8px) scale(1.05); } }
@media (max-width: 768px) { #scrollToTopBtn { bottom: 5.5rem; right: 1rem; width: 44px; height: 44px; font-size: 18px; margin-bottom: 2rem; } }

/* --- Top City Slider Specific --- */
.city-card {
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.city-card img {
  transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* Mobile specific slider tweaks */
@media (max-width: 639px) {
  #citySliderTrack {
    gap: 8px !important;
    padding-bottom: 20px !important;
  }
  
  .city-card {
    min-width: 110px !important;
    aspect-ratio: 1 / 1.15 !important;
    border-radius: 10px !important;
    /* Prevent double zoom by neutralizing the CSS-only active state */
    -webkit-tap-highlight-color: transparent;
  }

  /* Only zoom when the specific JS class is present */
  .city-card.js-active img {
    transform: scale(1.18) !important;
  }
}

@media (min-width: 640px) {
  .city-card:hover img {
    transform: scale(1.15);
  }
}
