/* Clean mobile navbar for Vrindavan International School of Yoga
   This is independent from the template nav styles. */

/* Base reset for our mobile nav only */
.ny-mobile-nav,
.ny-mobile-nav * {
  box-sizing: border-box;
}

.ny-mobile-nav {
  display: none; /* hidden by default, shown only on small screens */
}

@media (max-width: 991.98px) {
  .ny-mobile-nav {
    display: block; /* show on mobile screens */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    width: 100%;
    /* Light background for mobile logo bar */
    background: var(--yoga-white, #ffffff);
    backdrop-filter: blur(10px);
    font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
      sans-serif;
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }

  .ny-mobile-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    max-width: 100%;
    margin: 0 auto;
  }

  .ny-mobile-nav-brand {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    position: relative;
    z-index: 1;
    order: 2;
  }

  .ny-mobile-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
  }

  .ny-mobile-logo img {
    height: 45px;
    width: auto;
    display: block;
  }

  .ny-mobile-title {
    display: none; /* Hide title on mobile, only show logo */
    font-size: 0.9rem;
    font-weight: 600;
    /* Dark text on light bar */
    color: #3b3a1e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Modern Hamburger button - Top Left */
  .ny-mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 10000;
    backdrop-filter: blur(10px);
    margin-left: 0;
    order: 1;
  }

  .ny-mobile-toggle:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    border-color: rgba(0, 0, 0, 0.15);
  }

  .ny-mobile-toggle:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  }

  .ny-mobile-toggle-bar {
    width: 24px;
    height: 2.5px;
    border-radius: 2px;
    /* Dark icon color for menu button */
    background: #111827;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .ny-mobile-toggle-bar::before,
  .ny-mobile-toggle-bar::after {
    content: "";
    position: absolute;
    left: 0;
    width: 24px;
    height: 2.5px;
    border-radius: 2px;
    background: #111827;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .ny-mobile-toggle-bar::before {
    top: -8px;
  }

  .ny-mobile-toggle-bar::after {
    top: 8px;
  }

  /* Open state for hamburger (X icon) */
  .ny-mobile-nav.is-open .ny-mobile-toggle {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  .ny-mobile-nav.is-open .ny-mobile-toggle:hover {
    background: rgba(255, 255, 255, 1);
  }

  .ny-mobile-nav.is-open .ny-mobile-toggle-bar {
    background: transparent;
  }

  .ny-mobile-nav.is-open .ny-mobile-toggle-bar::before {
    top: 0;
    transform: rotate(45deg);
    background: #111827;
  }

  .ny-mobile-nav.is-open .ny-mobile-toggle-bar::after {
    top: 0;
    transform: rotate(-45deg);
    background: #111827;
  }

  /* Slide-down menu - Full screen overlay */
  .ny-mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    max-height: 0;
    overflow: hidden;
    /* Dark background for full-screen mobile menu container */
    background: linear-gradient(135deg, #020617 0%, #0f172a 50%, #020617 100%);
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9998;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    touch-action: pan-y;
  }

  .ny-mobile-nav.is-open .ny-mobile-menu {
    max-height: 100vh;
    transform: translateX(0);
    overflow: hidden;
  }

  .ny-mobile-menu-inner {
    padding: 5rem 1.5rem 2rem;
    height: 100%;
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    position: relative;
    touch-action: pan-y;
  }

  .ny-mobile-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    animation: slideInRight 0.4s ease-out;
  }

  @keyframes slideInRight {
    from {
      opacity: 0;
      transform: translateX(20px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  .ny-mobile-item {
    border-radius: 0.5rem;
    animation: fadeInUp 0.4s ease-out backwards;
  }
  
  /* Ensure submenus are hidden by default - use max-height and opacity for smooth transitions */
  .ny-mobile-item.has-sub:not(.is-open) .ny-mobile-submenu {
    max-height: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    overflow: hidden !important;
  }
  
  /* Ensure nested submenus are also hidden by default */
  .ny-mobile-submenu-item.has-sub:not(.is-open) .ny-mobile-submenu {
    max-height: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    overflow: hidden !important;
  }

  .ny-mobile-item:nth-child(1) { animation-delay: 0.05s; }
  .ny-mobile-item:nth-child(2) { animation-delay: 0.1s; }
  .ny-mobile-item:nth-child(3) { animation-delay: 0.15s; }
  .ny-mobile-item:nth-child(4) { animation-delay: 0.2s; }
  .ny-mobile-item:nth-child(5) { animation-delay: 0.25s; }
  .ny-mobile-item:nth-child(6) { animation-delay: 0.3s; }
  .ny-mobile-item:nth-child(7) { animation-delay: 0.35s; }
  .ny-mobile-item:nth-child(8) { animation-delay: 0.4s; }
  .ny-mobile-item:nth-child(9) { animation-delay: 0.45s; }
  .ny-mobile-item:nth-child(10) { animation-delay: 0.5s; }

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

  .ny-mobile-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    text-decoration: none;
    font-size: 1rem;
    color: #1e293b;
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(226, 232, 240, 0.8);
    backdrop-filter: blur(10px);
  }

  .ny-mobile-link span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }

  .ny-mobile-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ny-mobile-link:hover,
  .ny-mobile-link:active {
    background: rgba(255, 255, 255, 1);
    color: #0f172a;
    transform: translateX(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: rgba(148, 163, 184, 0.5);
  }

  .ny-mobile-link--primary {
    color: #ffffff;
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(71, 85, 105, 0.25);
  }
  
  .ny-mobile-link--primary:hover {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    transform: translateX(-4px) scale(1.02);
    box-shadow: 0 6px 16px rgba(71, 85, 105, 0.3);
  }

  /* Simple icon for items that have more info / sub-pages */
  .ny-mobile-pill {
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    background: rgba(241, 245, 249, 0.9);
    color: #475569;
    font-weight: 600;
    flex-shrink: 0;
    border: 1px solid rgba(203, 213, 225, 0.5);
  }
  
  .ny-mobile-link:hover .ny-mobile-pill {
    background: rgba(241, 245, 249, 1);
    color: #334155;
    border-color: rgba(148, 163, 184, 0.6);
  }

  /* Subtext (optional line 2) */
  .ny-mobile-subtext {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    font-weight: 400;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .ny-mobile-link:hover .ny-mobile-subtext {
    color: #475569;
  }

  /* Group label for sections (Yoga TTC, Ayurveda, etc.) */
  .ny-mobile-section-label {
    margin: 1.5rem 0 0.75rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    position: relative;
    padding-left: 0.75rem;
  }
  
  .ny-mobile-section-label::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    border-radius: 2px;
  }

  /* Overlay for menu */
  .ny-mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9997;
    backdrop-filter: blur(4px);
    pointer-events: none;
  }

  .ny-mobile-nav.is-open ~ .ny-mobile-menu-overlay,
  body.ny-menu-open .ny-mobile-menu-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Small top offset so the banner doesn't hide behind the nav */
  body {
    scroll-padding-top: 0;
  }

  /* Prevent body scroll when menu is open, but allow menu scrolling */
  body.ny-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }
  
  /* Ensure menu can scroll even when body is locked */
  body.ny-menu-open .ny-mobile-menu-inner {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}

/* Mobile Submenu Slidesheet */
@media (max-width: 991.98px) {
.mobile-submenu-sidebar {
  position: fixed;
  top: 0;
  right: -100%;
  width: 85%;
  max-width: 400px;
  height: 100vh;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  z-index: 10000;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  visibility: visible;
}

.mobile-submenu-sidebar.is-open {
  right: 0;
}
}

/* Also show on desktop for testing, but hide by default */
@media (min-width: 992px) {
  /* Force-hide the mobile navbar and its overlays on wide screens.
     Some pages include page-specific styles that accidentally make it visible. */
  .ny-mobile-nav,
  .ny-mobile-menu-overlay,
  .mobile-submenu-sidebar,
  .mobile-submenu-overlay {
    display: none !important;
  }

  .mobile-submenu-sidebar {
    display: none;
  }
}

.mobile-submenu-sidebar.is-open {
  right: 0;
  visibility: visible;
}

.mobile-submenu-header {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 1;
}

.mobile-submenu-back {
  background: none;
  border: none;
  padding: 0.5rem;
  margin-right: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #393735;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.mobile-submenu-back:hover {
  color: #2a2a28;
}

.mobile-submenu-back i {
  font-size: 1.25rem;
}

.mobile-submenu-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #152321;
  flex: 1;
}

.mobile-submenu-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  animation: slideInRight 0.3s ease-out;
  position: relative;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.ny-mobile-submenu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ny-mobile-submenu-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ny-mobile-submenu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  color: #152321;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  border-radius: 0;
  position: relative;
}

.ny-mobile-submenu-link:hover,
.ny-mobile-submenu-link:active {
  background-color: rgba(57, 55, 53, 0.08);
  color: #393735;
}

.ny-mobile-submenu-item.has-sub .ny-mobile-submenu-link {
  font-weight: 500;
  cursor: pointer;
}

.ny-mobile-submenu-item.has-sub .ny-mobile-submenu-link:hover {
  background-color: rgba(57, 55, 53, 0.1);
  color: #2a2a28;
}

.ny-mobile-submenu-link i {
  color: #393735;
  font-size: 1.1rem;
  transition: transform 0.2s ease;
  margin-left: 0.5rem;
}

.ny-mobile-submenu-item.has-sub .ny-mobile-submenu-link:hover i {
  transform: translateX(4px);
}

.ny-mobile-submenu-link span {
  flex: 1;
  text-align: left;
}

.mobile-submenu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
  backdrop-filter: blur(2px);
}

.mobile-submenu-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Mobile submenu dropdown behavior */
@media (max-width: 991.98px) {
  .ny-mobile-item .ny-mobile-submenu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s ease-out, 
                padding 0.3s ease-out,
                margin 0.3s ease-out,
                visibility 0.3s ease-out;
    padding: 0;
    margin: 0;
    list-style: none;
    /* Remove display: none to allow transitions */
  }
  
  .ny-mobile-item.has-sub.is-open .ny-mobile-submenu {
    max-height: 1000px;
    opacity: 1;
    visibility: visible;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
  }
  
  .ny-mobile-item.has-sub > .ny-mobile-link::after {
    content: '\f107';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-left: auto;
    color: #64748b;
    font-size: 1.1rem;
    transition: transform 0.3s ease;
  }
  
  .ny-mobile-item.has-sub.is-open > .ny-mobile-link::after {
    transform: rotate(180deg);
  }
  
  .ny-mobile-submenu-item {
    padding: 0;
    margin: 0;
  }
  
  .ny-mobile-submenu-item a {
    display: block;
    padding: 0.75rem 1.25rem 0.75rem 2.5rem;
    color: #1e293b;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 400;
    border-radius: 8px;
    margin: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
    pointer-events: auto;
  }
  
  .ny-mobile-submenu-item a:hover,
  .ny-mobile-submenu-item a:active {
    background: rgba(255, 255, 255, 1);
    color: #0f172a;
    transform: translateX(4px);
    border-color: rgba(148, 163, 184, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  /* Nested submenus (submenu items with their own submenus) */
  .ny-mobile-submenu-item.has-sub {
    position: relative;
  }
  
  .ny-mobile-submenu-item.has-sub > a {
    position: relative;
    padding-right: 2.5rem;
    cursor: pointer;
    pointer-events: auto;
  }
  
  .ny-mobile-submenu-item.has-sub > a::after {
    content: '\f107';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 0.9rem;
    transition: transform 0.3s ease, color 0.2s ease;
    pointer-events: none;
  }
  
  .ny-mobile-submenu-item.has-sub.is-open > a::after {
    transform: translateY(-50%) rotate(180deg);
    color: #1e293b;
  }
  
  /* Nested submenu styling */
  .ny-mobile-submenu-item.has-sub .ny-mobile-submenu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s ease-out, 
                padding 0.3s ease-out,
                margin 0.3s ease-out,
                visibility 0.3s ease-out;
    padding: 0;
    margin: 0 0 0 1rem;
    list-style: none;
    /* Remove display: none to allow transitions */
  }
  
  .ny-mobile-submenu-item.has-sub.is-open .ny-mobile-submenu {
    max-height: 1000px !important;
    opacity: 1 !important;
    visibility: visible !important;
    padding: 0.5rem 0;
    margin-top: 0.25rem;
  }
  
  /* Nested submenu items should be indented more */
  .ny-mobile-submenu-item.has-sub .ny-mobile-submenu .ny-mobile-submenu-item a {
    padding-left: 3.5rem;
    font-size: 0.9rem;
  }
  
  /* Ensure submenus are properly positioned and clickable when open */
  .ny-mobile-item.has-sub.is-open .ny-mobile-submenu,
  .ny-mobile-submenu-item.has-sub.is-open .ny-mobile-submenu {
    position: relative;
    z-index: 10;
    pointer-events: auto;
  }
  
  /* Ensure submenu items are clickable */
  .ny-mobile-submenu-item {
    position: relative;
    z-index: 1;
  }
}

/* Hide the original template nav only on small screens to avoid double menus */
@media (max-width: 991.98px) {
  /* Some pages still show the template sticky header container as an extra bar.
     Hide the whole header on mobile so only the clean mobile navbar is visible. */
  .header-area {
    display: none !important;
  }

  .header-area .main-nav {
    display: none !important;
  }

  /* Mobile "Apply Now" item */
  /* Hide the Apply Now item entirely from the mobile navbar */
  .ny-mobile-item--apply {
    display: none !important;
  }

  .ny-mobile-item--apply .ny-mobile-link--apply {
    background: linear-gradient(135deg, var(--yoga-terracotta) 0%, var(--yoga-sage) 50%, #f2f542 100%);
    color: #8b2d2d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    border-radius: 999px;
    justify-content: center;
    margin-top: 0.25rem;
  }

  .ny-mobile-item--apply .ny-mobile-link--apply .ny-mobile-label {
    color: #ffffff;
  }
}

