/* 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/. */

html {
  width: 100%;
  height: 100%;
}

body {
  font: message-box;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  background-color: #F9F9FA;
  display: -moz-box;
  position: relative;
  -moz-box-flex: 1;
  -moz-user-focus: normal;
  -moz-box-orient: vertical;
}

input {
  font: message-box;
  font-size: 16px;
}

input[type=button] {
  cursor: pointer;
}

/* UNDO */
#newtab-undo-container {
  transition: opacity 100ms ease-out;
  -moz-box-align: center;
  -moz-box-pack: center;
  position: relative;
  left: -50%;
}

#newtab-undo-container[undo-disabled] {
  opacity: 0;
  pointer-events: none;
}

/* CUSTOMIZE */
#newtab-customize-button {
  position: absolute;
  top: 10px;
  right: 20px;
  z-index: 101;
}

#newtab-customize-button:dir(rtl) {
  left: 20px;
  right: auto;
}

/* MARGINS */
#newtab-vertical-margin {
  display: -moz-box;
  position: relative;
  -moz-box-flex: 1;
  -moz-box-orient: vertical;
}

#newtab-margin-undo-container {
  display: -moz-box;
  left: 50%;
  position: absolute;
  top: 6px;
  z-index: 1;
}

#newtab-margin-undo-container:dir(rtl) {
  left: auto;
  right: 6px;
}

#newtab-undo-close-button:dir(rtl) {
  float:left;
}

#newtab-horizontal-margin {
  display: -moz-box;
  -moz-box-flex: 1;
}

#newtab-margin-top,
#newtab-margin-bottom {
  display: -moz-box;
  position: relative;
}

#newtab-margin-top {
  -moz-box-flex: 1;
}

#newtab-margin-bottom {
  -moz-box-flex: 2;
}

.newtab-side-margin {
  min-width: 10px;
  -moz-box-flex: 1;
}

/* GRID */
#newtab-grid {
  -moz-box-flex: 5;
  overflow: hidden;
  text-align: center;
  transition: 100ms ease-out;
  transition-property: opacity;
}

#newtab-grid[page-disabled] {
  opacity: 0;
}

#newtab-grid[locked],
#newtab-grid[page-disabled] {
  pointer-events: none;
}

body:not(.compact) #topsites-heading {
  display: none;
}

/*
 * If you change the sizes here, make sure you
 * change the preferences:
 * toolkit.pageThumbs.minWidth
 * toolkit.pageThumbs.minHeight
 */
/* CELLS */
.newtab-cell {
  display: -moz-box;
  height: 210px;
  margin: 20px 10px 35px;
  width: 290px;
}

body.compact .newtab-cell {
  width: 110px;
  height: 110px;
  margin: 12px;
}

/* SITES */
.newtab-site {
  position: relative;
  -moz-box-flex: 1;
  transition: 100ms ease-out;
  transition-property: top, left, opacity;
}

.newtab-site[frozen] {
  position: absolute;
  pointer-events: none;
}

.newtab-site[dragged] {
  transition-property: none;
  z-index: 10;
}

/* LINK + THUMBNAILS */
.newtab-link,
.newtab-thumbnail {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
}

/* TITLES */
.newtab-title {
  overflow: hidden;
  position: absolute;
  right: 0;
  text-align: center;
  bottom: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.newtab-title {
  left: 0;
  padding: 0 4px;
}

/* CONTROLS */
.newtab-control {
  position: absolute;
  opacity: 0;
  transition: opacity 100ms ease-out;
}

.newtab-control:-moz-focusring,
.newtab-cell:not([ignorehover]) > .newtab-site:hover > .newtab-control {
  opacity: 1;
}

.newtab-control[dragged] {
  opacity: 0 !important;
}

@media (-moz-touch-enabled) {
  .newtab-control {
    opacity: 1;
  }
}

/* DRAG & DROP */

/*
 * This is just a temporary drag element used for dataTransfer.setDragImage()
 * so that we can use custom drag images and elements. It needs an opacity of
 * 0.01 so that the core code detects that it's in fact a visible element.
 */
.newtab-drag {
  width: 1px;
  height: 1px;
  background-color: #fff;
  opacity: 0.01;
}

/* SEARCH */
#newtab-search-container {
  display: -moz-box;
  position: relative;
  -moz-box-pack: center;
  margin: 55px 0 15px;
}

body.compact #newtab-search-container {
  margin-top: 0;
  margin-bottom: 80px;
}

#newtab-search-container[page-disabled] {
  opacity: 0;
  pointer-events: none;
}

#newtab-search-form {
  display: -moz-box;
  position: relative;
  height: 36px;
  -moz-box-flex: 1;
  max-width: 600px; /* 2 * (290 cell width + 10 cell margin) */
}

#newtab-search-icon {
  width: 35px;
  height: 35px;
  background: url("chrome://browser/skin/search-glass.svg") no-repeat 12px center/16px;
  fill: rgba(12, 12, 13, 0.4);
  -moz-context-properties: fill;
  position: absolute;
  offset-inline-start: 0;
}

#newtab-search-text {
  -moz-box-flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 3px;
  box-shadow: 0 1px 4px 0 rgba(12, 12, 13, 0.1);
  color: inherit;
  padding: 0;
  padding-inline-end: 36px;
  padding-inline-start: 35px;
  width: 100%;
  font-size: 15px;
}

#newtab-search-text:active,
#newtab-search-text:focus {
  border-color: #0A84FF;
  box-shadow: 0 0 0 2px #0A84FF;
}

#newtab-search-submit {
  offset-inline-end: 0;
  color: transparent;
  background: url("chrome://browser/skin/forward.svg") no-repeat center center;
  -moz-context-properties: fill;
  fill: rgba(12, 12, 13, 0.4);
  position: absolute;
  border: 0;
  border-radius: 0 3px 3px 0;
  background-size: 16px 16px;
  height: 100%;
  width: 36px;
}

#newtab-search-submit:dir(rtl) {
  transform: scaleX(-1);
}

#newtab-search-submit:focus, #newtab-search-submit:hover {
  background-color: rgba(12, 12, 13, 0.1);
  cursor: pointer;
}

#newtab-search-submit:active {
  background-color: rgba(12, 12, 13, 0.15);
}

/* CUSTOMIZE */
#newtab-customize-overlay {
  opacity: 0;
  display: none;
  width: 100%;
  height: 100%;
  background: #F9F9F9;
  z-index: 100;
  position: fixed;
  transition: opacity .07s linear;
}

.newtab-customize-panel-container {
  position: absolute;
  margin-right: 40px;
  right: 0;
}

.newtab-customize-panel-container:dir(rtl) {
  right: auto;
  left: 0;
}

#newtab-customize-panel {
  z-index: 999;
  margin-top: 55px;
  min-width: 270px;
  position: absolute;
  top: 100%;
  right: -25px;
  filter: drop-shadow(0 0 1px rgba(0,0,0,0.4)) drop-shadow(0 3px 4px rgba(0,0,0,0.4));
  transition: all 200ms ease-in-out;
  transform-origin: top right;
  transform: translate(-30px, -20px) scale(0) translate(30px, 20px);
}

#newtab-customize-panel:dir(rtl) {
  transform-origin: 40px top 20px;
}

#newtab-customize-panel:dir(rtl),
#newtab-customize-panel-anchor:dir(rtl) {
  left: 15px;
  right: auto;
}

#newtab-customize-panel[open="true"] {
  transform: translate(-30px, -20px) scale(1) translate(30px, 20px);
}

#newtab-customize-panel-anchor {
  width: 18px;
  height: 18px;
  background-color: white;
  transform: rotate(45deg);
  position: absolute;
  top: -6px;
  right: 15px;
}

#newtab-customize-title {
  color: #7A7A7A;
  font-size: 14px;
  background-color: #FFFFFF;
  line-height: 25px;
  padding: 15px;
  font-weight: 600;
  cursor: default;
  border-radius: 5px 5px 0px 0px;
  max-width: 300px;
  overflow: hidden;
  display: table-cell;
  border-top: none;
}

#newtab-customize-panel-inner-wrapper {
  background-color: #FFFFFF;
  border-radius: 6px;
  overflow: hidden;
}

#newtab-customize-title > label {
  cursor: default;
}

#newtab-customize-panel > .panel-arrowcontainer > .panel-arrowcontent {
  padding: 0;
}

.newtab-customize-panel-item {
  line-height: 25px;
  padding: 15px;
  padding-inline-start: 40px;
  font-size: 14px;
  cursor: pointer;
  max-width: 300px;
}

.newtab-customize-panel-item:not(:first-child) {
  border-top: 1px solid threedshadow;
}

.newtab-customize-panel-subitem > label,
.newtab-customize-panel-item > label,
.newtab-customize-complex-option {
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.newtab-customize-panel-item,
.newtab-customize-complex-option {
  display: block;
  text-align: start;
  background-color: #F9F9F9;
}

.newtab-customize-panel-item[selected]:dir(rtl){
  background-position: right 15px center;
}

.newtab-customize-complex-option:hover > .selectable:not([selected]):dir(rtl),
.selectable:not([selected]):hover:dir(rtl) {
  background-position: right 15px center;
}

.newtab-customize-panel-item:not([selected]),
.newtab-customize-panel-subitem:not([selected]){
  color: #7A7A7A;
}

.newtab-customize-panel-item:not([selected]):hover {
  color: #FFFFFF;
  background-color: #4A90E2
}

.newtab-customize-complex-option:hover > .selectable:not([selected]),
.selectable:not([selected]):hover {
  background: url("chrome://global/skin/menu/shared-menu-check-hover.svg") no-repeat #FFFFFF;
  background-size: 16px 16px;
  background-position: 15px 15px;
  color: #171F26;
}

.newtab-customize-complex-option:hover > .selectable:not([selected]) + .newtab-customize-panel-subitem {
  background-color: #FFFFFF;
}

.newtab-customize-panel-item[selected] {
  background: url("chrome://global/skin/menu/shared-menu-check-active.svg") no-repeat transparent;
  background-size: 16px 16px;
  background-position: 15px 15px;
  color: black;
  font-weight: 600;
}

.newtab-customize-panel-subitem > .checkbox {
  width: 18px;
  height: 18px;
  background-color: #FFFFFF;
  border: solid 1px threedshadow;
}

.newtab-customize-panel-subitem[selected] > .checkbox {
  background: url("chrome://global/skin/menu/shared-menu-check-black.svg") no-repeat #FFFFFF;
  background-size: 9px 9px;
  background-position: center;
  color: #333333;
}

.newtab-customize-panel-subitem {
  font-size: 12px;
  padding: 0px 15px 15px 15px;
  padding-inline-start: 40px;
  display: block;
  max-width: 300px;
}

.newtab-customize-panel-subitem > label {
  padding: 0px 10px;
  line-height: 20px;
  vertical-align: middle;
  max-width: 225px;
}

.newtab-customize-panel-superitem {
  line-height: 20px;
  border-bottom: medium none !important;
  padding: 15px 15px 10px 15px;
  padding-inline-start: 40px;
  border-top: 1px solid threedshadow;
}

.contentSearchSuggestionTable {
  font: message-box;
  font-size: 16px;
  border: 0;
  transform: translateY(2px);
}
