/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

@import "animations.less";
@import "variables.less";

:root {
  --default-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  font-family: var(--default-font-family);
}

html,
#window {
  background: #fff;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  width: 100%;

  &.isFullScreen {
    .top, .downloadsBar, .hrefPreview {
      display: none;
    }
  }
}

#windowContainer {
  width: 100%;
  height: 100%;
  position: absolute;
}

.top {
    background: linear-gradient(to bottom, #fbfbfb, #ededed, );
}

.mainContainer {
  display: flex;
  flex-direction: row;
  flex-grow: 1;
  width: 100%;

  .tabContainer {
    flex-grow: 1;
    position: relative;
  }
  >div.tabs {
    width: 180px;
    overflow-y: scroll;
  }
}

.frameWrapper {
  height: 100%;
  width: 100%;
  z-index: @zindexWindow;
  position: absolute;
  top: 0;
  left: 0;

  .fullScreenModeWarning {
    background: #3a3a3a;
    color: white;
    font-size: larger;
    left: 0;
    margin-left: auto;
    margin-right: auto;
    padding: 20px;
    position: absolute;
    right: 0;
    text-align: center;
  }

  // Needed to be able to click and drag to select content in pages.
  -webkit-user-select: none;

  webview {
    background-color: #fff;
    border: 0;
    height: 100%;
    outline: none;
    width: 100%;
  }

  .webviewContainer {
    height: 100%;
    width: 100%;
    &.isPreview {
      opacity: 0.5;
      animation: tabFadeIn 0.75s ease-in-out;
      animation-fill-mode: forwards;
    }
  }

  &:not(.isActive) {
    z-index: @zindexWindowNotActive;

    &.isPreview {
      background: gray;
      z-index: @zindexWindowIsPreview;
    }

    // Webviews can cause flickers w/ Chrome  v49 if left visible
    // in the background.  This also has a major benefit for background
    // tabs that have video and animations in them.
    &:not(.isPreview) {
      visibility: hidden;
    }
  }
}

.hrefPreview {
  background: @chromePrimary;
  border-color: @chromeSecondary;
  border-style: solid;
  border-width: 1px 1px 0 0;
  border-top-right-radius: @borderRadius;
  bottom: 0;
  color: @chromeText;
  font-size: @defaultFontSize;
  left: 0;
  max-width: 40%;
  overflow-x: hidden;
  padding: 0.2em 0.5em;
  position: absolute;
  text-overflow: ellipsis;
  white-space: nowrap;

  &.right {
    left: auto;
    right: 0;
    border-width: 1px 0 0 1px;
    border-top-left-radius: @borderRadius;
    border-top-right-radius: 0;
  }
}

body.fullScreen .frameWrapper.isActive {
  z-index: @zindexWindowFullScreen;
}

/* The fullscreen notice is shown above the fullscreen element */
body.fullScreen .banner {
  position: absolute;
  z-index: @zindexWindowFullScreenBanner;
  top: 0;
  opacity: 1;
  transition: opacity 2s ease-in-out;
}

body.fullScreen .banner.fade {
  opacity: 0;
}

[draggable] {
  -webkit-user-select: none;
 }

.link {
  color: @linkColor;
  cursor: pointer;
  text-decoration: underline;
}

// In React we often want to have elements but without href, so force pointer cursor
a {
  cursor: pointer;
}
