@use 'sass:map';
@use '@tutorbook/styles/config';

.wrapper {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  min-height: config.$nav-height;
  transition: box-shadow 0.1s ease 0s;
  box-shadow: rgba(0, 0, 0, 0.1) 0px -1px 0px 0px inset;
  z-index: 4;
}

.header {
  width: 100%;
  max-width: config.$default-width;
  margin: auto;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  box-sizing: border-box;
}

.formWidth .header {
  max-width: config.$form-width;
}

.center {
  flex: 1 1 auto;
  text-align: center;
  padding: 0 24px;
  min-width: 0;
}

@media only screen and (max-width: 800px) {
  .center {
    visibility: hidden;
    display: none;
  }
}

.left,
.right {
  display: flex;
  align-items: center;
}

.avatar {
  width: config.$nav-height - 24px;
  border-radius: 4px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 0 20px;
}

.logo {
  cursor: pointer;
  padding: 20px 0;
  margin-right: 10px;
  text-decoration: none;
}

.logo span {
  color: map.get(config.$colors, 'primary');
  font-family: map.get(config.$fonts, 'sans');
  font-weight: 700;
  font-size: 24px;
  line-height: 24px;
  text-decoration: none;
}

.mobileToggle {
  width: 24px;
  height: 40px;
  display: none;
  visibility: hidden;
  justify-content: center;
  align-items: center;
  border-radius: var(--geist-radius);
  background: transparent;
  transition: background-color 0.2s ease;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  pointer-events: none;

  &:before,
  &:after {
    content: '';
    display: block;
    height: 1px;
    width: 22px;
    background-color: map.get(config.$colors, 'foreground');
    transition: transform 0.15s ease;
  }

  &:before {
    transform: translateY(-4px) rotate(0deg);
  }

  &:after {
    transform: translateY(4px) rotate(0deg);
  }
}

.toggleActive {
  &:before {
    transform: translateY(1px) rotate(45deg);
  }

  &:after {
    transform: translateY(0) rotate(-45deg);
  }
}

.mobileNav {
  display: none;
  visibility: hidden;
  max-width: 100vw;
  padding: 0 24px 24px 24px;
  background: map.get(config.$colors, 'background');
  z-index: 2000;
  position: fixed;
  right: 0;
  left: 0;
  top: config.$nav-height - 1px;
  bottom: 0;
  overflow-y: scroll;
}

.mobileNavActive {
  display: block;
  visibility: visible;
}

.mobileLinks {
  list-style: none;
  margin: 0;
  padding: 0;

  .mobileLink {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    display: block;

    .mobileLinkItem {
      cursor: pointer;
      user-select: none;
      display: flex;
      align-items: center;
      width: 100%;
      font-size: 1rem;
      height: 2 * 24px;
      border-bottom: 1px solid map.get(config.$colors, 'accents-2');
      transition: background-color 0.2s ease-in-out;
    }
  }
}

.desktopLinks {
  display: flex;
  flex-direction: row;
  opacity: 1;
  pointer-events: all;
  transition: opacity 0.1s ease;
  align-items: center;
  right: 50px;
  will-change: opacity;
  margin-left: auto;

  .desktopLink {
    font-size: 14px;
    line-height: 24px;
    font-family: map.get(config.$fonts, 'sans');
    color: map.get(config.$colors, 'accents-5');
    text-decoration: none;
    transition: color 0.2s ease-in-out;
    position: relative;
    padding: 20px 10px;
    cursor: pointer;

    &:hover {
      color: map.get(config.$colors, 'foreground');
    }

    &.active {
      color: map.get(config.$colors, 'foreground');
    }

    &.signUpLink {
      margin-right: -10px;
    }
  }
}

/*
 *@media (max-width: 675px) {
 *  .desktopLinks {
 *    display: none;
 *    visibility: hidden;
 *  }
 *
 *  .mobileToggle {
 *    display: flex;
 *    visibility: visible;
 *  }
 *}
 */
