/* Navigation Styles - Responsive Mobile & Desktop Navigation */
/* Based on the navigation restructure proposal */
/* Uses bootstrap-theme-traquility.css for styling theme elements */

/* ============================================ */
/* MOBILE BOTTOM NAVIGATION */
/* ============================================ */

.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--traq-white-alpha-95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hide on desktop */
@media (min-width: 768px) {
  .mobile-bottom-nav {
    display: none;
  }
}

.mobile-bottom-nav__container {
  display: flex;
  width: 100%;
  max-width: 100%;
  justify-content: space-around;
  align-items: stretch;
}

.mobile-bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 44px;
  padding: 8px 4px;
  text-decoration: none;
  color: #6c757d;
  transition: all 0.2s ease;
  border-radius: 0;
}

.mobile-bottom-nav__item:hover {
  color: #495057;
  text-decoration: none;
}

.mobile-bottom-nav__item:active {
  transform: scale(0.95);
}

.mobile-bottom-nav__item--active {
  background: var(--traq-gradient-primary);
  color: var(--traq-text-white);
}

.mobile-bottom-nav__item--active .mobile-bottom-nav__icon {
  color: var(--traq-text-white);
}

.mobile-bottom-nav__item--active .mobile-bottom-nav__label {
  color: var(--traq-text-white);
}

.mobile-bottom-nav__icon {
  font-size: 24px;
  margin-bottom: 4px;
  color: inherit;
}

.mobile-bottom-nav__label {
  font-size: 11px;
  font-weight: 500;
  color: inherit;
  text-align: center;
  line-height: 1.2;
}

/* Mobile navigation item wrapper for expandable items */
.mobile-bottom-nav__item-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Make button items look consistent with link items */
.mobile-bottom-nav__item-wrapper .mobile-bottom-nav__item {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
}

/* Active state for button items - needs higher specificity to override transparent background */
.mobile-bottom-nav__item-wrapper .mobile-bottom-nav__item.mobile-bottom-nav__item--active {
  background: var(--traq-gradient-primary);
  color: var(--traq-text-white);
}

.mobile-bottom-nav__item-wrapper .mobile-bottom-nav__item.mobile-bottom-nav__item--active .mobile-bottom-nav__icon,
.mobile-bottom-nav__item-wrapper .mobile-bottom-nav__item.mobile-bottom-nav__item--active .mobile-bottom-nav__label {
  color: var(--traq-text-white);
}

/* Blue icon styling when profile submenu is expanded but not on an active page */
.mobile-bottom-nav__item--expanded-not-active {
  color: #667eea;
}

.mobile-bottom-nav__item--expanded-not-active .mobile-bottom-nav__icon,
.mobile-bottom-nav__item--expanded-not-active .mobile-bottom-nav__label {
  color: #667eea;
}

/* Submenu styles */
.mobile-bottom-nav__submenu {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 12px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  margin-bottom: 8px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 71;
}

.mobile-bottom-nav__submenu--expanded {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}

/* Arrow pointing down to the nav item */
.mobile-bottom-nav__submenu::after {
  content: '';
  position: absolute;
  top: 100%;
  left: calc(50% + var(--triangle-offset, 0px));
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid white;
}

.mobile-bottom-nav__submenu-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  text-decoration: none;
  color: #212529;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-bottom-nav__submenu-item:first-child {
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.mobile-bottom-nav__submenu-item:last-child {
  border-bottom: none;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.mobile-bottom-nav__submenu-item:hover {
  background-color: var(--traq-primary-alpha-10);
  text-decoration: none;
}

.mobile-bottom-nav__submenu-icon {
  font-size: 18px;
  margin-right: 12px;
  color: #6c757d;
  width: 20px;
  text-align: center;
}

.mobile-bottom-nav__submenu-label {
  font-size: 14px;
  font-weight: 400;
  color: #212529;
  flex: 1;
}

.mobile-bottom-nav__lock-icon {
  font-size: 12px;
  margin-left: 8px;
  color: #6c757d;
}

.mobile-bottom-nav__subscriber-badge {
  font-size: 12px;
  margin-left: 8px;
  color: #ffc107;
}


/* ============================================ */
/* DESKTOP SIDEBAR NAVIGATION */
/* ============================================ */

.desktop-sidebar-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: #ffffff;
  border-right: 1px solid #dee2e6;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 70;
  display: none;
  flex-direction: column;
}

/* Show on desktop */
@media (min-width: 768px) {
  .desktop-sidebar-nav {
    display: flex;
  }
}

.desktop-sidebar-nav__header {
  padding: 16px;
  border-bottom: 1px solid #dee2e6;
  flex-shrink: 0;
}

.desktop-sidebar-nav__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.desktop-sidebar-nav__logo:hover {
  text-decoration: none;
}

.desktop-sidebar-nav__logo-img {
  margin-right: 8px;
}

.desktop-sidebar-nav__logo-text {
  font-weight: 600;
  font-size: 16px;
  color: #212529;
}

.desktop-sidebar-nav__content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.desktop-sidebar-nav__section {
  margin-bottom: 8px;
}

.desktop-sidebar-nav__item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  text-decoration: none;
  color: #6c757d;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.desktop-sidebar-nav__item:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: #495057;
  text-decoration: none;
}

.desktop-sidebar-nav__item--active {
  background: var(--traq-gradient-primary);
  color: var(--traq-text-white);
  border-left-color: transparent;
}

.desktop-sidebar-nav__item--active .desktop-sidebar-nav__icon,
.desktop-sidebar-nav__item--active .desktop-sidebar-nav__label {
  color: var(--traq-text-white);
}

.desktop-sidebar-nav__item--active:hover {
  background: var(--traq-gradient-primary);
  color: var(--traq-text-white);
}

.desktop-sidebar-nav__icon {
  font-size: 20px;
  margin-right: 12px;
  color: inherit;
  width: 20px;
  text-align: center;
}

.desktop-sidebar-nav__label {
  font-size: 14px;
  font-weight: 500;
  color: inherit;
}

/* Sub-items */
.desktop-sidebar-nav__subitems {
  padding-left: 16px;
}

.desktop-sidebar-nav__subitem {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  text-decoration: none;
  color: #6c757d;
  transition: all 0.15s ease;
  position: relative;
}

.desktop-sidebar-nav__subitem:hover {
  background-color: rgba(0, 0, 0, 0.03);
  color: #495057;
  text-decoration: none;
}

.desktop-sidebar-nav__subitem[data-locked="true"] {
  opacity: 0.7;
}

.desktop-sidebar-nav__subitem--active {
  background: var(--traq-gradient-primary-90deg-alpha-15);
  color: var(--traq-color-primary);
  border-left: 3px solid var(--traq-color-primary);
}

.desktop-sidebar-nav__subitem--active .desktop-sidebar-nav__subitem-icon,
.desktop-sidebar-nav__subitem--active .desktop-sidebar-nav__subitem-label {
  color: var(--traq-color-primary);
}

.desktop-sidebar-nav__subitem-icon {
  font-size: 16px;
  margin-right: 12px;
  color: inherit;
  width: 16px;
  text-align: center;
}

.desktop-sidebar-nav__subitem-label {
  font-size: 13px;
  font-weight: 400;
  color: inherit;
  flex: 1;
}

.desktop-sidebar-nav__lock-icon {
  font-size: 12px;
  margin-left: 8px;
  color: #6c757d;
}

.desktop-sidebar-nav__subscriber-badge {
  font-size: 12px;
  margin-left: 8px;
  color: #ffc107;
}

/* ============================================ */
/* RESPONSIVE CONTENT MARGIN */
/* ============================================ */

/* Add padding to bottom of main content on mobile for bottom nav */
.main--with-navigation {
  padding-bottom: calc(64px + 16px);
}

/* Desktop layout with sidebar - fix Bootstrap container centering */
@media (min-width: 768px) {
  .main--with-navigation {
    padding-bottom: 16px;
  }

  /*
   * Fix for Bootstrap containers with sidebar navigation:
   * Use body padding instead of container margin to preserve Bootstrap's centering.
   * The sidebar overlays the body padding, and the container centers in remaining space.
   */
  body:has(.desktop-sidebar-nav) {
    padding-left: 240px;
  }

  /* Sidebar is fixed at left edge, overlaying the body padding */
  .desktop-sidebar-nav {
    left: 0;
  }

  /* Reset header margin since body has padding now */
  body:has(.desktop-sidebar-nav) .header--with-sidebar {
    margin-left: 0;
  }

  /* Container uses Bootstrap's default centering in remaining space */
  body:has(.desktop-sidebar-nav) .main--with-navigation.container {
    margin-left: auto;
    margin-right: auto;
    max-width: var(--bs-breakpoint-xl, 1320px);
  }

  /* Fallback for browsers without :has() support */
  @supports not (selector(:has(*))) {
    .header--with-sidebar {
      margin-left: 240px;
    }

    .main--with-navigation.container {
      /* For older browsers, limit width to account for sidebar */
      max-width: min(var(--bs-breakpoint-xl, 1320px), calc(100vw - 240px - 2rem));
    }
  }

  /* Hide top navigation on desktop when sidebar is present */
  .header--with-sidebar .navbar {
    display: none;
  }
}

/* ============================================ */
/* ACCESSIBILITY */
/* ============================================ */

/* Focus indicators */
.mobile-bottom-nav__item:focus,
.desktop-sidebar-nav__item:focus,
.desktop-sidebar-nav__subitem:focus {
  outline: 2px solid var(--traq-color-primary);
  outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .mobile-bottom-nav__item--active {
    border: 2px solid currentColor;
  }

  .desktop-sidebar-nav__item--active {
    border-left-width: 4px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .mobile-bottom-nav__item,
  .desktop-sidebar-nav__item,
  .desktop-sidebar-nav__subitem {
    transition: none;
  }
}
