/*
Navigation CSS for EmpowerEd Admin Interface
Created: September 7, 2025
Updated: October 1, 2025 - FULL WIDTH FIX
VERSION: 2.0.2 - Added 100vw + viewport breakout to force full width
Role-based navigation with accessibility compliance
*/

/* ===== NAVIGATION CONTAINER ===== */
.empowered-nav {
  background-color: var(--primary-color);
  border-bottom: 3px solid var(--primary-hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100vw; /* Force full viewport width */
  max-width: none !important; /* Override any parent constraints */
  margin-left: calc(-50vw + 50%); /* Center it if inside a constrained parent */
  margin-right: calc(-50vw + 50%); /* Center it if inside a constrained parent */
}

.nav-container {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

/* ===== NAVIGATION BRAND ===== */
.nav-brand {
  display: flex;
  align-items: center;
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.25rem;
  padding: 1rem 0;
}

.nav-brand:hover {
  color: #e8f0fe;
  text-decoration: none;
}

.nav-brand .brand-icon {
  margin-right: 0.5rem;
  width: 24px;
  height: 24px;
}

/* ===== MAIN NAVIGATION MENU ===== */
.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.nav-item {
  position: relative;
  margin: 0 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  color: white;
  text-decoration: none;
  padding: 1rem 1.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-weight: 500;
  position: relative;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  text-decoration: none;
}

.nav-link.active {
  background-color: var(--primary-hover);
  font-weight: 600;
}

.nav-link .nav-icon {
  margin-right: 0.5rem;
  width: 18px;
  height: 18px;
}

/* ===== DROPDOWN MENUS ===== */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle::after {
  content: '▼';
  font-size: 0.75rem;
  margin-left: 0.5rem;
  transition: transform 0.2s ease;
}

.nav-dropdown.open .nav-dropdown-toggle::after {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  min-width: 220px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1001;
}

.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-item {
  display: block;
  color: var(--text-color);
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
}

.nav-dropdown-item:hover {
  background-color: #f8f9fa;
  text-decoration: none;
}

.nav-dropdown-item .nav-icon {
  margin-right: 0.75rem;
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

/* ===== USER MENU ===== */
.nav-user {
  display: flex;
  align-items: center;
  margin-left: 1rem;
}

.nav-user-info {
  display: flex;
  align-items: center;
  color: white;
  margin-right: 1rem;
}

.nav-user-role {
  background-color: rgba(255, 255, 255, 0.9);
  color: var(--primary-color);
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

.nav-user-menu {
  position: relative;
}

.nav-user-toggle {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  color: white;
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.nav-user-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1001;
}

.nav-user-menu.open .nav-user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ===== BREADCRUMBS ===== */
.nav-breadcrumbs {
  background-color: #f8f9fa;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 2rem;
}

.breadcrumb-container {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
}

.breadcrumb {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: center;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  color: #4a5568;
  margin: 0 0.75rem;
  font-weight: 400;
}

.breadcrumb-link {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumb-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: #4a5568;
  font-weight: 500;
}

/* ===== ROLE-BASED VISIBILITY ===== */
.nav-role-student { display: none; }
.nav-role-instructor { display: none; }
.nav-role-company-admin { display: none; }
.nav-role-empowered-admin { display: none; }

/* Show based on user role */
body[data-user-role="student"] .nav-role-student,
body[data-user-role="student"] .nav-role-all { display: flex; }

body[data-user-role="at_instructor"] .nav-role-instructor,
body[data-user-role="at_instructor"] .nav-role-student,
body[data-user-role="at_instructor"] .nav-role-all { display: flex; }

body[data-user-role="company_admin"] .nav-role-company-admin,
body[data-user-role="company_admin"] .nav-role-instructor,
body[data-user-role="company_admin"] .nav-role-student,
body[data-user-role="company_admin"] .nav-role-all { display: flex; }

body[data-user-role="empowered_admin"] .nav-role-empowered-admin,
body[data-user-role="empowered_admin"] .nav-role-company-admin,
body[data-user-role="empowered_admin"] .nav-role-instructor,
body[data-user-role="empowered_admin"] .nav-role-student,
body[data-user-role="empowered_admin"] .nav-role-all { display: flex; }

/* ===== MOBILE NAVIGATION ===== */
.nav-mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

@media (max-width: 968px) {
  .nav-menu {
    position: fixed;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--primary-color);
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }

  .nav-menu.open {
    transform: translateX(0);
  }

  .nav-mobile-toggle {
    display: block;
  }

  .nav-item {
    margin: 0;
    width: 100%;
  }

  .nav-link {
    padding: 1rem 2rem;
    border-radius: 0;
    justify-content: flex-start;
  }

  .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    margin-top: 0;
  }

  .nav-dropdown-item {
    color: white;
    padding-left: 3rem;
  }

  .nav-dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }

  .nav-user {
    flex-direction: column;
    align-items: flex-start;
    margin: 1rem 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
  }

  .nav-breadcrumbs {
    padding: 0.5rem 1rem;
  }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
.nav-link:focus,
.nav-dropdown-item:focus,
.nav-user-toggle:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.nav-skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary-color);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 10000;
  border-radius: 4px;
}

.nav-skip-link:focus {
  top: 6px;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== NOTIFICATION BADGES ===== */
.nav-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background-color: var(--danger-color);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.4rem;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  line-height: 1;
}

.nav-badge.nav-badge-success {
  background-color: var(--secondary-color);
}

.nav-badge.nav-badge-warning {
  background-color: #ff9800;
}

/* ===== ROLE-BASED NAVIGATION ===== */
.role-navigation {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 0;
  margin-bottom: 1rem;
}

.role-navigation h2 {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: center;
}

.nav-links-container {
  display: block;
  width: 100%;
}

.nav-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  max-width: 100%;
  width: 100%;
}

.nav-item {
  flex: 0 0 auto;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  min-width: 140px;
  justify-content: flex-start;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-link:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.nav-link:focus {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

.nav-icon {
  font-size: 1.1rem;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.nav-link:hover .nav-icon {
  opacity: 1;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Desktop and large screens - force horizontal layout */
@media screen and (min-width: 1024px) {
  #role-navigation .nav-group {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    align-items: flex-start !important;
  }
  
  #role-navigation .nav-item {
    flex: 0 0 auto !important;
    margin: 0 0.375rem 0.5rem 0.375rem !important;
    display: inline-block !important;
  }
  
  #role-navigation .nav-link {
    min-width: 220px !important;
    max-width: 220px !important;
    padding: 0.7rem 1rem !important;
    font-size: 0.9rem !important;
    display: inline-flex !important;
    margin: 0 !important;
    text-align: center !important;
    justify-content: center !important;
    flex-direction: column !important;
    align-items: center !important;
    line-height: 1.3 !important;
  }
  
  #role-navigation .nav-link .nav-icon {
    font-size: 1.2rem !important;
    margin-bottom: 0.25rem !important;
    display: block !important;
  }
  
  #role-navigation .nav-link span:not(.nav-icon) {
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
  }
}

/* Tablet screens */
@media (max-width: 1023px) and (min-width: 769px) {
  .nav-group {
    gap: 0.6rem;
  }
  
  .nav-link {
    min-width: 160px;
    padding: 0.6rem 0.9rem;
  }
}

/* Small tablet and large mobile */
@media (max-width: 768px) {
  .role-navigation {
    padding: 1rem 0;
  }
  
  .nav-links-container {
    gap: 0.5rem;
  }
  
  .nav-group {
    gap: 0.5rem;
  }
  
  .nav-link {
    min-width: 140px;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
  }
}

/* Mobile phones - stack vertically */
@media (max-width: 480px) {
  .nav-group {
    flex-direction: column;
    width: 100%;
  }
  
  .nav-link {
    min-width: 100%;
    justify-content: center;
  }
}