/* ===================================================== */
/* MINI-PROFIL + NEXTUP – HISTORY GO (SIDE-BY-SIDE)       */
/* ===================================================== */

/* Mini-profil som klikkbart kort (bruk <a> eller div med onclick) */
.mini-profile{
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(25,25,30,.95), rgba(10,15,25,.95));
  border-left: 3px solid #f6c800;
  border-radius: 8px;
  padding: 4px 9px;
  box-shadow: 0 0 18px rgba(246,200,0,.05), inset 0 0 6px rgba(255,255,255,.04);
  transition: transform .25s ease, box-shadow .25s ease;
  flex: 1 1 0;
  min-width: 0;
}

.mini-profile:hover{
  transform: translateY(-2px);
  box-shadow: 0 0 22px rgba(246,200,0,.15), inset 0 0 10px rgba(255,255,255,.06);
}

/* Hvis du wrapper mini-profilen i <a href="profile.html"> */
.mini-profile--link{
  display:block;
  text-decoration:none;
  color: inherit;
  cursor:pointer;
}

.mini-profile .info{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

/* Topplinje */
.profile-top{
  display:flex;
  justify-content: space-between;
  align-items:center;
  margin-bottom: 0px;
}

.profile-top h3{
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: .2px;
  color: #fff;
}

/* Pila er overflødig når hele kortet er klikkbart */
.arrow-link{ display:none !important; }

.mini-profile .muted{
  color: var(--muted);
  font-size: .92rem;
  margin: 0;
  line-height: 1.4;
}

/* miniStats: vanlig tekstlinje */
#miniStats{
  display:inline;
  white-space: nowrap;
}

/* Link-ish */
.mini-profile .linkish{
  color: #f6c800;
  text-decoration: none;
  font-weight: 500;
}
.mini-profile .linkish:hover{
  text-decoration: underline;
}

/* ===================================================== */
/* NEXTUP – egen liten boks ved siden av mini-profil      */
/* ===================================================== */

#mpNextUp{
  position: relative;
  overflow: hidden;

  background: linear-gradient(180deg, rgba(25,25,30,.92), rgba(10,15,25,.92));
  border-left: 4px solid rgba(246,200,0,.55);
  border-radius: 12px;
  padding: 10px 12px;

  box-shadow: 0 0 18px rgba(246,200,0,.03), inset 0 0 6px rgba(255,255,255,.035);
  transition: transform .25s ease, box-shadow .25s ease;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  
  font-size: 12px;
  word-spacing: 2px;
  line-height: 1.1;
  opacity: .95;
}

#mpNextUp:hover{
  transform: translateY(-2px);
  box-shadow: 0 0 22px rgba(246,200,0,.10), inset 0 0 10px rgba(255,255,255,.05);
}

.mp-nextup-line,
#mpNextUp .mp-nextup-because{
  display: inline;
  width: auto;
  white-space: normal;
  overflow: visible;
}

#mpNextUp .mp-nextup-line::after{
  content: " · ";
  opacity: .65;
}
#mpNextUp .mp-nextup-line:last-child::after{
  content: "";
}

#mpNextUp .mp-nextup-link{
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-decoration: none;
  cursor: pointer;

  display: inline;
  width: auto;
}

#mpNextUp .mp-nextup-link[disabled]{
  cursor: default;
  opacity: .7;
  pointer-events: none;
}

#mpNextUp .mp-nextup-because{
  opacity: .95;
}

/* ===================================================== */
/* MINI-PROFIL – BADGES + SISTE QUIZ                      */
/* ===================================================== */

.profile-badges{
  display:flex;
  gap: 6px;
  margin: 8px 0;
}

.profile-badges img{
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 4px;
  filter: drop-shadow(0 0 4px rgba(0,0,0,.4));
}

.profile-last-quiz{
  background: rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 8px 10px;
  color: #fff;
  font-size: .9rem;
  display:flex;
  align-items:center;
  gap: 8px;
  margin-top: 6px;
  border-left: 3px solid #f6c800;
}

.profile-last-quiz img{
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
}

/* Pulse ved oppdatering */
.pulse-mini{
  animation: miniProfilePulse .45s ease;
}

@keyframes miniProfilePulse{
  0%   { transform: scale(1); opacity: .8; }
  40%  { transform: scale(1.10); opacity: 1; }
  100% { transform: scale(1); opacity: .8; }
}

/* =====================================================
   MINI-PROFIL I TOPPLINJE – STØRRE, TO LINJER
   Viser: navn / steder + quizzer
   ===================================================== */

body.hg-app header.site-header{
  justify-content: flex-end;
}

.site-header .top-actions{
  flex-wrap: nowrap;
  overflow: hidden;
}

body.hg-app .site-header .top-actions{
  justify-content: flex-end;
  margin-left: 0;
  margin-right: 0;
  flex: 0 1 auto;
  max-width: calc(100% - 24px);
}

body.hg-app .site-header .top-actions #miniProfile{
  margin-left: 0;

  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  grid-template-areas:
    "name"
    "stats";
  align-items: center;
  column-gap: 0;
  row-gap: 2px;

  width: 180px;
  max-width: 180px;
  height: 56px;
  flex: 0 0 180px;

  padding: 6px 9px 7px;
  border-radius: 16px;

  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);

  text-decoration: none;
  color: #fff;

  overflow: hidden;
}

body.hg-app .site-header .top-actions #miniProfile:hover{
  transform: none;
  box-shadow: none;
}

body.hg-app .site-header .top-actions #miniProfile #miniName{
  grid-area: name;
  display: block;

  margin: 0;
  min-width: 0;

  font-size: 14px;
  line-height: 1.05;
  font-weight: 850;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.hg-app .site-header .top-actions #miniProfile .mpt-badges{
  display: none !important;
}

body.hg-app .site-header .top-actions #miniProfile .mpt-badgeIcon{
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  background: url("../assets/icons/badge.png") center / contain no-repeat;
}

body.hg-app .site-header .top-actions #miniProfile #linkBadges{
  display: inline-flex;
  align-items: center;
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  line-height: 1;
}

body.hg-app .site-header .top-actions #miniProfile #linkBadges::before{
  content: none;
}


body.hg-app .site-header .top-actions #btnMinDag .hg-header-icon{
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

body.hg-app .site-header .top-actions #btnMinDag .hg-header-icon svg{
  width: 22px;
  height: 22px;
  display: block;
}

body.hg-app .site-header .top-actions #miniProfile .mp-extra{
  grid-area: stats;
  display: block;
  min-width: 0;
  overflow: hidden;
}

body.hg-app .site-header .top-actions #miniProfile #miniStats{
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;

  font-size: 11px;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
}

body.hg-app .site-header .top-actions #miniProfile #linkPlaces,
body.hg-app .site-header .top-actions #miniProfile #linkQuiz{
  display: inline-flex !important;
  color: #f6c800;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.hg-app .site-header .top-actions #miniProfile .mini-position-line{
  display: block;
  max-width: 100%;
  min-width: 0;
  font-size: 11px;
  line-height: 1.05;
  opacity: .92;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.hg-app .site-header .top-actions #miniProfile #miniBadges,
body.hg-app .site-header .top-actions #miniProfile #miniLastQuiz{
  display: none !important;
}

/* =====================================================
   HEADER – KOMPAKT/MOBIL
   Smale viewports (mobil OG smale nettbrett/vinduer, f.eks.
   iPad-portrett): top-actions får brekke til to høyrestilte
   rader, og ViewportManager hever --hg-visual-header-height
   (104px mobil / 112px smalt nettbrett). Breakpointet speiler
   COMPACT_HEADER_MAX_VW i js/core/viewportManager.js.
   Ingen kontroller skal klippes ut av skjermen.
   ===================================================== */

@media (max-width: 860px){
  body.hg-app .site-header .top-actions{
    gap: 6px 4px;
    max-width: calc(100% - 10px);

    flex-wrap: wrap;
    align-content: center;
    justify-content: flex-end;

    /* Klaring for logoen (absolutt posisjonert til venstre) slik at
       raden som brekker ikke legger seg under den. */
    padding-left: 52px;
  }

  /* Mindre logo så den ikke spiser en tredjedel av raden. */
  body.hg-app .hg-brand{
    width: 48px;
    height: 48px;
    top: 10px;
    left: 6px;
  }

  body.hg-app .site-header .top-actions #btnMinDag{
    width: 40px;
    padding: 0;
  }

  body.hg-app .site-header .top-actions #btnMinDag .hg-header-icon,
  body.hg-app .site-header .top-actions #btnMinDag .hg-header-icon svg{
    width: 20px;
    height: 20px;
  }

  /* Søkefeltet er radens fleksible ledd: lav flex-basis så raden
     ikke brekker pga. søket, vokser når det er plass. */
  body.hg-app #globalSearch{
    flex: 1 1 24px;
    min-width: 0;
    max-width: 160px;
  }
}

body.hg-app.hg-phone .site-header .top-actions #miniProfile{
  width: 142px;
  max-width: 142px;
  flex: 0 0 142px;
  height: 50px;
  padding: 5px 7px 6px;
}

body.hg-app.hg-phone .site-header .top-actions #miniProfile #miniName{
  font-size: 12px;
}

body.hg-app.hg-phone .site-header .top-actions #miniProfile #miniStats{
  gap: 5px;
  font-size: 10px;
}

body.hg-app.hg-phone .site-header .top-actions #miniProfile .mini-position-line{
  font-size: 10px;
  margin-top: 1px;
}

/* Mobil: søket holdes ekstra smalt (maks 64px). */
body.hg-app.hg-phone #globalSearch{
  flex: 1 1 24px;
  min-width: 0;
  max-width: 64px;
  height: 30px;
  padding: 0 8px;
}

/* Språkvelgeren trenger bare flagget + pil på mobil. */
body.hg-app.hg-phone .site-header .top-actions .top-lang-select{
  width: 56px;
  flex: 0 0 56px;
}

/* Ekstra smale telefoner: miniprofilen må ned i bredde for at
   øverste rad (språk + profil + Civication) skal holde én rad. */
@media (max-width: 350px){
  body.hg-app.hg-phone .site-header .top-actions #miniProfile{
    width: 118px;
    max-width: 118px;
    flex: 0 0 118px;
  }
}

body.hg-app.hg-phone .site-header .top-actions .iconbtn{
  width: 30px;
  height: 30px;
  font-size: 14px;
}

body.hg-app.hg-phone #geoStatus{
  width: 18px;
}

body.hg-app.hg-phone .site-header .top-actions .toggle{
  transform: scale(0.86);
  transform-origin: center;
}

/* MiniProfile – Civication-rolle (forside) */
.miniProfileTop{
  min-width: 0;
}

.miniProfileTop .mpt-name,
.miniProfileTop .mpt-role{
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Header cleanup: keep the app header as one compact, non-wrapping topbar. */
body.hg-app header.site-header{
  height: var(--hg-visual-header-height, 56px);
  min-height: 0;
  padding-top: 4px;
  padding-bottom: 4px;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: visible;
}

body.hg-app .hg-brand{
  width: 54px;
  height: 54px;
  top: 1px;
  left: calc(6px + env(safe-area-inset-left));
}

body.hg-app .site-header .top-actions,
body.hg-app.hg-phone .site-header .top-actions{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding-left: 58px;
  gap: 5px;
  flex-wrap: nowrap;
  align-content: center;
  overflow: visible;
  white-space: nowrap;
}

body.hg-app .site-header .top-actions .top-lang-select,
body.hg-app.hg-phone .site-header .top-actions .top-lang-select{
  width: 46px !important;
  max-width: 46px !important;
  height: 32px;
  flex: 0 0 46px;
  padding: 2px 4px !important;
  font-size: 1rem !important;
  line-height: 1;
}

body.hg-app .site-header .top-actions #miniProfile,
body.hg-app.hg-phone .site-header .top-actions #miniProfile{
  width: clamp(92px, 24vw, 150px);
  max-width: clamp(92px, 24vw, 150px);
  flex: 1 1 150px;
  min-width: 72px;
  height: 40px;
  max-height: 40px;
  padding: 4px 7px;
  border-radius: 12px;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  row-gap: 0;
}

body.hg-app .site-header .top-actions #miniProfile #miniName,
body.hg-app.hg-phone .site-header .top-actions #miniProfile #miniName{
  font-size: 12px;
  line-height: 1.05;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.hg-app .site-header .top-actions #miniProfile .mp-extra,
body.hg-app .site-header .top-actions #miniProfile #miniStats,
body.hg-app .site-header .top-actions #miniProfile .mini-position-line{
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

body.hg-app .site-header .top-actions #miniProfile #miniStats,
body.hg-app.hg-phone .site-header .top-actions #miniProfile #miniStats{
  font-size: 10px;
  line-height: 1;
  gap: 4px;
}

body.hg-app .site-header .top-actions #miniProfile .mini-position-line,
body.hg-app.hg-phone .site-header .top-actions #miniProfile .mini-position-line{
  font-size: 10px;
  line-height: 1;
  margin-top: 0;
}

body.hg-app .site-header .top-actions .iconbtn,
body.hg-app.hg-phone .site-header .top-actions .iconbtn,
body.hg-app .header-menu-button{
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

body.hg-app #geoStatus,
body.hg-app.hg-phone #geoStatus{
  width: 22px;
  min-width: 18px;
  flex: 0 0 22px;
  font-size: 15px;
}

body.hg-app .header-menu-panel{
  top: calc(100% + 8px);
  max-height: calc(100vh - var(--hg-visual-header-height, 56px) - 16px);
}

/* The menu owns a full-size switch even when the compact phone header scales
   its inline controls down. */
body.hg-app.hg-phone .site-header .top-actions .header-menu-toggle .toggle{
  transform: none;
}

@media (max-width: 380px){
  body.hg-app .site-header .top-actions,
  body.hg-app.hg-phone .site-header .top-actions{
    gap: 3px;
    padding-left: 48px;
  }

  body.hg-app .hg-brand{
    width: 46px;
    height: 46px;
    top: 5px;
  }

  body.hg-app .site-header .top-actions #miniProfile,
  body.hg-app.hg-phone .site-header .top-actions #miniProfile{
    width: 82px;
    max-width: 82px;
    flex-basis: 82px;
    padding-left: 5px;
    padding-right: 5px;
  }

  body.hg-app .site-header .top-actions .top-lang-select,
  body.hg-app.hg-phone .site-header .top-actions .top-lang-select{
    width: 40px !important;
    max-width: 40px !important;
    flex-basis: 40px;
  }
}
