@import "colors";

$hovered-text-color: #c2c2c2;
$text-color: white;

$background-color-hovered: #283747;

.header {
  box-sizing: border-box;
  background-color: $deepblue;
  box-shadow: 3px 3px 3px 0 #dfdfdf;
  border-radius: 0;
  width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  padding: 10px;
  gap: 10px;

  @media (max-width: 700px) {
    height: auto;
  }

  @media (max-width: 580px) {
    justify-content: space-between;
  }

  &-logo {
    display: flex;
    flex-direction: row;
    gap: 10px;

    >a {
      color: $text-color !important;
    }

    &:hover>a {
      color: $hovered-text-color;
    }

    @media (max-width: 607px) {
      width: 100%;
      justify-content: center;
    }

    &-picture {
      height: 100%;
      width: 65px;
      display: flex;

      background-position: center center;
      background-size: contain;
      background-repeat: no-repeat;

      @media (max-width: 580px) {
        height: auto;
      }
    }

    &-text {
      color: $text-color;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: flex-start;

      >span:first-child {
        font-size: 1.43em;
      }

      >span:last-child {
        font-size: .7em;
      }
    }

  }

  &-lang {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;

    @media (max-width: 580px) {
      flex-direction: row;
    }

    >form {
      margin: 0;
      box-sizing: border-box;
      position: relative;

      >input[type=submit] {
        border-radius: 0;
        margin: 0;
        box-sizing: border-box;
        background-color: $deepblue;
        width: 45px;
        height: 25px;
        padding: 0;
        color: $text-color;
        font-weight: normal;
        line-height: 1.3em;
        font-family: "Twemoji Country Flags", sans-serif;

        &:hover {
          background-color: $background-color-hovered;
        }
      }
    }
  }

  &-disconnected {
    box-sizing: border-box;
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;

    @media (max-width: 607px) {
      justify-content: center;
    }

    a.button {
      box-sizing: border-box;
      height: 35px;
      background-color: transparent;
      font-weight: normal;
      padding: 5px 20px;
      display: flex;
      justify-content: center;
      align-items: center;
      text-transform: uppercase;
      text-decoration: none;
      color: $text-color;
      margin: 0;
      font-size: .9em;
      width: 120px;

      &:not(.link-like):not(:disabled):hover {
        background-color: $background-color-hovered;
      }
    }
  }

  &-disconnected~&-lang {
    @media (max-width: 662px) {
      flex-direction: row;
      width: 100%;
    }
  }

  &-connected {
    box-sizing: border-box;
    flex: 1;
    display: flex;
    flex-direction: row;

    @media (min-width: 400px) and (max-width: 1200px) {
      flex-direction: column;
      min-width: 100%;
      justify-content: center;
      align-items: center;
      gap: 10px;
    }

    @media (max-width: 400px) {
      flex-direction: column;
      width: 100%;
      gap: 10px;
      padding: 0 10px;
    }

    >.right,
    >.left {
      box-sizing: border-box;
      display: flex;
      flex-direction: row;
      align-items: center;

      @media (min-width: 400px) and (max-width: 1200px) {
        width: 100%;
        justify-content: space-between;
        padding: 0 20px;
      }
    }

    >.right {
      flex: 1;
      justify-content: flex-end;

      >.user {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 15px;

        @media (max-width: 1200px) {
          width: 100%;
          flex-direction: row-reverse;
          justify-content: flex-end;
        }

        >a {
          display: block;
          min-width: 40px;
          height: 40px;
          border-radius: 50%;
          background-position: center center;
          background-size: cover;
          background-repeat: no-repeat;
          background-color: $deepblue;
        }

        >.options {
          display: flex;
          flex-direction: column;
          gap: 5px;

          >.username {
            display: flex;
            justify-content: flex-end;
            gap: 5px;

            @media (max-width: 500px) {
              justify-content: flex-start;
            }

            >a {
              color: $text-color;

              &:hover {
                color: $hovered-text-color;
              }
            }
          }

          >.links {
            width: 100%;
            display: flex;
            justify-content: flex-end;
            gap: 15px;

            @media (max-width: 1200px) {
              justify-content: flex-start;
            }

            a {
              color: $text-color;
            }

            a,
            button {
              font-size: 100%;
              margin: 0;
              text-align: right;
              margin-top: auto;

              &:hover {
                color: $hovered-text-color;
              }
            }

            form#logout-form {
              margin: 0;
              display: inline;
            }
          }
        }
      }

      >.notification {
        height: 100%;
        width: 55px;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;

        >a {
          color: $text-color;
          position: relative;
          font-size: 25px;

          &:hover {
            color: $hovered-text-color;
          }

          >span {
            color: $text-color;
            font-size: 14px;
            display: flex;
            justify-content: center;
            align-items: center;
            width: 10px;
            height: 10px;
            padding: 5px;
            background-color: $red-text-color;
            border-radius: 50%;
            position: absolute;
            top: -50%;
            right: -50%;
          }
        }

        >#header_notif {
          box-sizing: border-box;
          position: absolute;
          margin: 0;
          background-color: whitesmoke;
          top: calc(100% + 10px);
          right: calc(50% - 30px);
          width: 400px;
          max-width: calc(100vw - 30px);
          padding: 10px;
          z-index: 100;
          border-radius: 10px;
          box-shadow: 3px 3px 3px 0 #767676;

          >ul {
            list-style-type: none;
            margin: 0;
            display: flex;
            flex-direction: column;
            gap: 10px;
            min-height: 20px;
            max-height: 120px;
            overflow-y: auto;

            >li {
              >a {
                .datetime {
                  display: flex;
                  justify-content: flex-start;
                  gap: 10px;
                  font-style: italic;
                  font-size: .8em;
                }
              }

              &.empty-notification {
                text-align: center;
                font-style: italic;
              }
            }
          }

          .options {
            width: 100%;
            display: flex;
            justify-content: space-between;
            margin-top: 10px;
            gap: 5px;

            >a {
              color: black;
              padding: 5px;
              width: 50%;
              display: flex;
              justify-content: center;
              text-align: center;
              align-items: center;
              border-radius: 5px;
              background-color: #ddd;

              &:hover {
                background-color: rgba(0, 0, 0, .2);
              }
            }
          }
        }
      }
    }

    >.left {
      gap: 10px;
      display: flex;

      @media (max-width: 1200px) {
        flex-direction: row-reverse;
      }

      @media (max-width: 550px) {
        flex-direction: column-reverse;
      }

      >form {
        margin: 0;
        width: 200px;

        @media (max-width: 550px) {
          width: 100%;
        }

        >input[type=text] {
          width: 100%;
          min-width: unset;
          border: unset;
          height: 35px;
          border-radius: 5px;
          font-size: .9em;
          margin: 0;
          background-color: $background-color-hovered;
          padding: 0 10px;
          color: $text-color;

          &::placeholder {
            color: $hovered-text-color;
          }
        }
      }
    }
  }

  &-connected~&-lang {
    @media (max-width: 1200px) {
      flex-direction: row;
      width: 100%;
    }
  }
}

.bars {
  list-style-type: none;
  min-width: 120px;
  margin: 0;
  padding: 0;

  @media(max-width: 1200px) {
    display: flex;
    flex-direction: row;
    gap: 20px;
  }

  >li>a {
    display: flex;
    color: $text-color;

    &:hover {
      color: $hovered-text-color;
    }

    >span {
      margin-left: 10px;
    }

    >i {
      width: 16px;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
}