/* === ModulHub Topbar – plattform-topbar (LAAST) === */
/* Hvit topbar med logo, soek, varsler, brukerikon.                         */
/* Del av HubCore. Roeres ikke uten eksplisitt OK fra Vidar.                */
/* Kontrakt: lastes automatisk i alle moduler via base-pakken.              */

.platform-topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-height);
  background: #FFFFFF;
  border-bottom: 1.5px solid #E0E0E0;
  box-shadow: none;
  z-index: 1000;
}

.platform-topbar-inner {
  width: min(var(--shell-max-width), calc(100% - 24px));
  height: 100%;
  margin: 0 auto;
  display: grid;
  /* shared-css-ren-v1 Fase 5: 4 kolonner igjen etter at DRIFT/SANDBOX-badge
     er flyttet til inner topbar (module-toolbar). Ytre topbar er na identisk
     for alle bruker-typer. */
  grid-template-columns: 52px auto minmax(320px, 560px) auto;
  gap: 10px;
  align-items: center;
}

.platform-menu-btn,
.topbar-icon,
.topbar-quick-btn {
  height: 34px;
  min-width: 34px;
  border: 1.5px solid #E0E0E0;
  border-radius: 7px;
  background: #F0F2F5;
  color: #1A1A1A;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.topbar-quick-btn {
  padding: 0 12px;
}

.platform-brand-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1;
}

.platform-brand {
  font-size: 28px;
  font-weight: 700;
  color: #1A1A1A;
  line-height: 1;
}

.platform-brand-accent {
  color: var(--primary);
}

.platform-brand-tagline {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

.platform-search {
  display: flex;
  align-items: center;
  height: 38px;
  border: 1.5px solid #E0E0E0;
  border-radius: 7px;
  background: #F0F2F5;
  color: #1A1A1A;
  padding: 0 10px;
}

.platform-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #243140;
  font-size: 14px;
}

.platform-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 420px;
}

/* Brukermeny */

.topbar-user-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.topbar-user-toggle {
  height: 38px;
  padding: 0 12px;
  border: 1.5px solid #E0E0E0;
  border-radius: 7px;
  background: #F0F2F5;
  color: #1A1A1A;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.topbar-user-toggle:hover {
  background: #eef2f6;
}

.topbar-user-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 15px;
  line-height: 1;
}

.topbar-user-name {
  white-space: nowrap;
}

.topbar-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  border: 1px solid #d6dde6;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  z-index: 1100;
  overflow: hidden;
}

.topbar-user-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #243140;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.topbar-user-menu-item:hover {
  background: #f3f6fa;
}

.topbar-user-menu-item.danger {
  color: #b42318;
}

.topbar-user-menu-item + .topbar-user-menu-item {
  margin-top: 2px;
}

.topbar-user-caret {
  font-size: 12px;
  line-height: 1;
  opacity: 0.8;
}

.topbar-user-toggle[aria-expanded="true"] {
  background: #F0F0F0;
  border-color: #CCCCCC;
}

/* Responsivt */

@media (max-width: 1240px) {
  .platform-topbar-inner {
    grid-template-columns: 52px auto 240px auto;
  }
}

@media (max-width: 720px) {
  .platform-topbar-inner {
    grid-template-columns: auto 1fr auto;
    gap: 6px;
  }

  /* Hamburger-knapp vises paa mobil — aapner drawer med nav + soek.
     Drawer-HTML og CSS er i topbar.js + components.css. */
  .platform-menu-btn {
    display: inline-flex;
  }

  /* Soek flyttes til drawer paa mobil (soek-input finnes i drawer). */
  .platform-search {
    display: none;
  }

  .platform-topbar-actions {
    min-width: auto;
    gap: 4px;
  }

  .topbar-quick-btn {
    display: none;
  }

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

  /* Skjul ogsaa client-name-subtittelen ("Plattform" osv.) paa mobil.
     Hele .topbar-user-labels skjules siden ingen av delene trengs naar
     toggle-knappen bare viser profil-ikonet. */
  .topbar-user-labels {
    display: none !important;
  }

  .topbar-user-caret {
    display: none;
  }

  /* Topbar-dropdowns (radar, varsler, pins, hjelp, favoritter, brukermeny)
     har inline width:360px + right:0 relativt til knappen — paa mobil faller
     de ut av skjermen. Gjoer dem til position:fixed med 12px margin paa
     begge sider slik at de alltid passer. */
  #topbar-radar-dropdown,
  #topbar-notify-dropdown,
  #topbar-pin-dropdown,
  #topbar-help-dropdown,
  #topbar-favorites-dropdown,
  .topbar-user-menu {
    position: fixed !important;
    top: calc(var(--topbar-height, 60px) + 4px) !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-width: none !important;
  }

  .platform-brand {
    font-size: 20px;
  }

  .platform-brand-tagline {
    display: none;
  }
}
