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

.toolbar {
    display: flex;

    white-space: nowrap;
    overflow: hidden;

    outline: none;

    padding-top: 3px;
    padding-bottom: 3px;
    height: 36px;
}

body:not(.mavericks) .toolbar,
body.mavericks.docked .toolbar {
    background-image: linear-gradient(to bottom, hsl(0, 0%, 92%), hsl(0, 0%, 87%));
    box-shadow: inset hsla(0, 0%, 100%, 0.5) 0 1px 1px;
}

body.window-inactive:not(.mavericks) .toolbar {
    background-image: none;
    background-color: hsl(0, 0%, 96%);
}

body.mac-platform:not(.docked, .mavericks) .toolbar {
    padding-top: 21px;
    height: 54px;
}

.toolbar .control-section {
    display: flex;

    flex-direction: column;
    align-items: center;
    justify-content: center;

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

    min-width: -webkit-min-content;
}

.toolbar:matches(.icon-and-label-horizontal.small-size, .icon-only.small-size, .label-only) .control-section {
    flex-direction: row;
}

.toolbar .item-section {
    display: flex;
    flex: 1;
    min-width: -webkit-min-content;
}

.toolbar .item-section.left {
    justify-content: flex-start;
}

.toolbar .item-section.center-left {
    justify-content: flex-start;
}

.toolbar .item-section.center-right {
    justify-content: center;
}

.toolbar .item-section.center {
    justify-content: center;
}

.toolbar .item-section.right {
    justify-content: flex-end;
    padding-right: 4px;
}

.toolbar .item {
    display: flex;
    outline: none;
}

.toolbar .search-bar {
    width: 100%;
    min-width: 100px;
}

.toolbar .search-bar > input[type="search"] {
    width: 100%;
    font-size: 12px;
    background-clip: initial;
    margin: 4px;
}

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

body.legacy-mac .toolbar .item.button,
body.legacy-mac .toolbar .search-bar > input[type="search"],
body.legacy-mac .toolbar .dashboard-container {
    background-color: hsl(0, 0%, 99%);
    border: 1px solid transparent;
    border-top-color: hsl(0, 0%, 100%);
    box-shadow: hsla(0, 0%, 0%, 0.15) 0 1px 0;
    border-radius: 4px;
}

body.legacy-mac .toolbar .search-bar > input[type="search"] {
    box-shadow: 0 0 0 7px hsla(211, 96%, 48%, 0);
    transition: box-shadow .25s cubic-bezier(0.165, 0.840, 0.440, 1) /* easeOutQuart */;
}

body.legacy-mac .toolbar .search-bar > input[type="search"]:focus {
    box-shadow: hsla(0, 0%, 0%, 0.15) 0 1px 0, 0 0 0 3px hsla(211, 96%, 48%, 0.4);
}

body.legacy-mac .toolbar .item.button:active {
    border-top-color: hsl(0, 0%, 94%);
    background-color: hsl(0, 0%, 89%);
}

body.window-inactive.legacy-mac .toolbar .item.button,
body.window-inactive.legacy-mac .toolbar .search-bar > input[type="search"],
body.window-inactive.legacy-mac .toolbar .dashboard-container {
    border: 1px solid hsl(0, 0%, 86%);
    background-color: hsl(0, 0%, 96%);
    box-shadow: none;
}

body.latest-mac .toolbar .item.button,
body.latest-mac .toolbar .search-bar > input[type="search"],
body.latest-mac .toolbar .dashboard-container {
    background-image: linear-gradient(hsl(0, 0%, 99%), var(--panel-background-color));
    box-shadow: hsla(0, 0%, 0%, 0.3) 0 1px 1px -1px;

    border-radius: 4px;
    border: 1px solid hsl(0, 1%, 82%);
    border-top-color: hsl(0, 0%, 83%);
    border-bottom-color: hsl(0, 0%, 76%);
}

body.latest-mac .toolbar .search-bar > input[type="search"] {
    box-shadow: hsla(0, 0%, 0%, 0.3) 0 1px 1px -1px, 0 0 0 7px hsla(211, 96%, 48%, 0);
    transition: box-shadow .25s cubic-bezier(0.165, 0.840, 0.440, 1) /* easeOutQuart */;
}

body.latest-mac .toolbar .search-bar > input[type="search"]:focus {
    box-shadow: hsla(0, 0%, 0%, 0.15) 0 1px 0, 0 0 0 3px hsla(211, 96%, 48%, 0.4);
}

@media (-webkit-min-device-pixel-ratio: 2) {
    body.latest-mac .toolbar .item.button,
    body.latest-mac .toolbar .search-bar > input[type="search"],
    body.latest-mac .toolbar .dashboard-container {
        border: 0.5px solid hsl(0, 0%, 78%);
        border-top-color: hsl(0, 0%, 80%);
        border-bottom-color: hsl(0, 0%, 65%);
    }
}

body.latest-mac .toolbar .item.button:active {
    background-image: linear-gradient(hsl(0, 0%, 89%), hsl(0, 0%, 86%));
    box-shadow: hsla(0, 0%, 0%, 0.3) 0 1px 1px -1px, inset 0 1px 1px -1px white;
}

body.latest-mac.window-inactive .toolbar .item.button,
body.latest-mac.window-inactive .toolbar .search-bar > input[type="search"],
body.latest-mac.window-inactive .toolbar .dashboard-container {
    opacity: 0.65;
    border-color: hsla(0, 0%, 0%, 0.15);
    background-color: transparent;
    background-image: none;
}

@media (-webkit-min-device-pixel-ratio: 2) {
    body.latest-mac.window-inactive .toolbar .item.button,
    body.latest-mac.window-inactive .toolbar .search-bar > input[type="search"],
    body.latest-mac.window-inactive .toolbar .dashboard-container {
        box-shadow: inset 0 0 1px 0 hsla(0, 0%, 0%, 0.1);
    }
}

@media (max-width: 539px) {
    .toolbar .item.download {
        display: none;
    }
}
