/* B3 minimal header: .hdr, .brand, .nav, .dropdown, .user (source: docs/design/header_prototypes.html) */
.hdr {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #faf8f5;
  border-bottom: 1px solid #e8e4de;
  padding: 0.3rem 1.25rem;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.25rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.hdr .brand {
  font-size: 1.05rem;
  font-weight: 700;
  color: #2c5282;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.35;
  padding: 0.2rem 0;
  flex-shrink: 0;
}

.hdr .brand:hover {
  color: #1a365d;
}

.hdr-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid #e8e4de;
  border-radius: 4px;
  background: #fff;
  color: #5a524c;
  cursor: pointer;
  flex-shrink: 0;
}

.hdr-nav-toggle:hover {
  color: #2c5282;
  border-color: #c9c2b8;
  background: rgba(44, 82, 130, 0.06);
}

.hdr-nav-toggle-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.hdr .nav {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  margin-left: 0.75rem;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
}

.hdr .nav a {
  color: #5a524c;
  text-decoration: none;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 1rem;
  line-height: 1.35;
  white-space: nowrap;
}

.hdr .nav a:hover {
  color: #2c5282;
  background: rgba(44, 82, 130, 0.08);
}

.hdr .nav a.active {
  color: #2c5282;
  background: rgba(44, 82, 130, 0.1);
}

.hdr .user {
  margin-left: auto;
  color: #3d3730;
  font-size: 0.875rem;
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  white-space: nowrap;
  line-height: 1.35;
  flex-shrink: 0;
}

.hdr .user:hover {
  background: #ede9e3;
}

/* Dropdown in header */
.hdr .nav .dropdown {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.hdr .nav .dropdown-toggle {
  color: #5a524c;
  text-decoration: none;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 1rem;
  line-height: 1.35;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.hdr .nav .dropdown-toggle:hover {
  color: #2c5282;
  background: rgba(44, 82, 130, 0.08);
}

.hdr .nav .dropdown-toggle::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-top-color: currentColor;
  margin-top: 2px;
}

.hdr .nav .dropdown.show .dropdown-toggle {
  color: #2c5282;
  background: rgba(44, 82, 130, 0.1);
}

.hdr .nav .dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 2px;
  min-width: 200px;
  padding: 0.25rem 0;
  background: #faf8f5;
  border: 1px solid #e8e4de;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.hdr .nav .dropdown.show .dropdown-menu {
  display: block;
}

.hdr .nav .dropdown-item {
  display: block;
  padding: 0.35rem 0.75rem;
  font-size: 1rem;
  line-height: 1.35;
  color: #5a524c;
  text-decoration: none;
}

.hdr .nav .dropdown-item:hover {
  color: #2c5282;
  background: rgba(44, 82, 130, 0.08);
}

.hdr .nav .dropdown-item.active {
  color: #2c5282;
  background: rgba(44, 82, 130, 0.1);
}

/* Menu entries visible by object-level rules but blocked by route guards (admin/mentor pages) */
.hdr .nav span.nav-item-disabled {
  color: #a8a29a;
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.72;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 1rem;
  line-height: 1.35;
  display: inline-block;
  white-space: nowrap;
}

.hdr .nav .dropdown-item.nav-item-disabled {
  color: #a8a29a;
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.72;
}

.hdr .nav .dropdown-item.nav-item-disabled:hover {
  color: #a8a29a;
  background: transparent;
}

/* Narrow viewports: hamburger + collapsible nav drawer (no second row, no horizontal scroll) */
@media (max-width: 992px) {
  .hdr {
    position: relative;
    z-index: 120;
    padding: 0.35rem 0.75rem;
    gap: 0.35rem;
    overflow: visible;
  }

  .hdr .brand {
    flex: 0 0 auto;
  }

  .hdr-nav-toggle {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .hdr .user {
    margin-left: auto;
  }

  .hdr .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex: none;
    width: 100%;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding: 0.35rem 0.5rem 0.5rem;
    background: #faf8f5;
    border-bottom: 1px solid #e8e4de;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    max-height: calc(100vh - var(--app-header-height, 56px));
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 130;
  }

  .hdr .nav.show {
    display: flex;
  }

  .hdr .nav > a,
  .hdr .nav > span.nav-item-disabled {
    width: 100%;
    box-sizing: border-box;
  }

  .hdr .nav .dropdown {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .hdr .nav .dropdown-toggle {
    width: 100%;
    justify-content: space-between;
    text-align: left;
  }

  .hdr .nav .dropdown-menu {
    position: static;
    display: none;
    width: 100%;
    min-width: 0;
    margin-top: 0;
    box-shadow: none;
    border: none;
    border-left: 2px solid #e8e4de;
    border-radius: 0;
    margin-left: 0.35rem;
    padding-left: 0.35rem;
    background: transparent;
  }

  .hdr .nav .dropdown.show .dropdown-menu {
    display: block;
  }
}
