@import "variables.scss";

html, body, #elm-container, #app, #app-body, #app-layout {
  height: 100%;
}

html, body, #elm-container, #app {
  overflow: hidden;
  overflow-x: hidden;
  overflow-y: hidden;
}

#app {
  position: relative;
}

#app-body {
  width: 100%;
}

#app-layout {
  z-index: 1;
  display: flex;
  flex-direction: row;
  padding-top: 35px;
  box-sizing: border-box;
  background-color: #f8f8f8;
  width: 100%;
}

div.main-column,
#graph-exploration {
  display: none;
  flex: 1;

  @media (#{$narrow-viewport}) {
    &.active-in-narrow-viewport {
      display: flex;
    }
  }
}

#main-nav {
  position: absolute;
  z-index: 8;
  top: 35px;
  left: 0;
  right: 0;
  padding: 10px 20px;
  border-bottom: solid 1px #ddd;
  background-color: #fff;
  animation-duration: 0.5s;

  @media (#{$narrow-viewport}) {
    &.empty {
      display: none;
    }
  }

  #navigation-content {
    max-height: 40vh;
    padding: 0 10px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

#main-flow {
  width: 100%;
  padding-left: 10px;
  padding-right: 15px;   // for main-view-switch on mobile
  overflow: hidden;
}

// workaround for chrome rendering bug
.cotonomas-loading {
  #main-flow {
    opacity: 0.99;
  }
}

#main-stock,
#main-selection,
#main-search-results {
  position: absolute;
  z-index: 3;
  top: 35px;
  left: 0;
  right: 0;
  bottom: 0;
  padding-right: 5px;   // for main-view-switch on mobile
  animation-duration: 0.5s;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;

  &.empty {
    display: none;
  }
}

div.main-traversal {
  padding-right: 5px;   // for main-view-switch on mobile
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#main-view-switch {
  z-index: 5;
  display: inline-block;
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  margin: auto;
  height: 350px;

  div.switch-button {
    margin-top: 5px;
    margin-bottom: 5px;
    height: 60px;
    border: solid 1px #ddd;
    border-radius: 6px 0 0 6px;
    border-right-style: none;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);

    i {
      width: 24px;
      text-align: center;
      font-size: 16px;
      line-height: 60px;
    }

    &.selected {
      box-shadow: none;
      background-color: #eee;
    }

    &.empty i {
      color: gray;
      opacity: 0.3;
    }
  }
}

@media (#{$wide-viewport}) {
  #app-body {
    overflow-x: hidden !important;
  }

  #app-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    margin: 0 auto !important;
    padding-right: 0;
  }

  #main-nav {
    display: block;
    position: relative;
    top: auto;
    width: 230px;
    border-right: solid 1px #ddd;
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.1);
    padding: 0;
    animation-name: none;

    a.nav-toggle-in-wide-viewport {
      position: absolute;
      top: 2px;
      right: -3px;
      z-index: 4;

      i {
        font-size: 30px;
      }
    }

    #navigation-content {
      position: absolute;
      top: 32px;
      bottom: 0;
      left: 0;
      right: 0;
      padding: 0;
      max-height: none;

      div.home-nav,
      div.owner,
      div.cotonomas {
        font-size: 90%;
      }
    }
  }

  #main-flow {
    z-index: 4;
    flex: none;
    width: 500px;
    display: flex;
    padding: 0;
    background-color: #f8f8f8;
    border-right: solid 1px #ddd;
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.1);
    position: relative;

    a.flow-toggle-in-wide-viewport {
      position: absolute;
      top: 2px;
      right: -3px;
      z-index: 5;
   
      i {
        font-size: 30px;
      }
    }

    &.tile-view {
      width: 50vw;
    }
  }

  #graph-exploration {
    flex: 1;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    background-color: #e8e8e8;
    position: relative;

    div.main-traversal {
      display: flex;
      min-width: 500px;
      max-width: 640px;
    }
  }

  #main-stock {
    flex: 1;
    position: relative;
    top: auto;
    display: flex;
    min-width: 500px;
    animation-name: none;
    overflow-y: hidden;
    background-color: #f2f2f2;
    padding: 0;
    border-right: solid 1px #ddd;
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.1);

    &.empty {
      display: flex;
    }
  }

  div.main-traversal {
    min-width: auto;
    width: auto;
    flex: 1;
    margin: 0;
    padding: 0;
    background-color: #e8e8e8;
  }

  #main-selection.active-in-wide-viewport,
  #main-search-results {
    flex: none;
    width: 500px;
    display: flex;
    position: relative;
    top: auto;
    overflow-y: hidden;
    background-color: #fdfdfd;
    border-left: solid 1px #ddd;
    box-shadow: -1px 0 3px rgba(0, 0, 0, 0.1);
    padding: 0;

    &.empty {
      display: none;
    }
  }

  div.open-column-button {
    z-index: 6;
    display: inline-block;
    position: absolute;
    width: 36px;
    height: 36px;
    background-color: #f8f8f8;
    border-right: solid 1px #ddd;
    border-bottom: solid 1px #ddd;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);

    i {
      margin-top: 8px;
      margin-left: 6px;
    }
  }

  #open-nav {
    left: 0;
    top: 35px;
  }

  #open-flow {
    left: 0;
    top: 0;

    &.second {
      left: 37px;
    }
  }

  #main-view-switch {
    display: none;
  }
}
