* {
  padding: 0;
  margin: 0;
  font-family: "Arial", sans-serif;
}
#logo{
  list-style-type: none;
  margin: 0px;
  padding: 0px;
  li{
    height: 60px;
  }
  img {  
    width: 60px;
    height: auto;
    margin: 0px;
  }
}
.menu-container {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  background-color: #333;
  color: white;
  .ul{
    padding-right: 0px;
    margin-right: 0px;
  }
  .admin {
    padding-left: 0px;
    margin-left: 0px;
  }
}
.back {
  font-size: 0.7em;
  background-color: #f0f0f0;
  padding: 0px;
  margin: 0px;
}
body {
  max-width: 100vw;
  overflow-x: hidden;
  margin: auto;
}
textarea {
  width: 100%;
  height: 150px;
}
button {
  margin-top: 10px;
}
.file {
  list-style-type: none;
  font-size: 0.8em;
}
ul {
  padding: 0px;
  margin: 0px;
}
body {
  font-family: Arial, sans-serif;
  max-width: 1000px;
  margin: auto;
}
.category {
  cursor: pointer;
  background: #f1f1f1;
  padding: 10px;
  margin-top: 10px;
  border-radius: 5px;
  text-transform: capitalize;
}
.category:hover {
  background: #ddd;
}
.file-list {
  display: none;
  margin-left: 20px;
}

/* Notifieringsstil */
.notify {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 5px;
  color: rgb(254, 254, 254);
  font-weight: bold;
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  z-index: 1000;
  min-width: 200px;
  text-align: center;
}

/* Färg för framgång */
.notify.success {
  background-color: #4caf50;
}

/* Färg för fel */
.notify.error {
  background-color: #d32f2f;
}
a {
  text-decoration: none;
  color: #333;
}
.menuitem {
  padding: 5px;
  display: inline-block;
  width: 100%;

}
.menuitem:hover {
  background-color: #f1f1f1;
}

/* Grundläggande meny-styling */
.menu {
  background: #333;
  color: white;
  padding: 10px;
  position: relative;
}
.menu li {
  list-style-type: none;
  cursor: pointer;
}

.menu > ul {
  list-style: none;
  margin: 0;
  display: flex;
  align-items: center;
}

.menu > ul > li {
  padding: 10px;
  position: relative;
}

.menu > ul > li > a {
  color: white;
  text-decoration: none;
  display: block;
  padding: 5px;
}

/* Dropdown-nivå 1 (ämnen) */
.menu > ul > li > .dropdown {
  display: none;
  position: absolute;
  background: white;
  color: black;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  top: 100%;
  left: 0;
  min-width: 200px;
  z-index: 1000;
}

/* Dropdown-nivå 2 (kategorier) */
.menu > ul > li > .dropdown > li {
  position: relative;
}

.menu > ul > li > .dropdown > li > .sub-dropdown {
  display: none;
  position: absolute;
  background: white;
  color: black;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  top: 0;
  left: 100%; /* Starta direkt till höger om övermenyn */
  min-width: 200px;
  z-index: 1000;
  overflow: hidden;
}

/* Visa undermenyer endast när man hovrar */
.menu > ul > li:hover > .dropdown,
.menu > ul > li > .dropdown > li:hover > .sub-dropdown {
  display: block;
}

/* Lägg till en osynlig zon mellan nivåerna för att undvika att menyn stängs */
.menu > ul > li > .dropdown > li {
  padding: 7px;
}

.menu > ul > li > .dropdown > li:hover {
  background: #f1f1f1;
}

/* Fixa så att undermenyer inte stänger sig när musen flyttas */
.menu > ul > li > .dropdown > li {
  padding-right: 30px; /* Gör att man kan flytta musen till höger utan att menyn stängs */
}
h3.sub {
  background-color: dimgrey;
  color: white;
  border-top:#333 1px solid; 
  font-size: 0.9em; 
  padding: 5px 1px 1px 6px;
}


.view {
  position: relative;
  width: 800px;
  margin-left: 210px;
  #editview {
    position: absolute;
    right:0;
    top:20px;
  }
  ul {
    padding: 0px;
    margin: 0px;
  }
  ul,
  ol {
    padding-left: 20px;
  }
  code {
    padding: 2px;
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    font-family: "Courier New", Courier, monospace;
    /* Behöver ha en radbrytning */
    overflow-x: auto;

}
/* Code block styling for all language classes */
code[class*='language-'],
pre[class*='language-'] {
  margin: 10px;
  padding: 10px;
  display: block;
}
  .language-bash {
    background-color: #333;
    color: white;
  }
  th{
    text-align: left;
    margin-bottom: 2px;
    border-bottom: 1px solid #ccc;
  }

  h1 {
    font-size: 2em;
    font-weight: bold;
    color: #333;
    margin: 20px 0 5px 0;
  }
  h2 {
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
    margin: 20px 0 5px 0;
  }
  h3 {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    margin: 15px 0 5px 0;
  }
  p {
    margin: 7px 0;
  }
}

.autocomplete-list {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    max-height: 150px;
    overflow-y: auto;
    width: 200px;
    list-style: none;
    padding: 0;
    margin: 0;
    z-index: 1000;
}

.autocomplete-list li {
    padding: 8px;
    cursor: pointer;
}

.autocomplete-list li:hover {
    background: #f1f1f1;
}

#kategori_container {
  width: 1000px;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-content: flex-start;
  align-items: flex-start;
  #kategori_meny {
    position: fixed;
    width: 200px;
    margin-right: 10px;
    li {
      list-style-type: none;
      padding: 3px;
      background-color: #f1f1f1;
      margin-bottom: 3px;
      cursor: pointer;
      font-size: .8em;
    }
    li:hover{
      background-color: #ddd;
    }
    a {
      padding-left:4px;
      display: block;
    }
    .active {
      background-color: #ddd;
    }
  }
}
button, a, .category, .file span {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}
.file{
  span{
    display: inline-block;
    border: 1px solid #ccc;
    background-color: aquamarine;
    cursor: pointer;
    padding: 2px;
  }
}

.yaml-metadata-container {
  display: flex;
  justify-content: space-between;
}


.imagelist {
  max-height: 100px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* ADD THIS */
  border: 1px solid #ccc;
  padding: 5px;
}

.imagelist::-webkit-scrollbar {
  width: 8px; /* Gör scrollbaren smalare */
}

.imagelist::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 5px;
}

.imagelist::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 5px;
}

.imagelist::-webkit-scrollbar-thumb:hover {
  background: #555;
}

#dropZone {
  border: 2px dashed #ccc;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  background: #f9f9f9;
  margin-bottom: 10px;
}

#dropZone.hover {
  background: #e0e0e0;
}

#uploadStatus {
  list-style: none;
  padding: 0;
}

.collapsed {
  display: none;
}
/* Standardpil: pekar åt höger när menyn är stängd */
.sub::after {
  content: "▶";
  margin-left: 10px;
  display: inline-block;
  transition: transform 0.3s ease;
}

/* När .sub har klassen .expanded, rotera pilen (nu pekar den nedåt) */
.sub.expanded::after {
  transform: rotate(90deg);
}

#google_translate_element {
  position: absolute;
  left: -9999px; /* Placera utanför skärmen */
  width: 0;
  height: 0;
  overflow: hidden;
}
/* Tar bort översättningsbaren som Google ibland visar överst på sidan */
.skiptranslate {
  display: none !important;
}
body {
  top: 0px !important;
}

/* ========================================
   MOBILE-RESPONSIVE STYLES
   ======================================== */

/* Ensure all images and media are responsive */
img, video, iframe {
  max-width: 100%;
  height: auto;
}

/* Touch-friendly buttons and inputs */
button, input[type="submit"], input[type="button"], .category, .file span {
  min-height: 44px;
  min-width: 44px;
  padding: 10px 15px;
  cursor: pointer;
}

/* Mobile-first media queries for screens <= 768px */
@media screen and (max-width: 768px) {
  
  /* Body adjustments */
  body {
    max-width: 100vw;
    width: 100%;
    margin: 0;
    padding: 0;
    font-size: 16px; /* Prevent zoom on iOS */
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    -webkit-touch-callout: none;
    position: relative;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  /* Make tables scrollable on mobile - preserve semantics */
  .view {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* ADD THIS */
  }

  .view table {
    width: auto;
    min-width: 100%;
  }

  .view table tbody,
  .view table thead {
    display: table-row-group;
  }

  /* Touch-friendly links in navigation */
  .menu a, .menuitem {
  min-height: 20px;
  padding: 10px 5px;
  display: flex;
  align-items: center;
  }

  /* Menu container - stack vertically on mobile */
  .menu-container {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
  }

  #logo {
    width: 100%;
    text-align: center;
    padding: 10px 0;
  }

  #logo img {
    width: 50px;
    height: auto;
  }

  /* Mobile menu - hamburger style */
  .menu {
    width: 100%;
    padding: 0;
  }

  .menu > ul {
    flex-direction: column;
    width: 100%;
  }

  .menu > ul > li {
    width: 100%;
    padding: 5px 2px;
    border-bottom: 1px solid #555;
  }

  /* Dropdowns on mobile - full width */
  .menu > ul > li > .dropdown {
    position: static;
    display: none;
    width: 100%;
    box-shadow: none;
    background: #444;
    color: white;
  }

  .menu > ul > li > .dropdown > li {
    padding: 10px 20px;
    border-bottom: 1px solid #666;
  }

  .menu > ul > li > .dropdown > li:hover {
    background: #555;
  }

  /* Sub-dropdown on mobile */
  .menu > ul > li > .dropdown > li > .sub-dropdown {
    position: static;
    width: 100%;
    left: 0;
    background: #555;
    padding-left: 20px;
  }

  .menu > ul > li > .dropdown > li > .sub-dropdown li {
    padding: 2px 5px;
  }

  /* Show dropdowns when parent is active (toggle via JavaScript) */
  .menu > ul > li.active > .dropdown,
  .menu > ul > li > .dropdown > li.active > .sub-dropdown {
    display: block;
  }

  /* Language toggle */
  #lan_lbl, #translateCheckbox {
    font-size: 14px;
    padding: 10px;
  }

  /* View page layout */
  #kategori_container {
    width: calc(100% - 20px);
    flex-direction: column;
    padding: 10px;
  }

  #kategori_meny {
    display: none;
    position: static;
    width: calc(100% - 20px);
    margin-bottom: 20px;
  }

  .view {
    width: calc(100% - 20px);
    margin-left: 0;
    padding: 10px;
  }

  .view #editview {
    position: static;
    display: block;
    margin: 10px 0;
  }

  /* Edit page forms */
  form {
    width: 100%;
  }

  .yaml-metadata-container {
    flex-direction: column;
  }

  form input[type="text"],
  form textarea {
    width: 100%;
    box-sizing: border-box;
    font-size: 16px; /* Prevent zoom on iOS */
  }

  form button {
    width: 100%;
    margin: 10px 0;
    padding: 15px;
    font-size: 16px;
  }

  /* Image list adjustments */
  .imagelist {
    max-height: 200px;
    width: 100%;
    margin-top: 10px;
  }

  /* File list */
  .file-list {
    margin-left: 10px;
    font-size: 14px;
  }

  .file {
    padding: 10px 5px;
    word-wrap: break-word;
  }

  /* Category sections */
  .category {
    padding: 15px 10px;
    font-size: 16px;
    margin-top: 5px;
  }

  /* Notification adjustments */
  .notify {
    right: 10px;
    left: 10px;
    top: 10px;
    min-width: auto;
    font-size: 14px;
  }

  /* Autocomplete list */
  .autocomplete-list {
    width: 100%;
    max-width: 300px;
  }

  /* Code blocks - horizontal scroll */
  .view code,
  .view code[class*='language-'],
  .view pre[class*='language-'] {
    overflow-x: auto;
    display: block;
    white-space: pre;
    margin: 5px 0;
    padding: 10px 5px;
    font-size: 14px;
  }

  /* Headings adjustments */
  .view h1 {
    font-size: 1.5em;
    margin: 10px 0;
  }

  .view h2 {
    font-size: 1.3em;
    margin: 10px 0;
  }

  .view h3 {
    font-size: 1.1em;
    margin: 10px 0;
  }

  /* Paragraph and list spacing */
  .view p {
    margin: 10px 0;
    line-height: 1.6;
  }

  .view ul,
  .view ol {
    padding-left: 25px;
    margin: 10px 0;
  }

  /* Tables on mobile */
  .view table {
    font-size: 14px;
  }

  .view th,
  .view td {
    padding: 8px 5px;
    min-width: 100px;
  }

  /* Login form */
  form[action="login.php"] input,
  form[action="login.php"] button {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    font-size: 16px;
    box-sizing: border-box;
  }

  /* Upload page */
  #dropZone {
    padding: 30px 10px;
    margin: 10px 0;
  }

  #fileName,
  #fileContent {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    box-sizing: border-box;
    margin: 10px 0;
  }

  #uploadButton {
    width: 100%;
    padding: 15px;
    font-size: 16px;
  }

  /* Admin panel */
  h1 {
    font-size: 1.5em;
    padding: 10px;
  }

  h3 {
    font-size: 1.2em;
    padding: 10px;
  }

  ul li {
    font-size: 16px;
    padding: 10px;
  }

  /* Textarea improvements */
  textarea {
    width: 100%;
    min-height: 200px;
    font-size: 16px;
    padding: 10px;
    box-sizing: border-box;
  }
}

/* Tablet devices (769px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  body {
    max-width: 100%;
    padding: 0 20px;
  }

  #kategori_container {
    width: 100%;
  }

  #kategori_meny {
    width: 180px;
  }

  .view {
    width: calc(100% - 200px);
    margin-left: 210px;
  }
}

/* Small mobile devices (max 480px) */
@media screen and (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .menu > ul > li {
    padding: 12px 0px;
  }

  .category {
    padding: 12px 8px;
    font-size: 14px;
  }

  .file {
    font-size: 12px;
  }

  .view h1 {
    font-size: 1.3em;
  }

  .view h2 {
    font-size: 1.2em;
  }

  .view h3 {
    font-size: 1.1em;
  }

  /* Button sizing for small mobile - override global touch targets */
  button, input[type="submit"], input[type="button"] {
    padding: 12px;
    font-size: 14px;
  }
}