/* Navigation Styles - BEM Methodology */

/* Dashboard Navigation */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  height: 64px;
}

.nav__container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__spacer {
  height: 64px;
}

/* Brand Section */
.nav__brand {
  flex-shrink: 0;
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.nav__logo:hover {
  transform: scale(1.05);
}

.nav__logo-icon {
  font-size: 1.75rem;
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  width: 40px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.nav__logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: -0.5px;
}

/* Mobile Toggle */
.nav__mobile-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav__mobile-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #4b5563;
  border-radius: 2px;
  transition: all 0.3s ease;
  margin: 0 auto;
}

.nav__mobile-toggle--active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav__mobile-toggle--active span:nth-child(2) {
  opacity: 0;
}

.nav__mobile-toggle--active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Menu Container */
.nav__menu {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex: 1;
  justify-content: space-between;
  margin-left: 3rem;
}

/* Navigation Links */
.nav__links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav__link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  color: #6b7280;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-weight: 500;
  position: relative;
}

.nav__link:hover {
  color: #764ba2;
  background: rgba(118, 75, 162, 0.08);
}

.nav__link--active {
  color: #764ba2;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.nav__link--active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1rem;
  right: 1rem;
  height: 2px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
}

.nav__link-icon {
  font-size: 1.125rem;
}

.nav__link-text {
  font-size: 0.875rem;
}

/* User Section */
.nav__user {
  flex-shrink: 0;
}

/* Dropdown */
.nav__dropdown {
  position: relative;
}

.nav__dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 0.875rem;
}

.nav__dropdown-toggle:hover {
  background: white;
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav__avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.nav__username {
  color: #374151;
  font-weight: 500;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav__dropdown-arrow {
  font-size: 0.625rem;
  color: #9ca3af;
  transition: transform 0.2s ease;
}

.nav__dropdown-toggle--active .nav__dropdown-arrow {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.nav__dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 240px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1001;
}

.nav__dropdown-menu--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav__dropdown-header {
  padding: 1rem;
  background: #f9fafb;
  border-radius: 12px 12px 0 0;
}

.nav__dropdown-email {
  font-size: 0.875rem;
  color: #1f2937;
  font-weight: 500;
  word-break: break-all;
}

.nav__dropdown-role {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

.nav__dropdown-divider {
  height: 1px;
  background: #e5e7eb;
}

.nav__dropdown-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #4b5563;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.nav__dropdown-link:hover {
  background: #f9fafb;
  color: #764ba2;
}

.nav__dropdown-button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: #ef4444;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 0.875rem;
  border-radius: 0 0 12px 12px;
}

.nav__dropdown-button:hover {
  background: #fef2f2;
}

.nav__dropdown-icon {
  font-size: 1rem;
}

/* Simple Header for Non-authenticated Users */
.header {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header__container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__brand {
  flex-shrink: 0;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.header__logo:hover {
  transform: scale(1.05);
}

.header__logo-icon {
  font-size: 1.75rem;
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  width: 40px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.header__logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: -0.5px;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header__link {
  padding: 0.5rem 1.25rem;
  color: #6b7280;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  border-radius: 8px;
  font-size: 0.875rem;
}

.header__link:hover {
  color: #764ba2;
  background: rgba(118, 75, 162, 0.08);
}

.header__link--primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.header__link--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  color: white;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Flash Messages */
.flash {
  position: fixed;
  top: 80px;
  right: 1.5rem;
  left: 1.5rem;
  max-width: 500px;
  margin: 0 auto;
  padding: 1rem 3rem 1rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: flash-slide-in 0.3s ease-out;
  z-index: 1100;
  font-size: 0.875rem;
  line-height: 1.5;
}

@keyframes flash-slide-in {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flash--notice {
  background: linear-gradient(135deg, #86efac 0%, #22c55e 100%);
  color: #14532d;
  border: 1px solid #16a34a;
}

.flash--alert {
  background: linear-gradient(135deg, #fca5a5 0%, #ef4444 100%);
  color: white;
  border: 1px solid #dc2626;
}

.flash__close {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.3);
  border: none;
  color: inherit;
  font-size: 1.5rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.flash__close:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: translateY(-50%) scale(1.1);
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav__mobile-toggle {
    display: flex;
  }

  .nav__menu {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    flex-direction: column;
    padding: 1.5rem;
    margin-left: 0;
    gap: 1.5rem;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    border-top: 1px solid #e5e7eb;
    overflow-y: auto;
    z-index: 999;
  }

  .nav__menu--open {
    transform: translateX(0);
  }

  .nav__links {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  .nav__link {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

  .nav__link--active::after {
    bottom: 0.75rem;
    top: 0.75rem;
    left: 0;
    right: auto;
    width: 3px;
    height: auto;
  }

  .nav__user {
    width: 100%;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
  }

  .nav__dropdown-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .nav__dropdown-menu {
    position: static;
    width: 100%;
    margin-top: 0.5rem;
    box-shadow: none;
    border: 1px solid #e5e7eb;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
  }

  .nav__dropdown-menu--open {
    display: block;
  }

  .header__container {
    padding: 0.75rem 1rem;
  }

  .header__nav {
    gap: 0.5rem;
  }

  .header__link {
    padding: 0.5rem 0.75rem;
    font-size: 0.813rem;
  }

  .flash {
    top: 70px;
    right: 1rem;
    left: 1rem;
  }
}

@media (max-width: 480px) {
  .nav__logo-text {
    display: none;
  }

  .header__logo-text {
    display: none;
  }

  .nav__username {
    display: none;
  }
}

/* Main Content Adjustment */
.main {
  min-height: calc(100vh - 64px);
  padding: 2rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .nav__mobile-toggle span,
  .nav__menu,
  .nav__link,
  .nav__dropdown-toggle,
  .nav__dropdown-menu,
  .flash {
    transition: none;
    animation: none;
  }
}