/*
 * Copyright (C) 2017-2019 Dremio Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

:global {
  .sideNav {
    background-color: var(--fill--nav--sonar);
    display: flex;
    flex-direction: column;
    width: 64px;

    a:hover,
    .link:hover,
    a:focus,
    .link:focus {
      text-decoration: none !important;
    }

    .skipToContent {
      border: 0;
      height: 0;
      margin: -1px;
      overflow: hidden;
      padding: 0;
      position: absolute;
      width: 0;
      opacity: 0;

      &:focus-visible {
        z-index: 10000;
        height: auto;
        margin: 0;
        overflow: visible;
        padding: 4px 8px;
        position: absolute;
        width: auto;
        opacity: 1;
        background-color: var(--fill--primary);
        border-radius: 4px;
      }
    }
  }

  .sideNav-item {
    width: 64px;
    height: 64px;

    .sideNav-item-a {
      &:focus-visible {
        outline: -webkit-focus-ring-color auto 1px !important;
      }
    }

    .sideNav-item__link,
    .sideNav-item__hoverMenu {
      width: 100%;
      height: 64px;
      display: flex;
      justify-content: center;
      align-items: center;
      cursor: pointer;

      &.--menuDisplayed,
      &:focus-within {
        background-color: var(--selected--nav--sonar);
      }

      &.--active {
        background-color: var(--selected--nav--sonar);
      }
    }

    .sideNav-item__icon {
      color: var(--icon--nav);

      dremio-icon {
        width: 24px;
        height: 24px;
      }
    }

    .sideNav-item__caret-icon {
      height: 12px;
      width: 12px;
      color: var(--icon--nav);
      right: 7px;
      bottom: 7px;
      position: absolute;
    }

    .sideNav-item__logo {
      dremio-icon {
        width: 40px;
        height: 40px;
      }
    }

    .sideNav-item__customHoverMenu {
      &.--wide {
        width: 224px;
      }

      &.--active {
        background-color: var(--selected--nav--sonar);
        color: white !important;

        &:hover,
        &:focus-within {
          background-color: var(--selected--nav--sonar);
        }
      }

      .sideNav__customOuter {
        display: flex;
        align-items: center;
        justify-content: center;

        .sideNav__project {
          font-size: 13px;
          line-height: 24px;
          background-color: var(--color--brand--300);
          color: var(--color--navy--700);
          border-radius: 2px;
          width: 24px;
          height: 24px;
          text-align: center;
          display: flex;
          justify-content: center;
          align-items: center;
        }
      }
    }
  }

  .sideNav__topSection {
    width: inherit;
    align-items: start;
    flex: 1;

    .sideNav-item:nth-child(2) {
      a:focus-visible .sideNav-item__link {
        outline: -webkit-focus-ring-color auto 1px !important;
      }
    }
  }

  .sideNav__bottomSection {
    align-self: flex-end;
    margin-bottom: 10px;
    width: inherit;

    &__divider {
      width: 48px;
      height: 1px;
      background-color: var(--color--neutral--200);
      margin: auto;
    }
  }

  .item__hover {
    &:hover,
    &:focus-within {
      background-color: var(--hover--nav--sonar);
    }
  }

  .socket__notOpen {
    filter: saturate(0);
  }

  .sideNav__user {
    font-size: 13px;
    line-height: 24px;
    background-color: var(--color--brand--300);
    color: var(--color--navy--700);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}

// sonar is default theme, above
:global {
  .sideNav {
    // organization theme
    &--organization {
      background-color: var(--fill--nav--org);

      .sideNav-item {
        &:focus-within {
          background-color: transparent;
        }
      }

      .sideNav-item__icon {
        color: var(--icon--nav--org) !important;
      }

      .sideNav-item__caret-icon {
        color: var(--icon--nav--org) !important;
      }

      .sideNav-item__link,
      .sideNav-item__hoverMenu {
        &.--menuDisplayed {
          background-color: var(--hover--nav--org);
        }

        &.--active {
          background-color: var(--selected--nav--org);
        }
      }

      .left-nav-popover {
        &[aria-expanded="true"],
        &:focus-visible {
          background-color: var(--hover--nav--org);
        }
      }

      .item__hover {
        &:hover {
          background-color: var(--hover--nav--org);
        }
      }

      .--active-light {
        background-color: var(--selected--nav--org);
      }
    }

    // arctic theme
    &--arctic {
      background-color: var(--fill--nav--catalog);

      .sideNav-item {
        &:focus-within {
          background-color: transparent;
        }
      }

      .sideNav-item__link,
      .sideNav-item__hoverMenu {
        &.--menuDisplayed {
          background-color: var(--hover--nav--catalog);
        }

        &.--active {
          background-color: var(--selected--nav--catalog);
        }
      }

      .item__hover {
        &:hover {
          background-color: var(--hover--nav--catalog);
        }
      }

      .left-nav-popover {
        &[aria-expanded="true"],
        &:focus-visible {
          background-color: var(--selected--nav--catalog);
        }
      }
    }
  }
}
