@font-face {
  font-family: "Inter";
  src: url("Inter-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
}

html,
body,
section {
  font-family: "Inter", Arial, Helvetica, sans-serif;
  height: 100vh;
}

html {
  background: linear-gradient(90deg, #e3ffe7 0%, #d9e7ff 100%);

  span,
  p,
  a {
    color: black;
    font-size: 1.2rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  .light_text {
    font-size: 0.85rem;
    font-weight: 100;
  }
}

.systemcolor {
  background-color: #e3ffe7;
}

i {
  font-size: 1.7rem;
  cursor: pointer;
  margin-right: 0.7rem;
}

.emoji {
  font-size: 2.2rem;
}

.highlighted {
  border-color: #d9e7ff;
  border-style: solid;
}

header {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex-direction: column;
  flex: 0 0 auto;
  height: 30%;

  .wrapper {
    width: 100%;
    display: flex;
    justify-content: center;

    h1 {
      font-size: 3rem;
      font-weight: 200;
      margin: 0 !important;
    }

    span {
      font-size: 4rem;
      font-weight: bold;
    }
  }
}

nav {
  position: absolute;
  top: 40%;
  left: 0;
  z-index: 1000;
}

nav .box {
  border-bottom-left-radius: 0;
  border-top-left-radius: 0;

  button {
    display: flex;
    flex-direction: column;
  }
}

section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.chat {
  height: 70%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  justify-content: center;
  padding-top: 2rem;
  width: 100%;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  #sidebar {
    width: fit-content;
    display: flex;
    align-items: center;
    min-width: 200px;
    font-size: 0.9rem;
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.7s;
    will-change: transform, opacity;
    padding: 2rem 1.5rem 2rem 1.5rem; /* mehr Luft um die Sidebar */
    gap: 2rem; /* Abstand zwischen den Boxen */

    &[data-visible="false"] {
      transform: translateX(-100%);
      opacity: 0;
      pointer-events: none;
    }

    .box {
      padding: 2rem 1.5rem; /* mehr Padding für die Boxen */
      height: fit-content;
      margin-bottom: 1.5rem;
      .box_header {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 1.5rem;
        h2 {
          font-size: 1.1rem;
          margin-bottom: 1rem;
        }
      }

      .setting {
        margin-bottom: 1.5rem;
        padding: 0.7rem 0.5rem; /* mehr Padding für Settings */
        border-radius: 0.7rem;

        p {
          margin-bottom: 1rem;
        }

        .segmented_control {
          display: flex;
          gap: 0.7rem;

          .box {
            width: 30%;
            font-size: 0.95rem;
            display: flex;
            justify-content: center;
            flex-direction: column;
            aspect-ratio: 1;
            margin-bottom: 0;
            padding: 0.5rem 0.3rem; /* mehr Padding für Segments */
          }
        }
      }
    }
  }

  #chat::-webkit-scrollbar {
    display: none;
  }

  #chat {
    display: flex;
    flex-direction: column;
    height: 90%;
    width: 100%;
    overflow-y: scroll;
    padding-inline: 3rem;
    padding-block: 1rem;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */

    /* Fade top and bottom using a mask so the background gradient stays visible */
    -webkit-mask-image: linear-gradient(
      to bottom,
      transparent 0%,
      black 18px,
      black calc(100% - 18px),
      transparent 100%
    );
    mask-image: linear-gradient(
      to bottom,
      transparent 0%,
      black 18px,
      black calc(100% - 18px),
      transparent 100%
    );
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;

    .suggestions {
      width: calc(100% - 6rem);
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 3rem;
      height: fit-content;
      align-items: stretch;
      align-self: center;
      margin-bottom: 20vh;
    }

    .suggestions .box {
      flex: 1 1 0;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      aspect-ratio: 1.3/1;
      box-sizing: border-box;
      justify-content: center;
      margin-inline: 2%;
      max-width: 200px;
      min-height: 120px; /* Ensures all suggestions have the same minimum height */
      height: 100%; /* Forces all to fill the available height in the row */
      max-height: 10rem;
    }

    .message {
      width: fit-content;
      max-width: min(80%, 600px);
      padding: 1rem;
      border-radius: 2rem;

      &.user {
        align-self: flex-end;
      }
    }
  }

  #asking {
    width: 50%;
    min-width: 500px;
    height: 10%;
    justify-self: center;
    display: flex;

    input {
      width: 90%;
      height: 100%;
      max-height: 3rem;
      border-radius: 2rem;
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
      border-right: none;
      border-width: 0;
      padding: 1rem;
    }

    input:focus {
      outline: none;
    }

    button {
      background-color: white;
      height: 100%;
      max-height: 3rem;
      font-size: 1.2rem;
      font-weight: bold;
      display: flex;
      align-items: center;
      max-width: 10%;
      border-top-right-radius: 2rem;
      border-bottom-right-radius: 2rem;

      i {
        margin-right: 1rem;
      }
    }
  }

  main {
    width: 70%;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  &.aside-hidden {
    main {
      width: 100% !important;
    }

    #sidebar {
      display: block;
      position: absolute;
      left: 0;
      top: 0;
      height: 100%;
      z-index: 1;
    }
  }

  main {
    transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1),
      margin 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  }

  #asking {
    transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1),
      min-width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .chat {
    transition: padding-left 0.7s cubic-bezier(0.4, 0, 0.2, 1),
      padding-right 0.7s cubic-bezier(0.4, 0, 0.2, 1),
      width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  }

  @media (prefers-color-scheme: dark) {
    #chat::before {
      background: linear-gradient(
        to bottom,
        rgba(24, 40, 72, 0.85) 70%,
        rgba(24, 40, 72, 0)
      );
    }
    #chat::after {
      background: linear-gradient(
        to top,
        rgba(24, 40, 72, 0.85) 70%,
        rgba(24, 40, 72, 0)
      );
    }
  }
}

footer {
  flex: 0 0 auto;
  text-align: end;
  transform: translateY(100%);
}

@media (prefers-color-scheme: dark) {
  html {
    background: linear-gradient(90deg, #4b6cb7 0%, #182848 100%);

    .systemcolor {
      background-color: #4b6cb7;
    }

    span,
    p,
    a {
      color: white !important;
    }
  }
}

@media (max-width: 1000px) {
  #sidebar {
    width: 100% !important;
    position: absolute;
    left: 50% !important;
    top: 0;
    height: 100%;
    z-index: 1001;
    padding: 0 !important;
    transform: translateX(-50%) !important;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  body::before {
    content: "";
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(24, 40, 72, 0.45);
    pointer-events: auto;
    transition: opacity 0.3s;
    opacity: 1;
    display: none;
  }
  body.sidebar-active::before {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
  body.aside-hidden::before {
    opacity: 0;
    pointer-events: none;
    display: none;
  }
  main {
    width: 100% !important;
  }

  #asking {
    width: 90% !important;
    min-width: 300px !important;
    z-index: 999;
  }

  #chat-container {
    height: 80%;
    margin-left: -1rem;
    width: calc(100% + 2rem);
  }

  header {
    height: 20%;
    .wrapper {
      justify-content: start;
      h1 {
        font-size: 2rem !important;
      }
      span {
        font-size: 1.5rem !important;
      }
    }
  }

  #chat {
    padding-inline: 0 !important;
    .suggestions {
      margin-bottom: 1rem !important;
      .box:nth-child(n + 3) {
        display: none;
      }
    }
  }

  nav {
    position: absolute;
    top: 0 !important;
    left: 0 !important;
    width: auto !important;
    z-index: 1000;

    .box {
      border-top-right-radius: 0 !important;
    }
    button {
      flex-direction: row !important;
    }
  }
}

/* Info Popup Modal Styles */
.info-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 1200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.info-popup.active {
  pointer-events: auto;
  opacity: 1;
}
.info-popup .info-popup-content {
  border-radius: 18px;
  margin-top: 5vh;
  min-width: 320px;
  max-width: 95vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  animation: infoPopupIn 0.45s cubic-bezier(0.6, 1.5, 0.5, 1) both;
  transform: translateY(-60px);
}
.info-popup.closing .info-popup-content {
  animation: infoPopupOut 0.35s cubic-bezier(0.6, 1.5, 0.5, 1) both;
}
@keyframes infoPopupIn {
  from {
    opacity: 0;
    transform: translateY(-60px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes infoPopupOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-60px);
  }
}
.info-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2em 1.5em 0.5em 1.5em;
}
.info-popup-header h2 {
  font-size: 1.2em;
  margin: 0;
  font-weight: 600;
}
.info-popup-close {
  background: none;
  border: none;
  font-size: 1.6em;
  color: #888;
  cursor: pointer;
  padding: 0;
  margin-left: 1em;
  transition: color 0.15s;
}
.info-popup-close:hover {
  color: #222;
}
.info-popup-body {
  padding: 1.2em 1.5em 1.5em 1.5em;
  font-size: 1.05em;
  color: #333;
}

/* Info Popup Backdrop */
.info-popup::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  z-index: -1;
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.25s;
}
.info-popup:not(.active)::before {
  opacity: 0;
}

@media (max-width: 600px) {
  .info-popup .info-popup-content {
    min-width: 0;
    width: 98vw;
    margin-top: 10vw;
    border-radius: 12px;
    padding: 0;
  }
  .info-popup-header,
  .info-popup-body {
    padding-left: 1em;
    padding-right: 1em;
  }
}
