/*
 * Copyright (C) 2013 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
 */

.find-banner {
    border-bottom: 1px solid var(--border-color);

    position: absolute;
    top: -22px;
    left: 0;
    right: 0;
    height: 22px;

    text-align: right;

    white-space: nowrap;
    overflow: hidden;

    transition-property: top;
    transition-duration: 200ms;
    transition-timing-function: ease-in;

    z-index: var(--z-index-header);
}

.find-banner.showing {
    top: 0;
    transition-timing-function: ease-out;
}

.no-find-banner-transition:matches(.find-banner, .supports-find-banner) {
    transition-duration: 0 !important;
}

.supports-find-banner {
    transition-property: top;
    transition-duration: 200ms;
    transition-timing-function: ease-in;
}

.supports-find-banner.showing-find-banner {
    top: 22px !important;
    transition-timing-function: ease-out;
}

.find-banner > :first-child {
    margin-left: 8px !important;
}

.find-banner > :last-child {
    margin-right: 8px !important;
}

.find-banner > input[type="search"] {
    margin: 1px -1px 1px 6px;

    width: 30vw;
    min-width: 143px;
    max-width: 210px;
    height: 19px;
    vertical-align: top;

    -webkit-appearance: none;

    outline: none;

    border: 1px solid var(--border-color);
    border-radius: 4px 0 0 4px;
    background-color: white;
}

.find-banner > button {
    margin: 1px 4px;

    padding-left: 6px;
    padding-right: 6px;

    -webkit-appearance: none;

    border-radius: 4px;
    border: 1px solid var(--border-color);
    color: var(--glyph-color);
    background-color: var(--button-background-color);

    line-height: 11px;

    height: 19px;

    text-align: center;
    vertical-align: top;

    outline-offset: -2px;
}

.find-banner > button > .glyph {
    display: inline-block;

    width: 7px;
    height: 11px;
}

.find-banner > button:disabled > .glyph {
    opacity: 0.4;
}

.find-banner > button:active:not(:disabled) {
    border: 1px solid var(--border-color-dark);
    background-color: var(--button-background-color-pressed);
}

.find-banner > button.segmented {
    margin: 1px 0;
}

.find-banner > button.segmented.left {
    border-radius: 0;
    border-right: none;
}

.find-banner > button:not(:active).segmented.right:before {
    content: "";
    position: relative;
    display: block;
    float: left;
    width: 1px;
    height: 13px;
    right: 6px;
    top: -1px;
    background-color: var(--border-color);
}

.find-banner > button.segmented.left:active + button.segmented.right,
.find-banner > button.segmented.right:active {
    border-left: solid 1px var(--border-color-dark);
}

.find-banner > button.segmented.left:active + button.segmented.right:before {
    display: none;
}

.find-banner > button.segmented.left > .glyph {
    background-image: url(../Images/BackForwardArrows.svg#back-arrow-normal);
}

.find-banner > button.segmented.left:active:not(:disabled) > .glyph {
    background-image: url(../Images/BackForwardArrows.svg#back-arrow-active);
}

.find-banner > button.segmented.right {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
    border-left: none;
}

.find-banner > button.segmented.right > .glyph {
    background-image: url(../Images/BackForwardArrows.svg#forward-arrow-normal);
    margin-left: 1px;
}

.find-banner > button.segmented.right:active:not(:disabled) > .glyph {
    background-image: url(../Images/BackForwardArrows.svg#forward-arrow-active);
}

.find-banner > button.segmented {
    min-width: 22px;
    padding: 3px 6px 2px;
}

.find-banner > button.segmented > .glyph {
    background-size: 7px 11px;
    background-repeat: no-repeat;
}

.find-banner > label {
    margin: 0 6px;
    line-height: 21px;
}

.find-banner.console-find-banner {
    position: relative;
    top: auto;
    border: 0;
}

body .find-banner.console-find-banner {
    flex-wrap: nowrap;
}

.find-banner.console-find-banner > input[type="search"] {
    padding-top: 0;
    outline: none;
    border: 1px solid hsla(0, 0%, 0%, 0.35);
    border-radius: 3px 0 0 3px;
    background-color: hsla(0, 0%, 100%, 0.2);
    background-clip: padding-box;
}

.find-banner.console-find-banner > :matches(input[type="search"], button) {
    height: 22px;
}

.find-banner.console-find-banner > input[type="search"]::placeholder {
    color: hsla(0, 0%, 0%, 0.35);
}

.find-banner.console-find-banner > input[type="search"]::-webkit-textfield-decoration-container {
    margin-left: 4px;
}

.find-banner.console-find-banner > input[type="search"]:focus {
    background-color: white;
}

/* Make the search field's background white when it is not focused and has content.
   Needs to be a separate rule. See http://webkit.org/b/118162 */
.find-banner.console-find-banner > input[type="search"]:not(:placeholder-shown) {
    background-color: white;
}
