/* 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 "./common.less";

* {
  box-sizing: border-box;
}


strong, div, span, li, em, p, a {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

body {
  background: #fff;
}

body, .dynamicBackground, .gradient {
  opacity: 0;
  animation: fadeIn 200ms;
  animation-fill-mode: forwards;
}

.copyrightNotice {
  -webkit-user-select: none;
  cursor: default;
}

a {
  text-decoration: none;
}

ul {
  display: inline-block;
  li {
    display: inline-block;
    vertical-align: middle;
    list-style-type: none;
  }
}

#appContainer > div {
  height: auto; // overrides default #appContainer > div: 100%
}

.dynamicBackground {
  background-position: top center;
  background-repeat: no-repeat;
  background-size: cover;
  display: flex;
  flex: 1;
  > img {
    display: none;
  }
}

.gradient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
  height: 400px;
}

.content {
  position: relative;
  z-index: 2;
  top: 0;
  left: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  min-height: 100vh;
  padding: 40px 60px;

  .statsBar {
    padding: 40px 0;
    display: flex;
    justify-content: space-between;

    .statsBlock {
      margin-right: 40px;
      margin-bottom: 20px;

      span {
        display: block;
      }

      .counter {
        font-size: 44px;
        line-height: 53px;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        max-width: 200px;

        &.trackers {
          color: @statsOrange;
        }
        &.ads {
          color: @statsRed;
        }
        &.https {
          color: @statsBlue;
        }
        &.timeSaved {
          color: @statsLightGray;
          display: flex;
          align-items: baseline;
        }

        .text {
          display: inline;
          color: @statsLightGray;
          font-size: 20px;
          line-height: 24px;
          margin-left: 3px;
        }
      }

      .statsText {
        font-size: 13px;
        color: #fff;
      }
    }

    .clock {
      line-height: 1;
      -webkit-user-select: none;
      cursor: default;

      .time {
        font-size: 75px;
        font-weight: 200;
        color: #fff;
      }

      .timePeriod {
        color: #fff;
        display: inline-block;
        font-size: 20px;
        font-weight: 400;
        margin-top: 6px;
        vertical-align: top;
      }

      .dayTime {
        font-size: 51px;
        color: #fff;
      }
    }
  }

  .topSitesContainer {
    width: 100%;
    text-align: right;

    .toggleTopSitesGridIcon {
      outline: none;
      background: 0 0 / contain no-repeat;
      display: flex;
      border: 0;
      margin-left: auto;
      width: 30px;
      height: 30px;
      font-size: 30px;
      margin-bottom: 20px;
      transition: @transitionFast;
      cursor: default;

      &.hasThreeRows {
        background: url('/img/newtab/topsites_btn_3.svg');
      }
      &.hasTwoRows {
        background: url('/img/newtab/topsites_btn_2.svg');
      }
      &.hasOneRow {
        background: url('/img/newtab/topsites_btn_1.svg');
      }
    }

    .topSitesGrid {
      width: 510px;
      display: inline-block;
      text-align: left;

      .topSiteSquareSpace {
        margin-left: 5px;
        margin-bottom: 5px;
        display: inline-block;
        vertical-align: middle;
      }

      .topSitesElement {
        transition: @transitionFast;
        position: relative;
        box-shadow: 2px 2px 6px rgba(0,0,0,0.5);
        border-radius: 4px;

        &:hover {
          box-shadow: 3px 3px 9px rgba(0, 0, 0, 0.8);

          .topSitesActionContainer {
            visibility: visible;
            opacity: 1;
          }
        }

        .topSitesActionContainer {
          transition: @transitionFast;
          visibility: hidden;
          opacity: 0;
          position: absolute;
          z-index: 3;
          top: 3px;
          left: 0;
          right: 0;
          margin: auto;
          padding: 3px;
          max-width: 90%;
          display: flex;
          justify-content: space-between;
          background-color: rgba(255, 255, 255, 0.5);
          border-radius: @borderRadius;

          .topSitesActionBtn {
            transition: @transitionFast;
            width: 14px;
            height: 14px;
            font-size: 14px;
            outline: none;
            border: none;
            background-color: transparent;
            color: @black50;
            &:hover {
              color: black;
            }
          }
        }

        .topSitesElementFavicon {
          position: relative;
          background-color: @defaultIconBackground;
          border-radius: @borderRadius;
          color: @gray;
          display: flex;
          align-items: center;
          justify-content: center;
          width: 80px;
          height: 80px;
          font-size: 38px;

          // Add an opacity layer on top of tile
          // to avoid backgrounds with the same color as icon
          // (as seen on issue #5868)
          &:before {
              content: '';
              position: absolute;
              top: 0;
              left: 0;
              width: 100%;
              height: 100%;
              background-color: #fff;
              opacity: 0.15;
              z-index: 0;
              border-radius: 4px;
          }

          .pinnedTopSite {
            transition: @transitionFast;
            opacity: 1;
            visibility: visible;
            position: absolute;
            top: 4px;
            left: 4px;
            width: 20px;
            height: 20px;
            background-color: @gray25;
            border-radius: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2;

            .pin {
              font-size: 10px;
              color: black;
            }

          }
          img {
            position: relative;
            z-index: 1;
            max-width: 64px;
            max-height: 64px;
          }
        }
        &:hover {
          .pinnedTopSite {
            opacity: 0;
            visibility: hidden;
          }
        }
      }
    }
  }

  .siteRemovalNotification {
    border-radius: @borderRadius;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.5);
    background-color: #fff;
    width: 500px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;

    .notification {
      -webkit-user-select: none;
      cursor: default;
    }

    .notificationText, .siteRemovalAction {
      margin: 0 6px;
    }

    .siteRemovalAction {
      color: @braveOrange;
      text-decoration: underline;
      cursor: pointer;
    }

    .fa-close {
      color: @statsRed;
      margin-left: 12px;
      border: 0;
      background-color: transparent;
    }
  }

  .footerContainer {
    display: flex;
    justify-content: space-between;

    .copyrightNotice {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      justify-content: center;
      line-height: 1.3;

      .copyrightCredits {
        &, .photoBy, .copyrightOwner {
          color: #fff;
          font-size: 13px;
          text-transform: uppercase;
        }

        .copyrightOwner {
          text-decoration: underline;
        }
        .copyRightYear {
          position: relative;
          &:after {
            position: absolute;
            right: 0;
            content: '©';
          }
        }
      }

      .photoName {
        color: @white50;
        font-size: 23px;
      }
    }

    .shortcutsContainer {
      display: flex;

      .shortcutIcon {
        display: flex;
        width: 35px;
        height: 35px;
        margin: 15px 5px;
        cursor: default;
        background-color: white;
        -webkit-mask-repeat: no-repeat;

        &:hover {
          background-color: @gray;
        }

        &.settingsIcon {
          -webkit-mask-image: url('/img/newtab/settings_prefs_btn.svg');
        }
        &.bookmarksIcon {
          -webkit-mask-image: url('/img/newtab/bookmarks_btn.svg');
        }
        &.historyIcon {
          -webkit-mask-image: url('/img/newtab/history_btn.svg');
        }
      }
    }
  }
}
