/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file. */

html[dir='rtl'] body.uber-frame > .page {
  -webkit-margin-end: 0;
}

body.uber-frame > .page.big-topbar-page {
  padding-top: 78px;
}

#top-container {
  margin-top: 16px;
  overflow: hidden;
}

#editing-controls,
#loading-spinner {
  white-space: nowrap;
}

#search-button {
  margin: 0;
}

#spinner {
  -webkit-margin-end: 5px;
  vertical-align: bottom;
}

#notification-bar {
  float: right;
  padding-top: 5px;
}

html[dir='rtl'] #notification-bar {
  float: left;
}

#top-container.overflow #notification-bar {
  float: left;
  margin-top: 12px;
}

html[dir='rtl'] #top-container.overflow #notification-bar {
  float: right;
}

#notification-bar span {
  display: block;
}

#notification-bar span + span {
  margin: 1em 0;
}

#filter-controls,
#top-container,
#results-display,
#results-pagination {
  max-width: 718px;
}

#filter-controls {
  display: flex;
  margin-bottom: 4px;
  margin-top: 4px;
}

#filter-controls > * {
  flex: 1;
}

#editing-controls {
  -webkit-margin-end: 12px;
  float: left;
}

html[dir='rtl'] #editing-controls {
  float: right;
}

#top-container.overflow #editing-controls {
  float: none;
}

#editing-controls button:first-of-type {
  -webkit-margin-start: 0;
}

#range-next,
#range-previous {
  background-image: url(../disclosure_triangle_small.png),
                    -webkit-linear-gradient(rgb(241, 241, 241),
                                            rgb(241, 241, 241) 38%,
                                            rgb(230, 230, 230));
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 0 2px 2px 0;
}

#range-next:disabled,
#range-previous:disabled {
  /* Change the gradient manually in order to make it look like the other
   * disabled buttons since you can't set opacity on background images only. */
  background-image: url(../disclosure_triangle_small.png),
                    -webkit-linear-gradient(rgb(231, 231, 231),
                                            rgb(231, 231, 231) 38%,
                                            rgb(220, 220, 220));
  border-color: rgba(67, 67, 67, 0.5);
  opacity: 0.5;
}

html[dir='rtl'] #range-today,
html[dir='rtl'] #range-previous,
html[dir='rtl'] #range-next {
  float: right;
}

html[dir='rtl'] #range-next,
#range-previous {
  -webkit-transform: scalex(-1);
}

html[dir='rtl'] #range-previous {
  -webkit-transform: scaleX(1);
}

#range-today {
  -webkit-margin-end: 10px;
}

#range-today,
#range-previous,
#range-next {
  float: left;
  height: 26px;
  padding-bottom: 4px;
  padding-top: 4px;
}

#range-next {
  -webkit-margin-start: -1px;
}

#range-previous {
  -webkit-margin-end: 0;
}

#timeframe-controls {
  display: flex;
  justify-content: flex-end;
}

#timeframe-controls input[type='radio'] {
  background-color: buttonface;
  background-image: -webkit-linear-gradient(rgb(237, 237, 237),
                                            rgb(237, 237, 237) 38%,
                                            rgb(222, 222, 222));
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 0;
  bottom: auto;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08),
              inset 0 1px 2px rgba(255, 255, 255, 0.75);
  box-sizing: border-box;
  color: rgb(68, 68, 68);
  display: inline-block;
  height: 100%;
  letter-spacing: normal;
  line-height: 2em;
  margin: 0;
  min-height: 2em;
  min-width: 4em;
  text-align: center;
  text-indent: 0;
  text-shadow: 0 1px 0 rgb(240, 240, 240);
  text-transform: none;
  vertical-align: middle;
  width: auto;
  word-spacing: normal;
}

#timeframe-controls input[type='radio']:not(:first-of-type) {
  -webkit-border-start-width: 0;
}

#timeframe-controls input[type='radio']:not(:first-of-type):focus {
  -webkit-border-start-width: 1px;
  -webkit-margin-start: -1px;
}

html[dir='ltr'] #timeframe-controls input[type='radio']:first-of-type,
html[dir='rtl'] #timeframe-controls input[type='radio']:last-of-type {
  border-bottom-left-radius: 2px;
  border-top-left-radius: 2px;
}

html[dir='ltr'] #timeframe-controls input[type='radio']:last-of-type,
html[dir='rtl'] #timeframe-controls input[type='radio']:first-of-type {
  border-bottom-right-radius: 2px;
  border-top-right-radius: 2px;
}

#timeframe-controls input[type='radio']:checked {
  background-image: -webkit-linear-gradient(rgb(185, 185, 185),
                                            rgb(216, 216, 216) 38%,
                                            rgb(167, 167, 167));
}

#timeframe-controls input[type='radio']:focus {
  border-color: rgb(77, 144, 254);
}

#timeframe-controls input[type='radio']::before {
  display: none;  /* Hide the ( )/(O). */
}

#timeframe-controls input[type='radio']::after {
  content: attr(aria-label);
  padding: 0 1em;
}

#results-display {
  margin: 16px 0 0 0;
}

.edit-button {
  -webkit-appearance: none;
  background: none;
  border: 0;
  color: blue; /* -webkit-link makes it purple :'( */
  cursor: pointer;
  display: inline-block;
  font: inherit;
  padding: 0 9px;
  text-decoration: underline;
}

.entry,
.gap,
.no-entries,
.site-entry {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gap {
  -webkit-border-end: 1px solid rgb(192, 195, 198);
  height: 14px;
  margin: 1px 0;
  width: 45px;
}

.no-checkboxes .gap {
  width: 25px;
}

.entry-box,
.site-domain-row {
  align-items: center;
  display: flex;
  margin-bottom: 6px;
  /* The box should be no bigger than its parent. */
  max-width: 100%;
  min-height: 2em;
  overflow: hidden;
  padding-bottom: 1px;
}

.entry-box {
  /* Ensures a consistent baseline on all platforms. */
  line-height: 1.75em;
}

.site-domain-wrapper {
  cursor: pointer;
  display: flex;
  width: 100%;
}

.search-results,
.day-results {
  margin: 0 0 24px 0;
  padding: 0;
}

.site-results {
  -webkit-transition: height 350ms ease-in-out;
  clear: left;
  margin: 0;
  overflow: hidden;
  padding: 0;
}

.site-results.grouped {
  -webkit-padding-start: 18px;
}

.no-checkboxes .site-results.grouped {
  -webkit-padding-start: 21px;
}

.month-results {
  -webkit-padding-start: 0;
}

html[dir='rtl'] .site-results {
  clear: both;
}

h2.timeframe {
  font-size: 1.5em;
}

.entry .domain {
  -webkit-padding-end: 6px;
  -webkit-padding-start: 2px;
  color: rgb(151, 156, 160);
  min-width: -webkit-min-content;
  overflow: hidden;
  white-space: nowrap;
}

.site-results .domain {
  display: none;
}

html[dir='rtl'] .number-visits {
  /* This element contains parentheses, which without the unicode-bidi: embed
   * directive would show up incorrectly (e.g. '(www.google.com (5'). Using
   * 'embed' makes the engine set the text in the parentheses as LTR even
   * when the layout is set to RTL, which makes using -webkit-*-start
   * impossible. So use margins and dir='rtl'. */
  direction: rtl;
  unicode-bidi: embed;
}

.number-visits {
  color: rgb(151, 156, 160);
}

.drop-down {
  margin-top: 1px;
}

.entry .time {
  color: rgb(151, 156, 160);
  max-width: 90px;
  min-width: -webkit-min-content;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry input[type='checkbox'],
.site-domain-row input[type='checkbox'] {
  -webkit-margin-end: 6px;
  line-height: 1em;
  min-width: 13px;
  top: 0;
}

<if expr="not is_android">
.site-domain-wrapper:hover input[type='checkbox']:not(:focus),
.site-domain-wrapper input[type='checkbox']:not(:focus):checked,
.entry-box:hover input[type='checkbox']:not(:focus),
.entry-box input[type='checkbox']:not(:focus):checked {
  border-color: rgba(0, 0, 0, .5);
}

.site-domain-wrapper:hover .site-domain-row,
.entry-box:hover {
  background-color: rgba(0, 0, 0, .025);
}

.filter-status {
  -webkit-margin-start: 10px;
}

.filter-status > div {
  flex: 0 0 auto;
  -webkit-transition: background-color 150ms;
  border-radius: 3px;
  display: none;
  font-size: 11px;
  height: 14px;
  line-height: 12px;
  white-space: nowrap;
}

.filter-status > div.filter-allowed,
.filter-status > div.filter-blocked,
.filter-status > div.in-content-pack-active,
.filter-status > div.in-content-pack-passive,
.filter-status > div.blocked-visit-active {
  display: block;
  margin: 3px 3px 3px 0;
  padding: 0 4px;
}

.filter-allowed,
.in-content-pack-active {
  background-color: rgb(141, 240, 127);
  border: 1px solid rgb(33, 190, 33);
  color: rgb(54, 54, 54);
}

.filter-blocked {
  border: 1px solid rgb(207, 207, 207);
  background-color: rgb(231, 231, 231);
  color: rgb(54, 54, 54);
}

.in-content-pack-passive {
  border: 1px solid rgb(155, 224, 163);
  background-color: rgb(225, 255, 205);
  color: rgb(148, 148, 148);
}
</if>

.entry-box,
.site-domain-row {
  -webkit-padding-end: 6px;
  -webkit-padding-start: 6px;
  border-radius: 2px;
}

.entry-box > div,
.site-domain-row > div {
  min-width: 0;
}

.focus-row-active :-webkit-any(.entry-box, .site-domain-row) {
  background-color: rgba(0, 0, 0, .05);
}

.entry-box-container {
  display: flex;
}

.entry .visit-entry {
  display: flex;
  min-width: 0;
}

.entry .title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* TODO(sergiu): If this is the final icon replace it with a separate resource.
 */
.entry .blocked-indicator {
  -webkit-padding-start: 4px;  /* For <a> padding. */
}

.blocked-indicator .title {
  color: rgb(151, 156, 160);
}

.blocked-icon {
  background-image: url(../ssl/images/roadblock.png)
}

.favicon {
  background-position-y: center;
  background-repeat: no-repeat;
  background-size: 16px;
  flex-shrink: 0;
  height: 16px;
  width: 16px;
}

.site-domain button:hover {
  text-decoration: none;
}

.site-domain-arrow {
  -webkit-transform: rotate(0);
  -webkit-transition: -webkit-transform 300ms linear;
  background: url(../disclosure_triangle_small.png) no-repeat;
  background-position: 5px 5px;
  color: rgb(143, 143, 143);
  height: 21px;
  margin-right: 2px;
  opacity: 0.58;
  text-align: center;
  width: 21px;
}

html[dir='rtl'] .site-domain-arrow {
  -webkit-transform: rotate(180deg);
}

html .expand .site-domain-arrow {
  -webkit-transform: rotate(90deg);
}

.entry .bookmark-section {
  -webkit-margin-end: 3px;
  -webkit-margin-start: 8px;
  background: no-repeat center
      url(../../../../ui/webui/resources/images/star_small.png);
  border: none;
  display: inline-block;
  height: 15px;
  min-width: 15px;
  visibility: hidden;
}

.entry .starred {
  visibility: visible;
}

.entry .title > a,
.site-domain [is='action-link'] {
  color: rgb(48, 57, 66);
  margin: 2px;
  padding: 2px;
  /* Focus outlines are rendered differently for each platform. */
<if expr="is_macosx">
  margin: 4px;
  padding: 0;
</if>
<if expr="is_win">
  padding: 0 2px;
</if>
  text-decoration: none;
}

.entry .title > a.to-be-removed {
  text-decoration: line-through;
}

.entry .title > a:hover {
  text-decoration: underline;
}

.fade-out {
  -webkit-transition: opacity 200ms;
  opacity: 0;
}

button.menu-button.drop-down {
  -webkit-margin-end: 0;
  min-width: 12px;
  top: 0;
}

#action-menu > [role=menuitem] {
  line-height: 29px;
  outline: none;
}

body:not(.has-results) #results-pagination {
  display: none;
}

#older-button {
  float: right;
}

html[dir='rtl'] #older-button {
  float: left;
}

html[dir='ltr'] #newest-button::before {
  /* Left-pointing double angle quotation mark followed by '&nbsp;'. */
  content: '\00AB\A0';
}

html[dir='rtl'] #newest-button::after {
  /* '&nbsp;' followed by right-pointing double angle quotation mark. */
  content: '\A0\00BB';
}

html[dir='ltr'] #newer-button::before,
html[dir='rtl'] #older-button::before {
  /* Single left-pointing angle quotation mark followed by '&nbsp;'. */
  content: '\2039\A0';
}

html[dir='ltr'] #older-button::after,
html[dir='rtl'] #newer-button::after {
  /* 'nbsp;' followed by single right-pointing angle quotation mark. */
  content: '\A0\203A';
}

/* Clear the float to ensure that #results-pagination encloses its children. */
#results-pagination::after {
  clear: both;
  content: '';
  display: block;
  height: 0;
  visibility: hidden;
}

/* Styles for the action menu of visits that come from other devices, triggered
   by setting the "data-devicename" attribute of the menu. */

#action-menu[data-devicename]:not([data-devicename='']) {
  padding-top: 0;
}

#action-menu[data-devicename]::before {
  background-color: rgb(245, 245, 245);
  background-position: 18px center;
  background-repeat: no-repeat;
  background-size: 24px;
  border-bottom: 1px solid rgb(232, 232, 232);
  color: rgb(151, 156, 160);
  content: attr(data-devicename);
  display: block;
  font-size: 11px;
  line-height: 29px;
  margin-bottom: 8px;
  padding: 0 19px 0 51px;
}

#action-menu[data-devicename='']::before {
  display: none;
}

#action-menu[data-devicetype='laptop']::before {
  background-image: url(../../../../ui/webui/resources/images/laptop.svg);
}

#action-menu[data-devicetype='phone']::before {
  background-image: url(../../../../ui/webui/resources/images/smartphone.svg);
  background-position: 14px center;
  padding-left: 43px;
}

#action-menu[data-devicetype='tablet']::before {
  background-image: url(../../../../ui/webui/resources/images/tablet.svg);
}
