/* root variables */
:root {
  --text: #ebe9fc;
  --background: #161616;
  --primary: #f05133;
  --secondary: #020024;
}

* {
  box-sizing: border-box;
  font-family: "roboto";
}

/* removes default margin of text elements */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
}

/* default button styles */
button {
  margin-top: 30px;
  padding: 10px 15px;
  background-color: rgba(0, 0, 0, 0);
  color: white;
  border: var(--primary) solid 2px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 17px;
}

body,
html {
  background-color: var(--background);
  margin: 0;
  color: white;
}

/* navbar */
nav {
  width: 100%;
  padding: 10px 15px;
  border-bottom: rgba(95, 95, 95, 0.5) 1px solid;
  display: flex;
  align-items: center;
  max-height: 50px;
  & > div {
    cursor: pointer;
  }
  & :first-child {
    margin-right: auto;
    display: flex;
    align-items: center;
    & > img {
      width: 40px;
      aspect-ratio: 1/1;
    }
  }
  & :last-child {
    margin-left: 10px;
  }
}

main {
  /* hides all pages */
  & > div {
    display: none;
  }
  /* except page with shown-page class */
  & > div.shown-page {
    display: block;
  }
  & > div#page-home {
    /* bit home image */
    & > div.img {
      width: 100%;
      height: 500px;
      background-color: #222222;
      padding: 20px;
      box-shadow: 0 15px 17px #222222;
      display: flex;
      & > object {
        max-height: 100%;
        margin-inline: auto;
      }
    }
    & > div.main {
      padding: 50px 20px 30px 20px;
      display: flex;
      /* text and image side by side */
      & > div.left {
        max-width: 500px;
        & > h1 {
          color: var(--primary);
        }
      }
      & > div.right {
        width: 100%;
        display: flex;
        & > img {
          height: 400px;
          margin: 0 0 0 auto;
        }
      }
    }
  }
  & > div#page-about {
    padding: 20px;

    & > div.creators {
      margin: 20px 0;
      display: flex;
      /* creators side by side */
      & > div {
        width: 300px;
        padding: 10px;
        background-color: rgb(31, 31, 31);
        border-radius: 5px;
        margin-right: 30px;
        & > img {
          /* center images without overflow */
          object-fit: cover;
          width: 100%;
          height: 250px;
        }
        & > h3 {
          margin-bottom: 8px;
        }
      }
    }
    /* form with a working mailto link */
    & > div.form {
      border-radius: 5px;
      background-color: rgb(31, 31, 31);
      padding: 20px;

      & > h1 {
        margin-bottom: 15px;
      }
      input[type="text"],
      textarea {
        width: 100%;
        padding: 12px;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-sizing: border-box;
        margin-top: 6px;
        margin-bottom: 16px;
        resize: vertical;
      }
      input[type="submit"] {
        background-color: var(--primary);
        color: white;
        padding: 12px 20px;
        border: none;
        border-radius: 4px;
        cursor: pointer;
      }
    }
  }
  /* courses page  */
  & > div#page-courses {
    padding: 20px;
    & > div {
      display: flex;
      margin-top: 10px;
      & > div {
        background-color: rgb(31, 31, 31);
        width: 250px;
        height: 200px;
        padding: 20px;
        margin-right: 20px;
        border-radius: 5px;
        cursor: pointer;
      }
      & > div.disabled {
        pointer-events: none;
        opacity: 0.5;
      }
    }
  }

  /* default styles for info pages */
  & > div#page-course-1,
  & > div#page-course-2,
  & > div#page-course-3 {
    padding: 20px;
    & > h1 {
      margin: 40px 0 20px 0;
    }
    & > h3 {
      margin: 10px 0 5px 0;
    }
    & :first-child {
      margin-top: 0;
    }
    /* p with code-example looks like a small terminal */
    & > p.code-example {
      margin: 10px 0;
      font-weight: bold;
      border-radius: 5px;
      padding: 10px;
      max-width: 700px;
      background-color: rgb(36, 36, 36);
    }
  }

  /* default styles for quiz pages */
  & > div#page-course-1-quiz,
  & > div#page-course-2-quiz,
  & > div#page-course-3-quiz {
    padding: 20px;
    & > div {
      margin-top: 20px;
      & > div {
        display: flex;
        margin-top: 5px;
        & > input.correct {
          accent-color: lime;
        }
        & > input.wrong {
          accent-color: red;
        }
        /* the text of missed awnsers turn green */
        & > p.correct {
          color: lime;
        }
      }
      & > select {
        background-color: rgb(49, 49, 49);
        color: white;
        border-radius: 5px;

        & > option {
          background-color: rgb(49, 49, 49);
          color: white;
        }
      }
      /* select awnsers will have (correct) or (wrong) after them */
      & > select.correct {
        background-color: lime;
      }
      & > select.wrong {
        background-color: red;
      }
    }
  }
}

/* error popup if quiz is not filled out completely */
.alert {
  cursor: pointer;

  padding: 20px;
  background-color: #f44336;
  color: white;
  opacity: 1;
  transition: opacity 0.6s;
  position: fixed;
  bottom: 25px;
  right: 25px;
  user-select: all;
}

.alert.error {
  background-color: #f44336;
}

.closebtn {
  color: white;
  font-weight: bold;
  float: right;
  font-size: 22px;
  line-height: 20px;
  cursor: pointer;
  transition: 0.3s;
  padding: 0 0.8rem;
}

.closebtn:hover {
  color: black;
}
