/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}


/* Tema variabler */
:root {
  --bg-color: #e9f3fc;
  --theme-label-color: #ffffff;
  --header-bg-color: #ffffff;
  --hamburger-color: #26547C;
  --header-text-color: #26547C;
  --header-profile-picture-border-color: #26547C;
  --header-border-bottom-color: #26547C;
  --text-color: #000;
  --sidebar-bg: #26547C;
  --sidebar-link-color: white;
  --footer-bg-color: #ffffff;
  --footer-border-top-color: #26547C;
  --slider-bg-color1: #badffe;
  --slider-bg-color2: #badffe;
  --slider-dot-color: #26547C;
  --font-size-icon-color: #badffe;
  --reset-font-size-icon-color: #badffe;
  --spinner-border-top-color-before: #00bfff;
  --spinner-box-shadow-color-before: #00bfff;
  --spinner-border-top-color-after: #00ffff;
  --spinner-box-shadow-color-after: #00ffff;
  --footer-text-color: black;
}

body.dark {
  --bg-color: #111;
  --theme-label-color: white;
  --header-bg-color: green;
  --hamburger-color: white;
  --header-text-color: white;
  --header-profile-picture-border-color: gold;
  --header-border-bottom-color: white;
  --text-color: #eee;
  --sidebar-bg: #222;
  --sidebar-link-color: yellow;
  --footer-bg-color: green;
  --footer-border-top-color: #26547C;
  --slider-bg-color1: #26547C;
  --slider-bg-color2: #26547C;
  --slider-dot-color: #badffe;
  --font-size-icon-color: #26547C;
  --reset-font-size-icon-color: #26547C;
  --spinner-border-top-color-before: #ffbfff;
  --spinner-box-shadow-color-before: #ffbfff;
  --spinner-border-top-color-after: #ff00ff;
  --spinner-box-shadow-color-after: #ff00ff;
  --footer-text-color: white;
}

/* Grunnleggende */
html, body {
  height: 100%;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: system-ui, sans-serif;
  margin: 0;
  padding: 0;
  overflow: hidden; /* Unngå dobbel scroll */
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  font-size: 1rem; /* 1rem = html font-size */
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(60px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background-color: var(--header-bg-color);
  color: var(--header-text-color);
  display: flex;
  align-items: center;
  padding-left: 1rem;
  padding-right: 1rem;
  z-index: 1000;
  box-sizing: border-box;
  border-bottom: solid 1px var(--header-border-bottom-color);
}


/* Footer */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
/*  height: 50px;*/ /* Standard høyde */
  background-color: var(--footer-bg-color);
  color: var(--footer-text-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  border-top: solid 1px var(--footer-border-top-color);
  padding-bottom: env(safe-area-inset-bottom, 0px); /* for iPhone X++ */
  box-sizing: content-box;
}


.ios footer {
    height: 40px;
}

.android footer {
    height: 60px;
}

.other footer {
    height: 50px;
}




.footer-columns {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* 5 like kolonner */
  width: 100vw; /* Fyll hele synlige skjermen */
  height: 100%;
  padding: 0 20px;
}

.footer-column {
  display: flex; /* Gjør kolonnen til en flex container */
  flex-direction: column; /* Stable innhold vertikalt */
  justify-content: center; /* Vertikal sentrering */
  align-items: center; /* Horisontal sentrering */
  padding: 10px;
  text-align: center;
  box-sizing: border-box;
}

.footer-column:last-child {
  border-right: none;
}


/* Main */
main {
  flex: 1 1 auto;
  margin-top: calc(60px + env(safe-area-inset-top, 0px));
  margin-bottom: 60px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background-color: var(--bg-color);
  color: var(--text-color);
/*  padding: 1rem; */
  transition: transform 0.2s ease;
  will-change: transform;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  overscroll-behavior: contain; /* hindrer Safari-feil ved scroll */
}


/* Menyknapp (hamburger) */
#menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 2em;
  color: var(--hamburger-color);
  cursor: pointer;
}

/* Sidebar meny mobil */
@media (max-width: 767px) {
	
	/* Tema toggle container - plassert nederst i sidebar */
	#theme-toggle-container {
	  margin-bottom: 30px; 	
	}
	
  #menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
  }
  
  #sidebar {
    position: fixed;
    top: calc(60px + env(safe-area-inset-top, 0px));
    left: 0;
    width: 250px;
    height: calc(100vh - 60px - env(safe-area-inset-top, 0px));
    background-color: var(--sidebar-bg);
    color: var(--text-color);
    padding: 10px;
    box-sizing: border-box;
    overflow-y: auto;
    display: none;
    z-index: 1100;
    flex-direction: column;
    justify-content: space-between;
  }
  
  body.menu-open #sidebar {
    display: flex;
  }
}

/* PC og større skjermer */
@media (min-width: 768px) {
  body {
    display: grid;
    grid-template-columns: 250px 1fr;  
    grid-template-rows: calc(60px + env(safe-area-inset-top, 0px)) 1fr;
    grid-template-areas:
      "header header"
      "sidebar main"; 
    height: 100vh;
    overflow: hidden; 
  }
  
  header {
    grid-area: header;
    position: fixed;
    height: calc(60px + env(safe-area-inset-top, 0px));
  }
  
  #sidebar {
    flex-direction: column;
    grid-area: sidebar;
    position: relative !important;
    display: flex !important;
    background-color: var(--sidebar-bg);
    padding: 10px;
    overflow-y: auto;  
	  
  }
  
  main {
    grid-area: main;
    margin: 0;
    padding: 1rem;
    overflow-y: auto;
    background-color: var(--bg-color);
    color: var(--text-color);
  }
	
	
 
  footer {
/*    grid-area: footer;
    position: relative;
    height: 60px; */
	  display: none !important;
  }
  
  #menu-toggle {
    display: none;
  }
}


.main-content {
  box-sizing: border-box;   /* Viktig for paddings og border */
  max-width: 720px;
  min-width: 460px;
  width: 100%;
  margin: 0 auto;
}

/* For å sikre at viewporten oppfører seg riktig på mobil */
@media screen and (max-width: 767px) {
  .main-content {
    min-width: auto;        /* Fjern min-width for veldig små skjermer */
    padding: 0;        /* Juster padding på små skjermer */
  }
}


/* Meny styling */
#sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

#sidebar a {
  color: var(--sidebar-link-color);
  text-decoration: none;
  display: block;
  padding: 0.5rem 0;
}

/* Tema toggle container - plassert nederst i sidebar */
#theme-toggle-container {
/*  border-top: 1px solid rgba(255, 255, 255, 0.3); */
  padding-top: 0;
  margin-top: auto; /* Viktig for å presse den ned */
  display: flex;
  align-items: center;
  gap: 15px;
  padding-bottom: 30px;
  height: 60px;
	
}

/* Skyvebryter styling */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--slider-bg-color1);
  transition: 0.4s;
  border-radius: 34px;
}

.slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  top: 3px;
  background-color: var(--slider-dot-color);
  transition: 0.4s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: var(--slider-bg-color2);
}

.switch input:checked + .slider::before {
  transform: translateX(24px);
}

.theme-label {
  color: var(--theme-label-color);
  font-size: 0.9rem;
}


/* Når brukeren trekker ned eller oppdaterer */
main.pulling #refresh-container,
body.refreshing #refresh-container {
  height: 120px;
  opacity: 1;
  padding: 10px 0 30px 0;
}

main.pulling {
  transform: translateY(80px); /* Dytt hele main-innholdet ned */
}


/* Pull-to-refresh container */
#refresh-container {
  height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: height 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
  color: var(--text-color);
  font-size: 0.9rem;
  gap: 8px;
  user-select: none;
}




/* Spinner */
#refresh-spinner {
  position: relative;
  width: 48px;
  height: 48px;
}

#refresh-spinner::before,
#refresh-spinner::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: var(--spinner-border-top-color-before);
  box-shadow: 0 0 8px var(--spinner-box-shadow-color-before);
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

#refresh-spinner::before {
  border-width: 4px;
  animation: spin 1.2s linear infinite;
}

#refresh-spinner::after {
  border-width: 6px;
  border-top-color: var(--spinner-border-top-color-after);
  box-shadow: 0 0 12px var(--spinner-box-shadow-color-after);
  animation: spinReverse 1.5s linear infinite;
}

/* Spinner animasjoner */
@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes spinReverse {
  100% {
    transform: rotate(-360deg);
  }
}

/* Tekst under spinner */
#refresh-text {
  margin-top: 8px;
  color: var(--text-color);
}




/* Tre kolonner i header */
.header-three-columns {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

.header-three-columns .left {
  text-align: left;
  flex: 1;
}

.header-three-columns .center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
}

.header-three-columns .right {
  display: flex;
  justify-content: flex-end;
  align-items: center;       /* Vertikal midtstilling */
  flex: 1;
  gap: 0.8rem; /* Mellomrom mellom høyrekolonnene */
}


.header-three-columns .left-col {
  /* Juster bredde etter behov, eller bruk flex: 1 om de skal være like */
  min-width: 150px;
  text-align: right;
}

.header-three-columns .right-col {
  /* Juster bredde etter behov, eller bruk flex: 1 om de skal være like */
  min-width: 50px;
  text-align: right;
}


.header-profile-picture {
	height: 50px;
	border-radius: 50%;
}






/* Bottom Controls nederst på siden */
#bottom-controls {
  margin-top: auto;  /* presser alt i denne containeren ned */
  display: flex;
  flex-direction: column;
  gap: 10px;  /* mellomrom mellom font size og theme toggle */
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}




/* Slider for skriftstørrelse */
#font-size-container {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  color: var(--theme-label-color);
}

.font-size-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

#font-size-slider {
  -webkit-appearance: none;
  width: 180px;
  height: 8px;
  background: var(--slider-bg-color1);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

#font-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;         /* Økt fra 20px */
  height: 24px;        /* Økt fra 20px */
  background: var(--slider-bg-color1);  /* Samme farge som slider */
  cursor: pointer;
  border-radius: 50%;
  border: none;
  margin-top: 0px;    /* Justert for større prikk */
}

#font-size-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: var(--slider-bg-color1);  /* Samme farge som slider */
  cursor: pointer;
  border-radius: 50%;
  border: none;
}

#reset-font-size {
  background: none;
  border: none;
  font-size: 30px; /* Fast ikonstørrelse */
  width: 30px;
  height: 30px;
  padding: 0 5px 0 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0; /* Hindrer krymping */
  color: var(--reset-font-size-icon-color); /* Tilpasset tema */
}


.font-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--font-size-icon-color); /* Tilpasset tema */
  width: 30px;
  height: 30px;
  flex-shrink: 0; /* Hindrer krymping */
}



.language-container {
  display: flex;
  justify-content: center; /* sentrerer alle delene samlet */
  gap: 10px; /* avstand mellom delene */
  width: 100%; /* bruker tilgjengelig bredde */
}

.language-part {
  flex: 0 0 auto; /* ikke voks, ikke krymp, ta akkurat plassen som trengs */
  padding: 0; 
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
}

.language-flag {
	height: 22px;
}
















.language-dropdown {
  position: relative;
  display: inline-block;
}

.language-dropdown-btn {
  background-color: #3498db;
  color: white;
  padding: 10px 16px;
  font-size: 16px;
  border: none;
  cursor: pointer;
  user-select: none;
  width: 225px;
}

.language-dropdown-content {
  display: none;
  position: absolute;
  background-color: gold;
  min-width: 160px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  z-index: 1;
}

.language-dropdown-content a {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  text-decoration: none;
  color: black;
  gap: 10px;
}

.language-dropdown-content a:hover {
  background-color: #f1f1f1;
}

.language-dropdown-content img {
  width: 27px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  padding-left: 5px;
}

.language-dropdown:hover .language-dropdown-content {
  display: block;
}






.profile-header {
	padding: 0;
	margin: 0;
}

.profile-header-picture {
    width: 100%;
    height: auto;
    max-width: 720px;
    min-width: 200px;
    display: block;
    object-fit: cover;
}

.profile-header-textbox {
	padding: 8px 16px 24px 16px;
	background-color: gold;
}

.profile-header-username {
	font-size: 1.75em;
	font-weight: 700;
	padding-bottom: 20px;
}

.profile-header-statusmsg {
	font-style: italic;
	font-weight: 500;
	padding: 0 0 6px 0;
}

.profile-header-info{
	font-weight: 500;
	padding: 6px 0 0 0;
}











.profile-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  justify-content: center;
  gap: 10px;
  padding: 6px; 
  background-color: coral;
}

.profile-menu-cell {
  display: block;
  box-sizing: border-box;
  padding: 10px;
  text-align: center;
  border: 1px solid #ccc;
  background: #f7f7f7;
  text-decoration: none;   /* Fjern understreking */
  color: inherit;          /* Bruk tekstfarge fra tema */
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.profile-menu-cell:hover {
  background: #e0e0e0;
  color: black;
}















.profile-content-box {
	padding: 8px 16px 24px 16px;
	background-color: fuchsia;
	min-height: 100vh;
}











.profile-status {
	background: white;
	border: 1px solid #ddd;
	padding: 15px;
	margin-bottom: 20px;
	border-radius: 6px;
}
.profile-status-header {
	font-weight: bold;
	margin-bottom: 5px;
}
.profile-status-date {
	font-size: 0.9em;
	color: #666;
}
.profile-status-comments {
	margin-top: 15px;
	padding-left: 20px; /* innrykk */
	border-left: 3px solid #ddd;
}
.profile-status-comment {
	margin-bottom: 10px;
	padding: 10px;
	background: #f1f3f5;
	border-radius: 4px;
}

.profile-statuscomments-no-comments {
	font-style: italic;
}

.profile-status-comment-user {
	font-weight: 700;
}

.profile-status-comment-date {
	font-size: 0.8em;
	color: #555;
}









