/* Shared ArchiveFM top bar (Sales intelligence style) — works on all page themes */

.afm-topbar {
  background: #fff;
  border-bottom: 1px solid #e6e6e6;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px clamp(1rem, 3vw, 2rem);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}

.afm-brand {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1f2937;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.afm-brand:hover {
  color: #1f4f9a;
  text-decoration: none;
}

.afm-nav {
  display: flex;
  gap: 14px;
  margin-left: auto;
  font-size: 0.92rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 6px;
}

.afm-nav a {
  color: #5a6f93;
  text-decoration: none;
  white-space: nowrap;
}

.afm-nav a:hover {
  color: #1f4f9a;
  text-decoration: none;
}

.afm-nav a.here {
  color: #1f4f9a;
  font-weight: 600;
}

.afm-nav-divider {
  width: 1px;
  height: 18px;
  background: #e6e6e6;
  flex-shrink: 0;
}

.afm-nav-dropdown {
  position: relative;
}

.afm-nav-dropdown-toggle {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 0.92rem;
  color: #5a6f93;
  cursor: pointer;
  white-space: nowrap;
}

.afm-nav-dropdown-toggle:hover,
.afm-nav-dropdown-toggle.here {
  color: #1f4f9a;
}

.afm-nav-dropdown-toggle.here {
  font-weight: 600;
}

.afm-nav-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 190px;
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 200;
  overflow: hidden;
}

.afm-nav-dropdown-menu a {
  display: block;
  padding: 0.55rem 0.85rem;
  color: #5a6f93;
  text-decoration: none;
}

.afm-nav-dropdown-menu a:hover {
  background: #f5f5f5;
  color: #1f4f9a;
  text-decoration: none;
}

.afm-nav-dropdown-menu a.here {
  color: #1f4f9a;
  font-weight: 600;
  background: #f8fbff;
}

.afm-auth {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 4px;
}

.afm-topbar .sign-in-btn {
  padding: 0.42rem 0.9rem;
  background: #1f4f9a;
  color: #fff;
  border-radius: 7px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: background 0.15s;
}

.afm-topbar .sign-in-btn:hover {
  background: #21467f;
  opacity: 1;
  text-decoration: none;
}

.afm-topbar .user-menu {
  position: relative;
}

.afm-topbar .user-menu-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid #e2e2e2;
  border-radius: 999px;
  padding: 0.3rem 0.75rem 0.3rem 0.3rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s;
}

.afm-topbar .user-menu-toggle:hover {
  border-color: #1f4f9a;
}

.afm-topbar .user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.afm-topbar .user-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1f4f9a;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
}

.afm-topbar .user-name {
  font-size: 0.88rem;
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.afm-topbar .user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: white;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
}

.afm-topbar .dropdown-email {
  padding: 0.75rem 1rem 0.5rem;
  font-size: 0.8rem;
  color: #5a6f93;
  border-bottom: 1px solid #f0f0f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.afm-topbar .dropdown-item {
  display: block;
  padding: 0.6rem 1rem;
  color: #1f2937;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.1s;
}

.afm-topbar .dropdown-item:hover {
  background: #f5f5f5;
  text-decoration: none;
}

.afm-topbar .dropdown-logout {
  border-top: 1px solid #f0f0f0;
  color: #dc3545;
}

@media (max-width: 480px) {
  .afm-topbar .user-name {
    display: none;
  }

  .afm-topbar .user-menu-toggle {
    padding: 0.3rem;
  }
}

@media (max-width: 720px) {
  .afm-nav {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .afm-auth {
    margin-left: auto;
  }
}
