/*
 * Copyright (C) 2013 Google 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:
 *
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * 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.
 *     * Neither the name of Google Inc. nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
 * OWNER OR 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.
 */

.network-log-grid.data-grid {
    border: none;
    flex: 1 1;
}

.network-summary-bar {
    flex: 0 0 19px;
    padding-left: 5px;
    line-height: 18px;
    background-color: rgb(236, 236, 236);
    border-top: 1px solid #ccc;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.network-summary-bar .warning-icon-small {
    margin-right: 6px;
}

.network-log-grid.data-grid table.data {
    background-size: 128px 82px;
    background-image: linear-gradient(to bottom, white, white 50%, #eee 50%, #eee);
}

.network-log-grid.data-grid.small table.data {
    background-size: 128px 42px;
}

.network-log-grid.data-grid td {
    line-height: 17px;
    height: 41px;
    border-left: 1px solid rgb(210, 210, 210);
    vertical-align: middle;
}

.network-log-grid.data-grid.small td {
    height: 21px;
}

.network-log-grid.data-grid th {
    border-bottom: 1px solid rgb(205, 205, 205);
    border-left: 1px solid rgb(205, 205, 205);
    height: 30px;
}

.network-log-grid.data-grid.small th {
    height: 22px;
}

.network-log-grid.data-grid th,
.network-log-grid.data-grid th.sort-descending,
.network-log-grid.data-grid th.sort-ascending {
    background: white;
}

.network-log-grid.data-grid .data-container {
    top: 33px;
}

.network-log-grid.data-grid.small .data-container {
    top: 23px;
}

.network-log-grid.data-grid select {
    -webkit-appearance: none;
    background-color: transparent;
    border: none;
    width: 100%;
    color: inherit;
}

.network-log-grid.data-grid tr.offscreen > td > div {
    display: none;
}

.network-log-grid.data-grid tr.filler {
    background-color: white;
}

.network-log-grid.data-grid tr:not(.filler) td.name-column {
    cursor: pointer;
}

#network-container:not(.brief-mode) .network-log-grid.data-grid td.name-column:hover {
    text-decoration: underline;
}

.network-log-grid.data-grid.small .network-graph-side {
    height: 14px;
}

.network-log-grid.data-grid th.sortable:active {
    background-image: none !important;
}

.network-cell-subtitle {
    font-weight: normal;
    color: gray;
}

.network-error-row,
.network-error-row .network-cell-subtitle {
    color: rgb(230, 0, 0);
}

.initiator-column a {
    color: inherit;
}

.network-log-grid.data-grid tr.selected .network-cell-subtitle {
    color: white;
}

.network-log-grid tr.highlighted-row {
    -webkit-animation: "network-row-highlight-fadeout" 2s 0s;
}

@-webkit-keyframes network-row-highlight-fadeout {
    from {background-color: rgba(255, 255, 120, 1); }
    to { background-color: rgba(255, 255, 120, 0); }
}

.network-header-subtitle {
    color: gray;
}

.network-log-grid.data-grid.small .network-cell-subtitle,
.network-log-grid.data-grid.small .network-header-subtitle {
    display: none;
}

/* Resource preview icons */

.network-log-grid.data-grid .icon {
    content: url(Images/resourcePlainIcon.png);
}

.network-log-grid.data-grid.small .icon {
    content: url(Images/resourcePlainIconSmall.png);
}

.network-log-grid.data-grid .network-type-script .icon {
    content: url(Images/resourceJSIcon.png);
}

.network-log-grid.data-grid.small .network-type-script .icon {
    content: url(Images/resourceDocumentIconSmall.png);
}

.network-log-grid.data-grid .network-type-document .icon {
    content: url(Images/resourceDocumentIcon.png);
}

.network-log-grid.data-grid.small .network-type-document .icon {
    content: url(Images/resourceDocumentIconSmall.png);
}

.network-log-grid.data-grid .network-type-stylesheet .icon {
    content: url(Images/resourceCSSIcon.png);
}

.network-log-grid.data-grid.small .network-type-stylesheet .icon {
    content: url(Images/resourceDocumentIconSmall.png);
}

.network-log-grid.data-grid .network-type-media .icon {
    content: url(Images/resourcePlainIcon.png); // FIXME: media icon
}

.network-log-grid.data-grid.small .network-type-media .icon {
    content: url(Images/resourcePlainIconSmall.png); // FIXME: media icon
}
.network-log-grid.data-grid .network-type-texttrack .icon {
    content: url(Images/resourcePlainIcon.png); // FIXME: vtt icon
}

.network-log-grid.data-grid.small .network-type-texttrack .icon {
    content: url(Images/resourcePlainIconSmall.png); // FIXME: vtt icon
}

.network-log-grid.data-grid .network-type-image .icon {
    position: relative;
    background-image: url(Images/resourcePlainIcon.png);
    background-repeat: no-repeat;
    content: "";
}

.network-log-grid.data-grid.small .network-type-image .icon {
    background-image: url(Images/resourcePlainIconSmall.png);
    content: "";
}

.network-log-grid.data-grid .icon {
    float: left;
    width: 32px;
    height: 32px;
    margin-top: 1px;
    margin-right: 3px;
}

.network-log-grid.data-grid th {
    border-bottom: 1px solid rgb(205,205,205) !important;
}

.network-log-grid.data-grid.small .icon {
    width: 16px;
    height: 16px;
}

.network-log-grid.data-grid .image-network-icon-preview {
    position: absolute;
    margin: auto;
    top: 3px;
    bottom: 4px;
    left: 5px;
    right: 5px;
    max-width: 18px;
    max-height: 21px;
    min-width: 1px;
    min-height: 1px;
}

.network-log-grid.data-grid.small .image-network-icon-preview {
    top: 2px;
    bottom: 1px;
    left: 3px;
    right: 3px;
    max-width: 8px;
    max-height: 11px;
}

/* Graph styles */

.network-graph-side {
    position: relative;
    height: 36px;
    padding: 0;
    white-space: nowrap;
    margin-top: 1px;
    border-top: 1px solid transparent;
    overflow: hidden;
}

.network-graph-bar-area {
    position: absolute;
    top: 0;
    bottom: 0;
}

.network-graph-bar-area,
.network-timeline-grid .resources-dividers,
.network-timeline-grid .resources-event-dividers,
.network-timeline-grid .resources-dividers-label-bar {
    right: 12px;
    left: 12px;
}

.network-graph-label {
    position: absolute;
    top: 0;
    bottom: 0;
    margin: auto -7px;
    height: 13px;
    line-height: 13px;
    font-size: 90%;
    color: rgba(0, 0, 0, 0.75);
    text-shadow: rgba(255, 255, 255, 0.25) 1px 0 0, rgba(255, 255, 255, 0.25) -1px 0 0, rgba(255, 255, 255, 0.333) 0 1px 0, rgba(255, 255, 255, 0.25) 0 -1px 0;
    z-index: 150;
    overflow: hidden;
    text-align: center;
    visibility: hidden;
}

.network-graph-side:hover .network-graph-label {
    visibility: visible;
}

.network-graph-label:empty {
    display: none;
}

.network-graph-label.waiting {
    margin-right: 5px;
}

.network-graph-label.waiting-right {
    margin-left: 5px;
}

.network-graph-label.before {
    color: rgba(0, 0, 0, 0.7);
    text-shadow: none;
    text-align: right;
    margin-right: 2px;
}

.network-graph-label.before::after {
    padding-left: 2px;
    height: 6px;
    content: url(Images/graphLabelCalloutLeft.png);
}

.network-graph-label.after {
    color: rgba(0, 0, 0, 0.7);
    text-shadow: none;
    text-align: left;
    margin-left: 2px;
}

.network-graph-label.after::before {
    padding-right: 2px;
    height: 6px;
    content: url(Images/graphLabelCalloutRight.png);
}

.network-graph-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    margin: auto -7px;
    height: 12px;
    min-width: 14px;
    opacity: 0.65;
    border-width: 1px;
    border-style: solid;
    border-radius: 7px / 6px;
    box-shadow: inset 0 1px 1px 0px rgba(255, 255, 255, 0.8);

    border-color: hsl(0, 0%, 65%);
    background: linear-gradient(0deg, hsl(0, 0%, 73%), hsl(0, 0%, 78%));
}

.network-graph-bar.waiting,
.network-graph-bar.waiting-right {
    opacity: 0.35;
}

/* Resource categories */


.resource-cached .network-graph-bar {
    background: hsl(0, 0%, 90%);
    box-shadow: inset 0 1px 1px 0px rgba(255, 255, 255, 0.8),
                inset 0 0 0 2px hsl(0, 0%, 73%),
                inset 0 1px 0 2px hsla(0, 0%, 76%, 0.85);
}

.network-type-document .network-graph-bar {
    border-color: hsl(215, 49%, 52%);
    background: linear-gradient(0deg, hsl(215, 72%, 61%), hsl(215, 100%, 69%));
}

.network-type-document.resource-cached .network-graph-bar {
    background: hsl(215, 99%, 86%);
    box-shadow: inset 0 1px 1px 0px rgba(255, 255, 255, 0.8),
                inset 0 0 0 2px hsl(215, 71%, 61%),
                inset 0 1px 0 2px hsla(215, 58%, 65%, 0.85);
}

.network-type-stylesheet .network-graph-bar {
    border-color: hsl(99, 34%, 52%);
    background: linear-gradient(0deg, hsl(100, 50%, 61%), hsl(90, 50%, 64%));
}

.network-type-stylesheet.resource-cached .network-graph-bar {
    background: hsl(99, 100%, 86%);
    box-shadow: inset 0 1px 1px 0px rgba(255, 255, 255, 0.8),
                inset 0 0 0 2px hsl(99, 72%, 61%),
                inset 0 1px 0 2px hsla(99, 59%, 65%, 0.85);
}

.network-type-image .network-graph-bar {
    border-color: hsl(272, 31%, 52%);
    background: linear-gradient(0deg, hsl(272, 46%, 61%), hsl(272, 64%, 69%));
}

.network-type-image.resource-cached .network-graph-bar {
    background: hsl(272, 65%, 86%);
    box-shadow: inset 0 1px 1px 0px rgba(255, 255, 255, 0.8),
                inset 0 0 0 2px hsl(272, 47%, 61%),
                inset 0 1px 0 2px hsla(273, 38%, 65%, 0.85);
}

.network-type-media .network-graph-bar {
    border-color: hsl(272, 31%, 52%);
    background: linear-gradient(0deg, hsl(272, 46%, 61%), hsl(272, 64%, 69%));
}

.network-type-media.resource-cached .network-graph-bar {
    background: hsl(272, 65%, 86%);
    box-shadow: inset 0 1px 1px 0px rgba(255, 255, 255, 0.8),
                inset 0 0 0 2px hsl(272, 47%, 61%),
                inset 0 1px 0 2px hsla(273, 38%, 65%, 0.85);
}

.network-type-font .network-graph-bar {
    border-color: hsl(8, 49%, 52%);
    background: linear-gradient(0deg, hsl(8, 72%, 61%), hsl(8, 100%, 69%));
}

.network-type-font.resource-cached .network-graph-bar {
    background: hsl(8, 100%, 86%);
    box-shadow: inset 0 1px 1px 0px rgba(255, 255, 255, 0.8),
                inset 0 0 0 2px hsl(8, 72%, 61%),
                inset 0 1px 0 2px hsla(8, 59%, 65%, 0.85);
}

.network-type-texttrack .network-graph-bar {
    border-color: hsl(8, 49%, 52%);
    background: linear-gradient(0deg, hsl(8, 72%, 61%), hsl(8, 100%, 69%));
}

.network-type-texttrack.resource-cached .network-graph-bar {
    background: hsl(8, 100%, 86%);
    box-shadow: inset 0 1px 1px 0px rgba(255, 255, 255, 0.8),
                inset 0 0 0 2px hsl(8, 72%, 61%),
                inset 0 1px 0 2px hsla(8, 59%, 65%, 0.85);
}

.network-type-script .network-graph-bar {
    border-color: hsl(31, 49%, 52%);
    background: linear-gradient(0deg, hsl(31, 72%, 61%), hsl(31, 100%, 69%));
}

.network-type-script.resource-cached .network-graph-bar {
    background: hsl(31, 100%, 86%);
    box-shadow: inset 0 1px 1px 0px rgba(255, 255, 255, 0.8),
                inset 0 0 0 2px hsl(31, 78%, 61%),
                inset 0 1px 0 2px hsla(31, 64%, 65%, 0.85);
}

.network-type-xhr .network-graph-bar {
    border-color: hsl(53, 49%, 52%);
    background: linear-gradient(0deg, hsl(53, 72%, 61%), hsl(53, 100%, 69%));
}

.network-type-xhr.resource-cached .network-graph-bar {
    background: hsl(53, 100%, 86%);
    box-shadow: inset 0 1px 1px 0px rgba(255, 255, 255, 0.8),
                inset 0 0 0 2px hsl(53, 72%, 61%),
                inset 0 1px 0 2px hsla(54, 59%, 65%, 0.85);
}

.network-type-websocket .network-graph-bar {
    border-color: hsl(0, 0%, 65%);
    background: linear-gradient(0deg, hsl(0, 0%, 73%), hsl(0, 0%, 78%));
}

.network-type-websocket.resource-cached .network-graph-bar {
    background: hsl(0, 0%, 90%);
    box-shadow: inset 0 1px 1px 0px rgba(255, 255, 255, 0.8),
                inset 0 0 0 2px hsl(0, 0%, 73%),
                inset 0 1px 0 2px hsla(0, 0%, 76%, 0.85);
}

.network-dim-cell {
    color: grey;
}

/* Dividers */

.network-timeline-grid {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 14px; /* Keep in sync with td.corner width */
    pointer-events: none;
}

.data-grid td.timeline-column {
    padding-left: 0;
    padding-right: 0;
}

.network-event-divider-padding {
    position: absolute;
    width: 8px;
    top: 0;
    bottom: 0;
    pointer-events: auto;
}

.network-event-divider {
    position: absolute;
    width: 2px;
    top: 31px;
    bottom: 0;
    z-index: 300;
}

.network-timeline-grid.small .network-event-divider {
    top: 23px;
}

.network-red-divider {
    background-color: rgba(255, 0, 0, 0.5);
}

.network-blue-divider {
    background-color: rgba(0, 0, 255, 0.5);
}

.network-log-grid.data-grid .resources-dividers {
    z-index: 0;
}

.network-log-grid.data-grid .resources-dividers-label-bar {
    background-color: transparent;
    border: none;
    height: 30px;
    pointer-events: none;
}

.network-timeline-grid.small .resources-dividers-label-bar {
    height: 23px;
}

.network-timeline-grid .resources-divider-label {
    top: 0;
    margin-top: -5px;
}

.network-timeline-grid .resources-dividers-label-bar .resources-divider {
    top: 23px;
}

.network-timeline-grid.small .resources-dividers-label-bar .resources-divider {
    top: 15px;
}

.network-timeline-grid .resources-divider:first-child .resources-divider-label {
    display: none;
}

.network-timeline-grid .resources-dividers-label-bar .resources-divider:first-child {
    background-color: transparent;
}

/* Filters */

.network-log-grid.data-grid table.data tr.revealed.network-item.filtered-out {
    display: none;
}

#network-container {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Brief mode peculiarities. */
#network-container.brief-mode .network-timeline-grid {
    display: none;
}

#network-container.brief-mode td,
#network-container.brief-mode th {
    border-left: none;
}

#network-container.brief-mode .network-log-grid.data-grid .data-grid-resizer {
    display: none;
}

#network-container.brief-mode .network-timeline-grid {
    display: none;
}

#network-container:not(.brief-mode) .data-grid tr.selected {
    background-color: transparent;
    color: #222;
}

#network-container.brief-mode .data-grid .data-container {
    padding-right: 0;
}
