/* =============================================
   AL JANABIYA GATE — UX ENHANCEMENTS
   Smooth scroll, lazy images, mobile nav, badges
   ============================================= */

/* 1. Smooth scroll */
html {
  scroll-behavior: smooth;
}

/* 2. Image lazy loading with fade-in */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.5s ease-in;
}
img[loading="lazy"].loaded,
img[loading="lazy"][complete] {
  opacity: 1;
}
/* Fallback: if JS doesn't add .loaded, show after a delay */
img[loading="lazy"] {
  animation: imgFadeIn 0.6s ease-in forwards;
  animation-delay: 0.1s;
}
@keyframes imgFadeIn {
  to { opacity: 1; }
}

/* 3. Better mobile nav */
@media (max-width: 991px) {
  /* Slide-in overlay nav */
  .navbar-area .navbar-collapse {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background: #fff;
    z-index: 10000;
    padding: 80px 30px 40px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: block !important;
  }
  .navbar-area .navbar-collapse.show {
    right: 0;
  }

  /* Nav items stack vertically */
  .navbar-area .navbar-collapse .navbar-nav {
    text-align: left !important;
  }
  .navbar-area .navbar-collapse .navbar-nav li {
    display: block !important;
    line-height: 1.4;
    margin-left: 0 !important;
    border-bottom: 1px solid #f0f0f0;
  }
  .navbar-area .navbar-collapse .navbar-nav li a {
    display: block;
    padding: 14px 0;
    font-size: 16px;
    color: #101425;
    transition: color 0.2s ease, padding-left 0.2s ease;
  }
  .navbar-area .navbar-collapse .navbar-nav li a:hover {
    color: #95B935;
    padding-left: 8px;
  }
  .navbar-area .navbar-collapse .navbar-nav li:last-child {
    border-bottom: none;
  }

  /* Close button inside the drawer */
  .mobile-nav-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f6f7fb;
    border-radius: 50%;
    font-size: 18px;
    color: #101425;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10001;
  }
  .mobile-nav-close:hover {
    background: #95B935;
    color: #fff;
    transform: rotate(90deg);
  }

  /* Overlay backdrop */
  .mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    z-index: 9999;
    pointer-events: none;
    transition: background 0.35s ease;
  }
  .mobile-nav-overlay.active {
    background: rgba(0, 0, 0, 0.4);
    pointer-events: all;
  }

  /* Hamburger animation */
  .toggle-btn {
    transition: transform 0.2s ease;
  }
  .toggle-btn:active {
    transform: scale(0.9);
  }

  /* CTA in mobile nav */
  .mobile-nav-cta {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #f0f0f0;
  }
  .mobile-nav-cta .btn-yellow {
    display: block;
    width: 100%;
    text-align: center;
  }
}

/* Hide mobile nav elements on desktop */
@media (min-width: 992px) {
  .mobile-nav-close,
  .mobile-nav-overlay,
  .mobile-nav-cta {
    display: none !important;
  }
}

/* 4. Search tab count badges */
.tab-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  background: rgba(255, 255, 255, 0.25);
  color: inherit;
  vertical-align: middle;
}
.nav-link.active .tab-count-badge {
  background: rgba(255, 255, 255, 0.3);
}
.nav-link:not(.active) .tab-count-badge {
  background: rgba(149, 185, 53, 0.15);
  color: #95B935;
}

/* Smooth section transitions */
section,
article {
  scroll-margin-top: 80px;
}

/* Floating WhatsApp button */
.floating-whatsapp {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37,211,102,0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}
.floating-whatsapp:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(37,211,102,0.6);
}
.floating-whatsapp i {
  color: #fff;
  font-size: 28px;
}
@media (max-width: 768px) {
  .floating-whatsapp {
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
  }
  .floating-whatsapp i { font-size: 24px; }
}

/* Better touch targets on mobile */
@media (max-width: 768px) {
  .btn-yellow,
  .btn {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .rld-single-select select,
  .rld-single-input input {
    min-height: 48px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }
}
