/* ─── ZER ERP Shared Topbar Styles (with dropdowns) ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  animation: fadeDown 0.8s ease-out both;
  position: relative;
  z-index: 1000;
}
.logo-group { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.logo-group a { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-group img { height: 40px; width: auto; object-fit: contain; transition: filter 0.4s; filter: invert(1); }
[data-theme="light"] .logo-group img { filter: none; }
.logo-text { font-family: 'DM Sans', sans-serif; font-size: 18px; font-weight: 700; letter-spacing: 2px; color: var(--text); transition: color 0.4s; }
.topbar-right { display: flex; gap: 24px; align-items: center; flex-shrink: 0; }
.topbar-links { display: flex; gap: 24px; align-items: center; flex-wrap: nowrap; white-space: nowrap; }

/* Shared link style */
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: color 0.3s;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'DM Sans', sans-serif;
  padding: 0;
  line-height: inherit;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--accent); }

/* Dropdown container */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-btn {
  display: inline-flex;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: -16px;
}
.nav-dropdown-btn svg { transition: transform 0.25s; }

/* Invisible hover bridge so mouse can travel from button to menu */
.nav-dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: -20px;
  right: -20px;
  height: 20px;
  display: none;
}
.nav-dropdown:hover::after,
.nav-dropdown.open::after {
  display: block;
}

/* Dropdown menu */
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 9999;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}
[data-theme="light"] .nav-dropdown-menu {
  box-shadow: 0 16px 48px rgba(0,0,0,0.1);
}

/* Show on hover OR when .open class is set (click toggle) */
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.nav-dropdown:hover .nav-dropdown-btn svg,
.nav-dropdown.open .nav-dropdown-btn svg {
  transform: rotate(180deg);
}

/* Dropdown items */
.nav-dropdown-item {
  display: block;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  position: relative;
  white-space: nowrap;
}
.nav-dropdown-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}
[data-theme="light"] .nav-dropdown-item:hover {
  background: rgba(0,0,0,0.03);
}
.nav-dropdown-item.active {
  color: var(--accent);
}

/* Badge */
.badge-new { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: badge-pulse 2s ease-in-out infinite; }
@keyframes badge-pulse { 0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(232,121,58,0.5); } 50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(232,121,58,0); } }

/* Theme toggle */
.theme-toggle { width: 36px; height: 20px; border-radius: 10px; background: var(--border-light); border: 1px solid var(--border); cursor: pointer; position: relative; transition: background 0.3s; flex-shrink: 0; }
.theme-toggle .knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); transition: transform 0.3s; }
[data-theme="light"] .theme-toggle .knob { transform: translateX(16px); }

/* Lang toggle */
.lang-toggle { font-size: 12px; font-weight: 600; letter-spacing: 0.5px; color: var(--text-muted); cursor: pointer; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); background: transparent; font-family: 'DM Sans', sans-serif; transition: all 0.3s; flex-shrink: 0; }
.lang-toggle:hover { color: var(--accent); border-color: rgba(232,121,58,0.3); }

/* Sign In button */
.sign-in-btn {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #fff;
  padding: 6px 16px;
  border-radius: 8px;
  background: var(--accent);
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.3s, transform 0.2s;
  flex-shrink: 0;
}
.sign-in-btn:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}
.sign-in-btn.signed-in {
  background: var(--green-dim, rgba(74,222,128,0.12));
  color: var(--green, #4ade80);
  border: 1px solid rgba(74,222,128,0.2);
}
.sign-in-btn.signed-in:hover {
  background: rgba(74,222,128,0.2);
}

/* Auth dropdown (signed-in user menu) */
.auth-dropdown {
  position: relative;
}
.auth-dropdown-btn {
  cursor: pointer;
  border: none;
  font-family: 'DM Sans', sans-serif;
}
.auth-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 6px 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 9999;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}
[data-theme="light"] .auth-dropdown-menu {
  box-shadow: 0 16px 48px rgba(0,0,0,0.1);
}
.auth-dropdown.open .auth-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.auth-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.auth-dropdown-item:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}
[data-theme="light"] .auth-dropdown-item:hover {
  background: rgba(0,0,0,0.03);
}
.auth-dropdown-item.auth-signout:hover {
  color: #f87171;
}

/* Responsive */
@media (max-width: 768px) {
  .topbar-links { display: none; }
  .lang-toggle, .theme-toggle { display: none; }
  .sign-in-btn svg { margin-right: 0 !important; }
  .sign-in-btn span { display: none; }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}