/* Navbar - Sticky at top */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #343a40;
  color: white;
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Navbar Sections */
.navbar-section {
  display: flex;
  align-items: center;
}

.navbar-center {
  grid-column: 2;
  display: flex;
  justify-content: center;
  min-width: 0;
  justify-self: center;
}

.navbar-right {
  grid-column: 3;
  justify-self: end;
  flex: 0 0 auto;
  position: relative;
}

.navbar-spacer {
  grid-column: 1;
}

.navbar-center-nav {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  justify-content: center;
}

.navbar-household-wrap {
  position: relative;
  width: 17rem;
  flex: 0 0 17rem;
  margin: 0;
}

.navbar .household-switcher {
  display: block;
  width: 100%;
}

.navbar-icon-link {
  width: 48px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #ffffff;
  background: #495057;
  border: 1px solid #5a6268;
  border-radius: 0;
  font-size: 1.2rem;
  line-height: 1;
  transition: background 0.2s;
}

.navbar-icon-link:hover {
  background: #5a6268;
}

.navbar-icon-link:focus-visible {
  outline: 2px solid #9ec5fe;
  outline-offset: 2px;
}

.navbar-icon-left {
  margin-right: 0;
  border-radius: 8px 0 0 8px;
  border-right: none;
}

.navbar-icon-right {
  margin-left: 0;
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.navbar .household-switcher-toggle {
  border-radius: 0;
  height: 40px;
  padding: 0 0.75rem;
}

/* User Button */
.navbar-user-btn {
  background: #495057;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-user-btn:hover {
  background: #5a6268;
}

.navbar-user-icon {
  width: 18px;
  height: 18px;
  display: none;
  color: #ffffff;
}

.navbar-user-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  display: block;
}

.navbar-user-name {
  display: inline-block;
}

/* Dropdown Overlay */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background: transparent;
}

/* Dropdown Base Styles */
.navbar-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  min-width: 180px;
  overflow: hidden;
}

/* Navigation Dropdown */
.user-dropdown {
  right: 0;
  min-width: 200px;
}

.user-dropdown-info {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #dee2e6;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.user-dropdown-username {
  font-size: 1rem;
  font-weight: 600;
  color: #343a40;
}

.user-dropdown-role {
  font-size: 0.85rem;
  color: #6c757d;
  text-transform: capitalize;
}

.user-dropdown-link {
  display: block;
  width: 100%;
  padding: 0.75rem 1.25rem;
  color: #343a40;
  text-decoration: none;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s;
}

.user-dropdown-link:hover {
  background: #f8f9fa;
}

.user-dropdown-logout {
  width: 100%;
  background: #dc3545;
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: background 0.2s;
}

.user-dropdown-logout:hover {
  background: #c82333;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .navbar {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }

  .navbar-household-wrap {
    width: 14rem;
    flex: 0 0 14rem;
  }

  .navbar-icon-link {
    width: 42px;
    height: 40px;
    font-size: 1rem;
  }

  .navbar-icon-left {
    margin-right: 0;
  }

  .navbar-icon-right {
    margin-left: 0;
  }

  .navbar-user-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
  }

  .user-dropdown {
    min-width: 180px;
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 0.5rem;
    grid-template-columns: auto 1fr auto;
  }

  .navbar-household-wrap {
    width: 11rem;
    flex: 0 0 11rem;
  }

  .navbar-icon-left {
    margin-right: 0;
  }

  .navbar-icon-right {
    margin-left: 0;
  }
}

@media (max-width: 360px) {
  .navbar-household-wrap {
    width: 10rem;
    flex: 0 0 10rem;
  }
}

@media (max-width: 900px) {
  .navbar-user-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }

  .navbar-user-icon {
    display: inline-flex;
  }

  .navbar-user-name {
    display: none;
  }
}
