@import url("./aha-tokens.css");

/* aha-global-nav.css
   Felles AHA-produktnavigasjon. Hovednivået er bevisst lite; tekniske verktøy
   ligger under Mer. Stilarket er selvstendig slik at nav ser lik ut overalt.
*/

:root {
  --aha-global-header-height: 54px;
  --aha-global-footer-height: 50px;
}

.aha-global-nav {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 970;
  width: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--gnav-text);
}

.aha-global-nav-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 6px 14px;
  background: var(--gnav-bg);
  border-bottom: 1px solid var(--gnav-line);
  backdrop-filter: blur(12px);
}

.aha-global-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: .02em;
  flex: 0 0 auto;
}

.aha-global-nav-brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--aha-color-accent), var(--aha-color-coral));
  color: #14110a;
  font-size: .82rem;
  font-weight: 950;
}

.aha-global-nav-primary {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.aha-global-nav-primary-link,
.aha-global-nav-toggle {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--gnav-muted);
  font-size: .84rem;
  font-weight: 720;
  text-decoration: none;
  white-space: nowrap;
}

.aha-global-nav-primary-link { padding: 8px 12px; }

.aha-global-nav-primary-link:hover,
.aha-global-nav-primary-link.is-active {
  color: var(--gnav-text);
  background: rgba(255, 255, 255, .065);
}

.aha-global-nav-primary-link.is-active {
  color: var(--aha-color-text);
  box-shadow: inset 0 0 0 1px rgba(116, 173, 255, .34);
  background: var(--aha-color-blue-soft);
}

.aha-global-nav-toggle {
  gap: 7px;
  flex: 0 0 auto;
  border: 1px solid var(--gnav-line);
  background: rgba(255, 255, 255, .04);
  padding: 7px 12px;
  cursor: pointer;
}

.aha-global-nav-toggle:hover,
.aha-global-nav-toggle[aria-expanded="true"] {
  color: var(--gnav-text);
  background: rgba(255, 255, 255, .09);
}

.aha-global-nav-toggle-icon { font-size: .86rem; line-height: 1; }

.aha-global-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  min-height: 100dvh;
}

.aha-global-nav-overlay[hidden] { display: none; }

.aha-global-nav-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 10, .72);
  backdrop-filter: blur(2px);
}

.aha-global-nav-panel {
  position: relative;
  width: min(620px, 100%);
  height: 100dvh;
  max-height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--gnav-surface);
  border-left: 1px solid var(--gnav-line);
  box-shadow: -24px 0 60px rgba(0, 0, 0, .44);
  padding: 22px 20px max(34px, env(safe-area-inset-bottom));
}

.aha-global-nav-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--gnav-line);
  margin-bottom: 20px;
}

.aha-global-nav-panel-header h2 { margin: 2px 0 5px; font-size: 1.35rem; }
.aha-global-nav-panel-header p { margin: 0; color: var(--gnav-muted); line-height: 1.45; }
.aha-global-nav-kicker { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 850; }

.aha-global-nav-close {
  border: 1px solid var(--gnav-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  color: var(--gnav-text);
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.aha-global-nav-close:hover { background: rgba(255, 255, 255, .1); }

.aha-global-nav-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.aha-global-nav-group {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--gnav-line);
  border-radius: 16px;
  background: var(--gnav-card);
}

.aha-global-nav-group-head { margin-bottom: 9px; }
.aha-global-nav-group h3 { margin: 0 0 4px; font-size: .94rem; }
.aha-global-nav-group-head p { margin: 0; color: var(--gnav-muted); font-size: .76rem; line-height: 1.35; }

.aha-global-nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.aha-global-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 8px;
  border-radius: 11px;
  color: inherit;
  text-decoration: none;
  border: 1px solid transparent;
}

.aha-global-nav-item:hover { background: rgba(255, 255, 255, .065); }
.aha-global-nav-item.is-active { background: var(--aha-color-blue-soft); border-color: rgba(116, 173, 255, .34); }

.aha-global-nav-item-icon {
  flex: 0 0 auto;
  width: 24px;
  text-align: center;
  font-size: .95rem;
  opacity: .85;
}

.aha-global-nav-item-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1 1 auto;
}

.aha-global-nav-item-copy strong { font-size: .86rem; }
.aha-global-nav-item-copy small {
  color: var(--gnav-muted);
  font-size: .72rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aha-global-nav-item-tag {
  flex: 0 0 auto;
  font-size: .61rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gnav-muted);
  border: 1px solid var(--gnav-line);
  border-radius: 999px;
  padding: 2px 6px;
}

.aha-global-nav-advanced {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--gnav-line);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(170, 145, 247, .07), rgba(88, 217, 199, .035));
}

.aha-global-nav-advanced summary { cursor: pointer; font-size: .84rem; font-weight: 760; }
.aha-global-nav-advanced > p { color: var(--gnav-muted); font-size: .75rem; line-height: 1.4; }
.aha-global-nav-advanced .aha-global-nav-group-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.aha-global-nav-tools-link { display: inline-flex; margin-top: 10px; color: var(--gnav-text); font-size: .78rem; font-weight: 750; }

body.aha-global-nav-open { overflow: hidden; }
.aha-redundant-home-link,
.aha-technical-eyebrow { display: none !important; }

/* Samme visuelle hierarki på tvers av AHA-sidene. Dette endrer kun
   presentasjon: hvert modul-shell får én tydelig tittel, én lesbar forklaring
   og sekundære handlinger som ikke konkurrerer med hovednavigasjonen. */
body.aha-product-shell main.aha-dashboard {
  padding-top: 22px;
}

body.aha-product-shell .aha-module-shell {
  margin-bottom: 18px;
}

body.aha-product-shell .aha-module-shell-header {
  align-items: flex-start;
}

body.aha-product-shell .aha-module-shell-header h1 {
  max-width: 24ch;
  margin-top: 0;
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: -.025em;
}

body.aha-product-shell .aha-module-shell .aha-module-purpose {
  max-width: 74ch;
  margin-top: 0;
  margin-bottom: 8px;
  color: var(--gnav-muted);
  line-height: 1.55;
}

body.aha-product-shell .aha-module-shell .aha-module-actions {
  margin-top: 14px;
  gap: 8px;
}

body.aha-product-shell .aha-module-shell .aha-module-actions a,
body.aha-product-shell .aha-module-shell .aha-module-actions button {
  min-height: 38px;
}

body.aha-product-shell main.aha-dashboard > .aha-panel + .aha-panel,
body.aha-product-shell main.aha-dashboard > .aha-panel + details.aha-panel,
body.aha-product-shell main.aha-dashboard > details.aha-panel + .aha-panel {
  margin-top: 14px;
}

/* Én global, smal footer for profil og dagens løype. */
body.aha-product-shell {
  padding-top: calc(var(--aha-global-header-height) + env(safe-area-inset-top));
  padding-bottom: calc(var(--aha-global-footer-height) + env(safe-area-inset-bottom));
}

/* Home måler sin egen faste header og reserverer plassen på .aha-main. */
body.aha-route-index { padding-top: 0; }
body.aha-route-index .aha-fixed-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 970;
  width: 100%;
  min-height: var(--aha-global-header-height);
  max-height: none;
  padding: 0;
  overflow: visible;
}
body.aha-route-index .aha-fixed-header .aha-global-nav { position: static; }

body.aha-global-daily-open { overflow: hidden; }

.aha-global-footer {
  position: fixed;
  z-index: 960;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 0;
  background: rgba(5, 6, 9, .96);
  color: var(--gnav-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  pointer-events: none;
}

.aha-global-footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: 100%;
  box-sizing: border-box;
  min-height: var(--aha-global-footer-height);
  margin: 0;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .15);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  background: rgba(7, 8, 13, .96);
  box-shadow: 0 -10px 34px rgba(0, 0, 0, .34);
  backdrop-filter: blur(18px);
  pointer-events: auto;
}

.aha-global-footer-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 0;
  min-height: var(--aha-global-footer-height);
  padding: 6px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--gnav-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.aha-global-footer-action + .aha-global-footer-action { border-left: 1px solid var(--gnav-line); }
.aha-global-footer-action:hover,
.aha-global-footer-action[aria-expanded="true"] { background: var(--gnav-accent-soft); }

.aha-global-footer-profile-mark,
.aha-global-footer-daily-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--gnav-accent);
  color: #14110a;
  font-size: .78rem;
  font-weight: 900;
}

.aha-global-footer-daily-mark { background: var(--aha-color-cyan-soft); color: var(--aha-color-cyan); }
.aha-global-footer-copy { display: grid; min-width: 0; line-height: 1.05; }
.aha-global-footer-copy > span { overflow: hidden; font-size: .82rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.aha-global-footer-copy small { margin-top: 3px; color: var(--gnav-muted); font-size: .66rem; }

.aha-global-daily-sheet {
  position: fixed;
  z-index: 950;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 100dvh;
  padding: 12px 12px calc(var(--aha-global-footer-height) + env(safe-area-inset-bottom));
  color: var(--gnav-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.aha-global-daily-sheet[hidden] { display: none !important; }
.aha-global-daily-backdrop { position: absolute; inset: 0; border: 0; background: rgba(0, 0, 0, .62); cursor: default; }

.aha-global-daily-panel {
  position: relative;
  width: min(100%, 680px);
  max-height: min(74dvh, 720px);
  overflow: auto;
  border: 1px solid rgba(246, 200, 0, .3);
  border-radius: 22px 22px 16px 16px;
  background: var(--aha-color-surface, #11131b);
  box-shadow: 0 -22px 60px rgba(0, 0, 0, .58);
  overscroll-behavior: contain;
  animation: aha-global-daily-rise .2s ease-out;
}

@keyframes aha-global-daily-rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.aha-global-daily-header {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 18px 14px;
  border-bottom: 1px solid var(--gnav-line);
  background: rgba(9, 10, 15, .97);
  backdrop-filter: blur(12px);
}

.aha-global-daily-header p,
.aha-global-daily-header h2 { margin: 0; }
.aha-global-daily-header p { color: var(--gnav-accent); font-size: .68rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.aha-global-daily-header h2 { margin-top: 3px; font-size: 1.18rem; }
.aha-global-daily-close { flex: 0 0 auto; width: 40px; height: 40px; border: 1px solid var(--gnav-line); border-radius: 999px; background: rgba(255,255,255,.04); color: var(--gnav-text); font-size: 1.5rem; cursor: pointer; }
.aha-global-daily-content { display: grid; gap: 12px; padding: 16px 18px 20px; }
.aha-global-daily-summary p,
.aha-global-daily-summary h3,
.aha-global-daily-next p { margin: 0; }
.aha-global-daily-summary .aha-global-daily-day { color: var(--gnav-muted); font-size: .76rem; text-transform: capitalize; }
.aha-global-daily-summary h3 { margin-top: 5px; font-size: 1.08rem; line-height: 1.3; }
.aha-global-daily-summary h3 + p { margin-top: 5px; color: var(--gnav-muted); font-size: .82rem; }

.aha-global-daily-next {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  padding: 14px;
  border: 1px solid rgba(246, 200, 0, .25);
  border-radius: 14px;
  background: var(--gnav-accent-soft);
}
.aha-global-daily-next > span { grid-column: 1 / -1; color: var(--gnav-accent); font-size: .68rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.aha-global-daily-next strong { font-size: .95rem; }
.aha-global-daily-next p { grid-column: 1; color: var(--gnav-muted); font-size: .78rem; line-height: 1.45; }
.aha-global-daily-primary { grid-column: 2; grid-row: 2 / span 2; align-self: center; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 14px; border-radius: 999px; background: var(--gnav-accent); color: #17130a; font-size: .78rem; font-weight: 850; text-decoration: none; }
.aha-global-daily-queue { display: grid; gap: 6px; }
.aha-global-daily-queue-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 8px 12px; border: 1px solid var(--gnav-line); border-radius: 12px; color: var(--gnav-text); font-size: .8rem; font-weight: 720; text-decoration: none; }
.aha-global-daily-prompts { display: flex; flex-wrap: wrap; gap: 7px; }
.aha-global-daily-prompt { display: inline-flex; align-items: center; min-height: 36px; padding: 7px 11px; border: 1px solid rgba(246, 200, 0, .24); border-radius: 999px; color: var(--gnav-text); background: rgba(255,255,255,.035); font-size: .75rem; text-decoration: none; }
.aha-global-daily-empty { display: grid; gap: 8px; color: var(--gnav-muted); }
.aha-global-daily-empty p { margin: 0; }
.aha-global-daily-empty .aha-global-daily-primary { grid-column: auto; grid-row: auto; justify-self: start; }

/* De lokale bunnmenyene og de gamle konto-/løypeflatene erstattes av footeren. */
body.aha-product-shell .aha-mobile-nav,
body.aha-route-index .aha-home-header-simplified .aha-header-profile,
body.aha-route-index .aha-home-header-simplified .aha-header-actions,
body.aha-route-chat .aha-chat-header-simplified .chat-profile-card { display: none !important; }

/* Home: én merkevare, én produktnav og færre konkurrerende oversikter. */
body.aha-route-index .aha-home-header-simplified .aha-app-header { width: 100%; min-height: 0; max-height: none; grid-template-columns: 1fr; gap: 0; padding: 0; }
body.aha-route-index .aha-home-header-simplified .aha-brand { display: none; }
body.aha-route-index .aha-home-header-simplified #aha-global-nav { grid-column: 1 / -1; grid-row: 1; flex: 1 1 auto; width: 100%; margin: 0; }
body.aha-route-index .aha-home-header-simplified .aha-profile-avatar { width: 38px; height: 38px; font-size: .95rem; }
body.aha-route-index .aha-home-header-simplified .aha-profile-copy p,
body.aha-route-index .aha-home-header-simplified .aha-profile-id-row,
body.aha-route-index .aha-home-header-simplified #btn-import-hg-primary { display: none; }
body.aha-route-index .aha-home-panel > .eyebrow,
body.aha-route-index .aha-home-panel > #aha-home-title,
body.aha-route-index .aha-home-panel > .aha-home-subtitle { display: none; }
body.aha-route-index .aha-modules-panel[hidden] { display: none !important; }

/* Chat har allerede global produktnav; den lokale headeren skal bare forklare Chat. */
body.aha-route-chat .aha-chat-header-simplified .back-link,
body.aha-route-chat .aha-chat-header-simplified .chat-brand,
body.aha-route-chat .aha-chat-header-simplified .profile-indicator { display: none !important; }
body.aha-route-chat .aha-chat-header-simplified { grid-template-columns: minmax(0, 1fr) auto; }

/* Release-candidate touch gate: keep primary navigation and page actions comfortably tappable
   on iPad/iPhone/coarse-pointer devices without changing desktop density. */
@media (pointer: coarse) {
  .aha-global-nav-primary-link,
  .aha-global-nav-toggle,
  .aha-global-nav-close,
  .aha-global-footer-action,
  .aha-global-daily-close,
  .aha-global-daily-queue-item,
  .aha-global-daily-prompt,
  body.aha-product-shell .aha-module-shell .aha-module-actions a,
  body.aha-product-shell .aha-module-shell .aha-module-actions button {
    min-height: 44px;
  }
  .aha-global-nav-close {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 760px) {
  .aha-global-nav-bar { gap: 5px; padding-inline: 8px; }
  .aha-global-nav-brand-label { display: none; }
  .aha-global-nav-primary { gap: 0; }
  .aha-global-nav-primary-link { padding-inline: 9px; font-size: .78rem; }
  .aha-global-nav-groups { grid-template-columns: 1fr; }
  .aha-global-nav-panel { width: 100%; padding-inline: 14px; }
  .aha-global-nav-advanced .aha-global-nav-group-items { grid-template-columns: 1fr; }
  body.aha-route-index .aha-home-header-simplified .aha-header-actions .aha-cta-primary { display: none; }
  body.aha-product-shell .aha-module-shell-header h1 { max-width: none; }
}

@media (max-width: 520px) {
  .aha-global-nav-primary-link[data-primary="home"],
  .aha-global-nav-primary-link[data-primary="personal-ai"] { display: none; }
  .aha-global-nav-primary-link { padding-inline: 8px; }
  .aha-global-nav-toggle { padding-inline: 10px; }
  body.aha-route-index .aha-home-header-simplified .aha-app-header { grid-template-columns: 1fr auto; }
  body.aha-route-index .aha-home-header-simplified .aha-profile-copy p,
  body.aha-route-index .aha-home-header-simplified .aha-profile-id-row { display: none !important; }
  body.aha-product-shell main.aha-dashboard { padding-top: 16px; }
  body.aha-product-shell .aha-module-shell-header h1 { font-size: clamp(1.55rem, 8vw, 2rem); }
  .aha-global-daily-sheet { padding-inline: 6px; }
  .aha-global-daily-panel { border-radius: 18px 18px 12px 12px; }
  .aha-global-daily-content { padding-inline: 13px; }
  .aha-global-daily-next { grid-template-columns: 1fr; }
  .aha-global-daily-next p,
  .aha-global-daily-primary { grid-column: 1; grid-row: auto; }
  .aha-global-daily-primary { justify-self: start; }
}

/* Preserve Chat, Venner, Bibliotek and Mitt AHA as primary links even on
   320px phones. Personal AI and Start remain reachable via Mer/brand. */
@media (max-width: 400px) {
  .aha-global-nav-bar { gap: 2px; padding-inline: 4px; }
  .aha-global-nav-brand-mark { width: 26px; height: 26px; }
  .aha-global-nav-primary { gap: 0; }
  .aha-global-nav-primary-link { min-width: 44px; padding-inline: 3px; font-size: .71rem; }
  .aha-global-nav-toggle { gap: 3px; padding-inline: 6px; font-size: .73rem; }
}

@media (prefers-reduced-motion: reduce) {
  .aha-global-daily-panel { animation: none; }
}


.aha-global-nav-item-icon {
  display: grid;
  place-items: center;
}

.aha-global-nav-item-icon .aha-module-icon-svg {
  width: 18px;
  height: 18px;
  display: block;
}
