/* =====================================================
   NAVBAR + USER MENU (ISOLATED, CLEAN, NO CONFLICTS)
   ===================================================== */

/* ----- Header & Nav container ----- */

.main-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;

  background-color: #0b1120;
  color: #f9fafb;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.35);
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0.6rem 1.5rem;
  white-space: nowrap;

  /* IMPORTANT: allow dropdown to escape */
  overflow: visible;
}

/* ----- Left side (brand + links) ----- */

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-link:hover {
  text-decoration: none;
  color: inherit;
}

.main-nav .nav-link {
  color: #e5e7eb;
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.main-nav .nav-link:hover {
  background-color: #1f2937;
  color: #ffffff;
}

.main-nav .nav-link--active {
  color: #38bdf8;
  border-bottom: 2px solid #38bdf8;
  font-weight: 500;
}

/* ----- Global Parameters dropdown ----- */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-dropdown__toggle {
  cursor: pointer;
}

.nav-dropdown__menu {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 220px;
  padding: 8px;
  background-color: #0b1120;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
  display: none;
  z-index: 2000;
}

.nav-dropdown:hover .nav-dropdown__menu,
.nav-dropdown__menu:hover {
  display: block;
}

.nav-dropdown__item {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  color: #e5e7eb;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.nav-dropdown__item:hover {
  background-color: #1f2937;
  color: #ffffff;
}

.nav-dropdown::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 6px;
  display: block;
}

/* ----- Right side (user menu) ----- */

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Project Switcher */
.project-switcher {
  margin-right: 0.5rem;
}

.project-switcher-select {
  min-width: 180px;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f9fafb;
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
}

.project-switcher-select:focus {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: #f9fafb;
  box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.project-switcher-select option {
  background-color: #0b1120;
  color: #f9fafb;
}

/* Username */

.user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.user-name {
  font-weight: 600;
  color: #e5e7eb;
  white-space: nowrap;
}

/* ----- Avatar ----- */

.avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  padding: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Fallback letter if image fails */
.avatar-btn.avatar-fallback::after {
  content: "A";
  font-weight: 700;
  color: #ffffff;
}

/* ----- User dropdown (namespaced, no Bootstrap conflict) ----- */

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;

  min-width: 220px;
  padding: 8px;

  background-color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);

  display: none;
  z-index: 2000;
}

.user-dropdown.is-open {
  display: block;
}

.user-dropdown__item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;

  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;

  color: #111827;
}

.user-dropdown__item:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.user-dropdown__sep {
  height: 1px;
  margin: 6px 8px;
  background-color: rgba(0, 0, 0, 0.08);
}

.user-dropdown__item--disabled {
  opacity: 0.55;
  pointer-events: none;
}

.user-dropdown__item--danger {
  color: #b42318;
}

.main-nav .nav-link--active {
  color: #38bdf8; /* light blue */
  border-bottom: 2px solid #38bdf8;
  font-weight: 500;
}

/* ----- Notifications Bell ----- */

.notifications-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.notifications-btn {
  position: relative;
  width: auto;
  height: auto;
  border: none;
  background: transparent;
  padding: 0.4rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
  margin-left: 0;
  margin-right: 0.5rem;
}

.notifications-btn:hover {
  opacity: 0.8;
}

.notifications-icon {
  width: 20px;
  height: 20px;
  color: #e5e7eb;
  stroke-width: 2;
}

.notifications-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background-color: #ef4444;
  color: #ffffff;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0b1120;
  box-sizing: border-box;
}

/* ----- Notifications Dropdown ----- */

.notifications-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;

  width: 360px;
  max-height: 480px;
  background-color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);

  display: none;
  flex-direction: column;
  z-index: 2000;
}

.notifications-dropdown.is-open {
  display: flex;
}

.notifications-dropdown__header {
  padding: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.notifications-dropdown__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}

.notifications-dropdown__list {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
}

.notifications-dropdown__empty {
  padding: 32px 16px;
  text-align: center;
  color: #6b7280;
  font-size: 0.9rem;
}

.notifications-dropdown__item {
  display: flex;
  flex-direction: column;
  padding: 12px;
  margin-bottom: 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.notifications-dropdown__item:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.notifications-dropdown__item.is-read {
  opacity: 0.65;
}

.notifications-dropdown__item-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: #111827;
  margin-bottom: 4px;
}

.notifications-dropdown__item-body {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 4px;
  line-height: 1.4;
}

.notifications-dropdown__item-time {
  font-size: 0.75rem;
  color: #9ca3af;
}

.notifications-dropdown__footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  text-align: center;
}

.notifications-dropdown__view-all {
  color: #3b82f6;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.notifications-dropdown__view-all:hover {
  text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .notifications-dropdown {
    width: calc(100vw - 32px);
    max-width: 360px;
    right: -16px;
  }
}