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

* {
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;

    font-family: -webkit-system-font, sans-serif;
    font-size: 11px;

    background-color: white;

    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    padding: 0;
    margin: 0;

    overflow: hidden;

    -webkit-user-select: none;
    -webkit-user-drag: none;

    cursor: default;

    -webkit-font-smoothing: subpixel-antialiased;

    tab-size: 4; /* FIXME: This should be controlled by a setting. <rdar://problem/10593948> */
}

body.mac-platform.legacy:not(.docked) {
    background-color: transparent;
}

body.docked.bottom {
    border-top: 1px solid rgb(179, 179, 179);
}

body.docked.right {
    border-left: 1px solid rgb(179, 179, 179);
}

body.docked.bottom.mac-platform.legacy {
    border-top-color: rgb(85, 85, 85);
}

body.docked.right.mac-platform.legacy {
    border-left-color: rgb(85, 85, 85);
}

#docked-resizer {
    display: none;

    z-index: 100;
}

body.docked #docked-resizer {
    display: block;
}

body.docked.bottom #docked-resizer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;

    cursor: row-resize;
}

body.docked.right #docked-resizer {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 3px;

    cursor: col-resize;
}

body.docked.bottom #toolbar {
    cursor: row-resize;
}

body.docked.bottom #toolbar .item:not(.flexible-space) {
    cursor: default;
}

#main {
    display: flex;
    flex: 1;

    background-color: white;

    /* The position and z-index are needed to make negative z-index work in the DOM tree. */
    position: relative;
    z-index: 0;
}

#navigation-sidebar {
    width: 300px;
}

body.docked.right #navigation-sidebar.collapsed > .resizer {
    pointer-events: none;
}

#content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

#content-browser {
    flex: 1;
}

#split-content-browser {
    border-top: 1px solid rgb(179, 179, 179);
}

#split-content-browser > .navigation-bar {
    cursor: row-resize;

    background-color: rgb(242, 242, 242);
}

body.mac-platform.legacy #split-content-browser > .navigation-bar {
    background-image: linear-gradient(to bottom, rgb(248, 248, 248), rgb(226, 226, 226));
}

#split-content-browser > .navigation-bar .item:not(.flexible-space) {
    cursor: default;
}

#details-sidebar {
    width: 300px;
}

.message-text-view {
    display: flex;
    z-index: 1000;

    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    padding-left: 20%;
    padding-right: 20%;

    justify-content: center;
    align-items: center;

    line-height: 20px;
    white-space: pre-wrap;
    text-align: center;

    font-size: 18px;
    font-weight: bold;

    color: rgb(75%, 75%, 75%);
    background-color: white;
}

.message-text-view.error {
    color: rgb(224, 16, 16);
}

.message-text-view.error::before {
    display: inline-block;

    width: 20px;
    height: 20px;
    margin-right: 4px;
    vertical-align: bottom;

    background-image: url(../Images/Error.svg);
    background-size: 100% 100%;
    content: "";
}

.go-to-link {
    color: rgb(85, 85, 85) !important;
    text-decoration: underline !important;
    cursor: pointer;
}

.go-to-link:not(.dont-float) {
    float: right;
    margin-left: 5px;
    max-width: 100%;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.go-to-arrow {
    -webkit-appearance: none;

    padding: 0;
    margin: 0;
    border: none;

    background-color: transparent;
    background-image: -webkit-canvas(go-to-arrow-normal);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px 10px;

    width: 16px;
    height: 16px;

 /* Workaround: for text boxes overlapping float:right. Give go-to arrows a z-index to ensure they are clickable.
    <rdar://problem/11536832> Cannot access content view from Instruments navigator if name of file is truncated */
    position: relative;
    z-index: 1;
}

.go-to-arrow:active {
    background-image: -webkit-canvas(go-to-arrow-normal-active);
}

:focus .selected .go-to-arrow {
    background-image: -webkit-canvas(go-to-arrow-selected);
}

:focus .selected .go-to-arrow:active {
    background-image: -webkit-canvas(go-to-arrow-selected-active);
}

.display-location {
    font-style: italic !important;
}

.hidden {
    display: none !important;
}

.node-link {
    text-decoration: underline;
    cursor: pointer;
}

.node-link-list, .node-link-list li {
    display: block;
    margin: 0;
    padding: 0;
    line-height: 1.2;
}

.node-link-list li {
    margin: 0 0 0.4em;
}

.node-link-list li:last-child {
    margin: 0;
}

.value-with-clarification .clarification {
    color: #666;
}

.bouncy-highlight {
    position: absolute;
    z-index: 100;

    box-shadow: inset rgb(250, 232, 140) 0 -1px 0, rgba(211, 197, 96, 1) 0 1px 1px, rgba(0, 0, 0, 0.33) 0 1px 2px 1px;
    text-shadow: white 0 0 2px;

    background: linear-gradient(to bottom, rgb(250, 237, 108), rgb(242, 220, 100));
    border-radius: 7px;

    padding: 2px 4px;
    margin-top: -2px;
    margin-left: -4px;

    -webkit-user-select: none;
    pointer-events: none;

    -webkit-animation-name: bouncy-highlight-animation;
    -webkit-animation-duration: 750ms;
    -webkit-animation-timing-function: ease-in-out;

    opacity: 0;
}

@-webkit-keyframes bouncy-highlight-animation {
    0% {
        -webkit-transform: scale(1);
        opacity: 1;
    }

    12.5% {
        -webkit-transform: scale(1.25);
    }

    25% {
        -webkit-transform: scale(1);
    }

    62.5% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}
