@import '../init/vars';
@import '../init/mixins';

.header {
  z-index: 3; // Main content uses z-index: 1, other content uses z-index: 2, this ensures it always scrolls under the header
  position: fixed;
  top: 0;
  width: 100%;
  background-color: var(--color-header-background);
  box-shadow: var(--card-box-shadow);
  font-size: var(--font-body);
  user-select: none;
  -webkit-user-select: none;
  -webkit-app-region: drag;

  .skip-button {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    margin-right: var(--spacing-l);

    &:focus {
      opacity: 1;
      position: relative;
      overflow: unset;
      width: unset;
      height: unset;
    }
  }
}

.header--minimal {
  box-shadow: none;
  background-color: var(--color-background);
  border-bottom: none;

  .header__navigation {
    padding: var(--spacing-xs) 0;
  }

  .header__navigationItem--logo {
    height: 3rem;
  }
}

.header--mac {
  padding-top: var(--mac-titlebar-height);
}

.header__contents {
  display: flex;
  align-items: center;
  flex: 1;
  height: var(--header-height);
  padding: var(--spacing-s) var(--spacing-m);

  @media (max-width: $breakpoint-small) {
    padding: var(--spacing-xs);
  }
}

.header__navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  height: var(--header-height);
  padding: var(--spacing-s) 0;
  flex-wrap: nowrap;
}

.card__actions--between {
  .header__menu--left {
    @media (max-width: $breakpoint-small) {
      max-width: 3rem;
    }
  }
}

.header__menu {
  display: flex;
  align-items: center;
}

.header__menu--left {
  @extend .header__menu;
  justify-content: flex-start;
}

.header__menu--right {
  @extend .header__menu;
  justify-content: flex-end;

  @media (max-width: $breakpoint-small) {
    max-width: 4rem;
  }
}

.header__buttons {
  display: flex;
}

.header__navigation-logo {
  height: var(--height-button);
  max-width: -webkit-fit-content;
  max-width: -moz-fit-content;
  max-width: fit-content;
}

.header__navigationItem {
  height: var(--height-button);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: var(--border-radius);
  position: relative;
  font-weight: var(--font-weight-bold);

  svg {
    stroke: var(--color-text);
  }

  &[aria-expanded='true'] {
    background-color: var(--color-header-button-active);
  }
}

.header__navigation-item--back,
.header__navigation-item--forward,
.header__navigationItem--icon {
  @extend .header__navigationItem;
  width: var(--height-button);
  background-color: var(--color-header-button);
  border-radius: 1.5rem;
  margin-right: var(--spacing-s);

  &:hover {
    background-color: var(--color-header-button-hover);
  }

  @media (min-width: $breakpoint-small) {
    &:focus {
      @include focus;
    }
  }

  @media (max-width: $breakpoint-small) {
    margin: 0;
  }

  span {
    display: flex;
    justify-content: center;
    align-items: center;
  }
}

.header__navigationItem--profilePic {
  .channel-thumbnail {
    height: var(--height-button);
    width: var(--height-button);
    margin-right: 0;
  }

  &:hover {
    opacity: 0.7;
  }
}

.header__navigationItem--balance {
  @extend .header__navigationItem;
  margin: 0 var(--spacing-s);
  color: var(--color-text);

  &:hover {
    color: var(--color-text);
  }
}

.header__navigationItem--logo {
  @extend .header__navigationItem;
  height: 4rem;
  display: flex;
  align-items: center;
  margin-left: var(--spacing-m);
  margin-right: var(--spacing-m);
  color: var(--color-text);
  // move to lbry theme?
  .lbry-icon {
    height: var(--height-button);
    width: var(--height-button);
  }
  @media (max-width: $breakpoint-small) {
    margin-right: var(--spacing-m);
    height: 5rem;

    .button__label {
      display: none;
    }
  }
}

.header__authButtons {
  display: flex;
  align-items: center;
  font-weight: var(--font-weight-bold);

  & > *:not(:last-child) {
    margin: 0 var(--spacing-m);
  }

  @media (max-width: $breakpoint-small) {
    .button--link {
      margin: 0;
    }

    .button--primary {
      padding: var(--spacing-xxs);
    }
  }
}

.header__center {
  display: flex;
  justify-content: center;
  width: 100%;
}

.header__authTitle {
  @extend .header__center;
  justify-content: center;

  @media (min-width: $breakpoint-small) {
    font-size: var(--font-large);
  }
}

.ReactModal__Overlay {
  .button--close {
    margin: 0;
    margin-top: var(--spacing-xxs);
  }
}
