/* Main stylesheet for the entire website */

/* Color variables */

:root {
  --color-primary-light: #a5ffff;
  --color-primary-mid: #083d83;
  --color-primary-dark: #002d74;
}

/* Base layout */

body {
  margin: 0;
  font-family: Helvetica, sans-serif;
  font-size: 16px;
}

main {
  margin: auto;
  margin-top: 50px;
  padding: 5px;
  text-align: justify;

  /* Content width should be 1200px, or 97% of screen width if screen is smaller */
  width: min(97%, 1200px);
}

/* Headings */

h1 {
  font-size: 36px;
}

h2 {
  font-size: 28px;
}

/* Links */

a {
  color: var(--color-primary-dark);
}

a:hover,
a:focus {
  color: var(--color-primary-mid);
}

/* Navbar */

nav {
  /* Stick to top */
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1;

  font-size: 20px;

  /* Don't show expand-nav button by default */
  div:has(#expand-nav) {
    display: none;
  }

  ul {
    /* Align child elements using flexbox */
    display: flex;
    align-items: flex-start;

    margin: 0;
    padding: 0;
    list-style-type: none;
  }

  .nav-element {
    /* Base size is the same for all elements */
    flex: 1;
    background-color: var(--color-primary-dark);
    height: 45px;

    a,
    label {
      /* Link should take up the entire space in the li */
      display: block;
      height: 100%;
      padding: 10px;
      box-sizing: border-box;
      text-align: center;
      text-decoration: none;
      color: white;
      white-space: nowrap;

      &:hover,
      &:focus,
      &:has(input:focus),
      &:has(input:checked) {
        background: var(--color-primary-mid);
        color: var(--color-primary-light);
        cursor: pointer;
        text-decoration: underline;
      }
    }
    img {
      height: 25px;
      padding-top: 10px;
    }

    /* Hide checkbox */
    input {
      opacity: 0;
      position: absolute;
      cursor: pointer;
    }

    /* Show subitems only when input is checked */

    ul {
      display: none;

      .nav-element {
        border: none;
      }
    }

    &:has(input:checked) {
      ul {
        display: block;
      }
    }
  }
}

/* Adjustments if screen is not wide enough to fit normal navbar */

@media only screen and (max-width: 800px) {
  nav {
    width: 90%;

    div:has(#expand-nav) {
      width: 45px;
      display:block;

      img {
          padding: 0;
      }
    }

    /* Show items vertically */
    ul {
      flex-direction: column;
      align-items: stretch;
    }

    /* Only show items if expand-nav has been checked */
    &:not(:has(#expand-nav input:checked)) ul {
      display: none;
    }
  }
}

/* Make sure nav bar can be scrolled if it's larger than screen height */
@media only screen and (max-height: 350px) {
  nav {
    position: relative;
    margin-top: -1px;
  }
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Tabelle Styling */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-family: Arial, sans-serif;
}

th {
  background-color: #002d74ff;
  color: white;
  text-align: left;
  padding: 8px 15px;
}

td {
  padding: 8px;
  text-align: left;
  border: 1px solid #ddd;
}

tr:nth-child(even) {
  background-color: #f2f2f2;
}

tr:hover {
  background-color: #ddd;
}

caption {
  font-size: 1.5em;
  font-weight: bold;
  margin-bottom: 10px;
  text-align: center;
}
