/* 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;
  // undo global override from common.less
  // and allow typography to flow from parent to descendent
  font-family: inherit;
  font-weight: inherit;
}

// match private tab js-css values
@newTabAnimationDuration: 0.5s;
@newTabAnimationEasing: ease-out;

strong, div, span, li, em, p, a {
  font-family: inherit;
  font-weight: inherit;
  -webkit-font-smoothing: antialiased; // light text on dark backgrounds on macOS looks better with this
}

.newTabDashboard
{
    // default typography if not specified in element ancestor hierarchy
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-weight: 400;
    animation: fadeIn;
    animation-duration: .3s;
    animation-timing-function: ease-out;
}

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

a {
  text-decoration: none;
}

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

.dynamicBackground {
  display: flex;
  flex: 1;
}

.imageBackground {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity .5s ease-in-out;
  }
  &.hasLoaded img {
    opacity: 1;
  }
}

.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;
  background: transparent;
  background: radial-gradient(circle farthest-corner at right bottom,#ff4444 0,rgb(9, 14, 160) 100%);
  &.showImages {
    background: linear-gradient(to bottom, rgba(34, 34, 34, 1) 0%, rgba(0, 0, 0, 0) 400px);
  }

  .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 {
      max-width: 510px;
      display: inline-block;
      text-align: left;
      width: 100%;

      .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;
          }
        }
      }
    }

    .deprecationNotice {
      border-radius: @borderRadius;
      box-shadow: 2px 2px 6px rgba(0,0,0,0.5);
      background-color: #fff;
      margin-top: 20px;
      max-width: 505px;
      width: 100%;
      display: inline-block;
      padding: 20px;
      text-align: left;

      .note {
        color: @braveOrange;
      }

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

      .fa-close {
        color: @statsRed;
        border: 0;
        background-color: transparent;
        float: right;

        &:hover {
          color: #000;
        }
      }
    }
  }

  .siteRemovalNotification {
    @typography-display();
    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 {
      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 {
        @typography-display();

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

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

      .photoName {
        color: @white50;
        @typography-display();
        letter-spacing: @typographyDisplayMediumSpacing;
        font-size: 23px;
      }
    }

    .shortcutsContainer {
      display: flex;

      .shortcutIcon {
        display: flex;
        width: 35px;
        height: 35px;
        margin: 15px 5px;
        cursor: default;
        border: solid 1px transparent;
        transition: border-color .12s ease;
        position: relative;
        border-radius: 3px;
        &:after {
          -webkit-mask-repeat: no-repeat;
          position: absolute;
          content: ' ';
          background-color: white;
          top: 0;
          left: 0;
          right: 0;
          bottom: 0;
        }
        &:hover {
          border-color: white;
        }

        &:active {
          opacity: .8;
        }

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

.statsBar {
  @typography-display();
  width: 100%;
  padding: 40px 0;
  display: flex;
  justify-content: space-between;

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

    span {
      display: block;
    }

    .counter {
      letter-spacing: @typographyDisplayLargeSpacing;
      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;
        letter-spacing: 0;
        line-height: 24px;
        margin-left: 3px;
      }
    }

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

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

    .time {
      letter-spacing: 0;
      font-size: 75px;
      font-weight: 200;
      color: #fff;
      display: inline-flex;
    }

    .timePeriod {
      color: #fff;
      display: inline-block;
      font-size: 20px;
      letter-spacing: @typographyDisplayMediumSpacing;
      font-weight: 400;
      margin-top: 8px;
      margin-left: 3px;
      vertical-align: top;
    }

    .timeSeparator {
      color: #fff;
      // center colon vertically in the text-content line
      margin-top: -0.1em;
    }

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


@media (max-width: 730px) {
  .dynamicBackground {
    min-height: 100%;
    height: initial !important;
  }

  .content {
    min-height: 100%;

    main {
      margin-bottom: 20px;
    }

    .topSitesContainer {
      text-align: center;
      padding-bottom: 20px;
    }
  }

  .statsBar {
    flex-direction: column-reverse;
    padding-top: 0;

    .statsBlock {
      margin: 0 0 15px;
      width: 50%;
      padding-right: 20px;
    }

    .clock {
      display: flex;
      flex: 1;
      justify-content: center;
      padding-bottom: 20px;
    }
  }
}

.obsolete {
  height: auto !important;
  min-height: 100vh;
  padding: 64px 62px;
  background-color: #000000;
  background-image: url(/img/browserObsoletePage/fireworks.jpg);
  background-position: 0 0;
  background-size: 1820px auto;
  background-repeat: no-repeat;
  color: white;
}

.obsolete_logo {
  margin-bottom: 100px;
  width: 174px;
  img {
    width: 100%;
    height: auto;
  }
}

.obsolete_title {
  margin-bottom: 30px;
  font: 600 36px/1 Poppins;
  color: inherit;
}
.obsolete_paragraph {
  margin-bottom: 40px;
  font: 400 18px/30px Muli;
  max-width: 520px;
  color: inherit;
}

.obsolete_learn-more-link {
  margin-left: 44px;
  color: white;
  text-decoration: none;
  white-space: nowrap;
  &:hover {
    text-decoration: underline;
  }
}

.obsolete_title,
.obsolete_paragraph,
.obsolete_actions {
  margin-left: 60px;
}
