/*
 * Navigation Styles - Basecoat Integration
 *
 * Limberjack's navigation has a highly custom design with unique mobile/desktop layouts.
 * Basecoat provides foundational classes, but we maintain custom styles for:
 * - Sticky header with brand styling
 * - Mobile collapsible menu
 * - Desktop horizontal navigation with rounded active states
 *
 * Future optimization: Could leverage Basecoat's navigation primitives for
 * simpler nav sections, but current design is preserved for brand consistency.
 */

/* Page Header - Mobile First */
.page-header {
  background-color: var(--black);
  color: var(--light-gray);
  border-top: 5px solid var(--black);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Header Top Section */
.header-top {
  background-color: var(--black);
  position: relative;
  z-index: 10;
}

.banner-header {
  background-color: var(--black);
  color: var(--medium-gray);
  text-transform: uppercase;
  padding: 0.75rem;
  margin-bottom: 0;
  flex-shrink: 0;
  font-size: 1rem;
  text-align: center;
}

.app-name {
  color: var(--light-gray);
  font-style: italic;
}

/* Mobile Navigation Wrapper */
.mobile-nav-wrapper {
  background-color: var(--primary-color-dark);
  width: 100%;
  padding: 0;
  border-bottom: 5px solid var(--primary-color);
}

/* Mobile Menu Toggle using Summary */
.mobile-menu-toggle {
  position: absolute;
  right: 1rem;
  top: 0.75rem;
  background: none;
  border: none;
  color: var(--light-gray);
  font-size: 1.5rem;
  padding: 0.5rem;
  cursor: pointer;
  display: block;
  list-style: none;
  z-index: 20;
}

.mobile-menu-toggle::-webkit-details-marker {
  display: none;
}

.mobile-menu-toggle:hover {
  opacity: 0.8;
}

.mobile-menu-toggle:focus {
  outline: 2px solid var(--light-gray);
  outline-offset: 2px;
}

/* Rotate icon when open */
.mobile-nav-wrapper[open] .menu-icon {
  transform: rotate(90deg);
  transition: transform 0.2s ease;
}

.menu-icon {
  display: inline-block;
  transition: transform 0.2s ease;
}

/* Screen reader only text */
.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;
}

/* Main Navigation - Mobile */
.main-nav {
  background-color: var(--primary-color-dark);
  padding: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.main-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
}

.main-nav-item {
  list-style: none;
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
}

.main-nav-item:last-child {
  border-bottom: none;
}

.main-nav-account-controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 1rem;
  border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.main-nav-account-controls-form {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
}

.main-nav-account-controls-form .btn {
  width: 100%;
  text-align: center;
}

.account-link {
  color: var(--light-gray);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.account-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  text-decoration: underline;
}

.nav-link {
  text-decoration: none;
  color: var(--light-gray);
  padding: 1rem;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px; /* Touch-friendly size */
  font-size: 1.1rem;

  &:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease;
  }
}

.nav-link-active {
  background-color: var(--primary-color);
  border-left: 4px solid var(--light-gray);
}

.subnav {
  display: block;
  background-color: var(--primary-color);
  padding: 0;
  margin: 0;
  list-style: none;
  /* overflow: hidden; */
}

.subnav-item {
  padding: 0;
}

.subnav-item,
.subnav-item-link {
  color: var(--light-gray);
  padding: calc(var(--spacing-unit) / 2);
  display: inline-block;
  text-decoration: none;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
  border-top-right-radius: 5px;
  border-top-left-radius: 5px;
  line-height: 1;
  list-style: none;
}

.subnav-item:hover {
  background-color: var(--primary-color-dark);
  transition: background-color 0.3s ease;
}

.subnav-item-active {
  background-color: var(--dark-gray);
  border-style: dashed;
  border-width: 1px 1px 0 1px;
  border-color: var(--primary-color);

  &:hover {
    background-color: var(--dark-gray);
  }
}

/* Page Footer */
.page-footer {
  background-color: #000000;
  padding: 1rem;
}

/* Edit/Return Links */
.edit-link {
  color: white;
  text-decoration: none;
  font-size: 0.75rem;
  opacity: 0.8;
}

.edit-link:hover {
  opacity: 1;
}

.return-link {
  margin-bottom: 1rem;
}

/* Desktop Styles - Applied for larger screens */
@media (min-width: 768px) {
  /* Page Header - Desktop */
  .page-header {
    flex-direction: row;
    align-items: stretch;
    position: static;
    overflow: visible;
  }
  
  /* Header Top - Desktop */
  .header-top {
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }
  
  .banner-header {
    font-size: 1.2rem;
    padding: var(--spacing-unit);
    text-align: left;
    position: relative;
  }
  
  /* Mobile Navigation Wrapper - Desktop */
  .mobile-nav-wrapper {
    background-color: var(--primary-color-dark);
    flex: 1;
    display: flex;
    align-items: stretch;
    overflow: visible;
  }
  
  /* Always open on desktop */
  .mobile-nav-wrapper[open] {
    display: flex;
  }
  
  /* Hide mobile menu toggle on desktop */
  .mobile-menu-toggle {
    display: none;
  }
  
  /* Main Navigation - Desktop */
  .main-nav {
    display: flex; /* Always show on desktop */
    flex-direction: row;
    flex: 1;
    align-items: stretch;
    justify-content: space-between;
    background-color: var(--primary-color-dark);
    overflow: visible;
  }
  
  .main-nav-list {
    flex-direction: row;
    gap: var(--spacing-unit);
    align-items: stretch;
    width: auto;
  }
  
  .main-nav-item {
    border-bottom: none;
    width: auto;
    align-items: stretch;
  }
  
  .nav-link {
    padding: var(--spacing-unit);
    width: auto;
    height: 100%;
    font-size: 1rem;
    
    &:hover {
      background-color: transparent;
      text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
      transition: text-shadow 0.3s ease;
    }
  }
  
  .nav-link-active {
    border-left: none;
    background-color: var(--primary-color);
    border-top-right-radius: 15px;
    border-top-left-radius: 15px;
    border-style: dashed;
    border-width: 1px 1px 0 1px;
    border-color: var(--primary-color-dark);
  }
  
  .nav-link-active:hover {
    background-color: var(--primary-color);
  }
  
  .main-nav-account-controls {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0;
    border-top: none;
    padding-right: 1rem;
  }
  
  .main-nav-account-controls-form {
    display: inline;
    width: auto;
    margin-top: 0;
  }
  
  .main-nav-account-controls-form .btn {
    width: auto;
  }
}
