/* Start reset.css */
/* This is a heavily pared down version of reset.css, from
 * http://meyerweb.com/eric/tools/css/reset/. This enables us to place Empress
 * and Emperor plots exactly next to each other without user agent styling
 * getting in the way (and inserting extra spaces in the page).
 *
 * (Credit to https://stackoverflow.com/a/4873905/10730311 for reminding me
 * that this library existed :)
 *
 * Based on reset.css v2.0 | 20110126
 * License: none (public domain)
*/

html,
body,
div {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

/* End reset.css */

/* global settings */

body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 80%;
}

/* general classes */

.hidden {
    display: none !important;
}

/* general control styles */

a:link,
a:visited {
    color: steelblue;
}

button::-moz-focus-inner {
    border: 0;
}

input[type="text"].empress-input,
input[type="number"].empress-input,
select {
    box-sizing: border-box;
    background-color: white;
    height: 28px;
    border: none;
    outline: none;
    border-radius: 3px;
    padding-left: 5px;
    margin-right: 5px;
}

input[type="text"].empress-input:hover:enabled,
input[type="number"].empress-input:hover:enabled,
input[type="radio"].empress-input:hover:enabled,
input[type="checkbox"].empress-input:hover:enabled,
select:hover:enabled {
    background-color: lightgray;
}

input[type="text"].empress-input {
    padding-right: 5px;
}

input[type="text"].empress-input,
select {
    min-width: 120px;
}

input[type="number"].empress-input {
    width: 60px;
}

input[type="radio"].empress-input,
input[type="checkbox"].empress-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    -ms-appearance: none;
    appearance: none;
    display: inline-block;
    position: relative;
    background-color: white;
    color: dimgray;
    border: 0;
    cursor: pointer;
    margin-left: 10px;
    margin-right: 10px;
    outline: none;
}

input[type="radio"].empress-input {
    border-radius: 50px;
    height: 25px;
    width: 25px;
}

input[type="checkbox"].empress-input {
    border-radius: 3px;
    height: 20px;
    width: 20px;
}

input[type="radio"].empress-input:checked::before {
    position: absolute;
    content: "\02143";
    transform: rotate(40deg);
    font-size: 15px;
    left: 9px;
    top: 4px;
}

input[type="checkbox"].empress-input:checked::before {
    position: absolute;
    content: "\02143";
    transform: rotate(40deg);
    font-size: 15px;
    left: 7px;
    top: 1px;
}

select {
    -webkit-appearance: none;
    -moz-appearance: none;
    -ms-appearance: none;
    appearance: none;
    padding-right: 30px;
    /* ensures other elements are visible if there are long column names */
    width: 170px;
}

select::-ms-expand {
    display: none;
}

select:-moz-focusring {
    color: transparent;
    text-shadow: 0 0 0 black;
}

.select-container {
    display: flex;
    align-items: center;
    position: relative;
}

.select-container:after {
    position: absolute;
    content: "\203A";
    transform: rotate(90deg);
    color: gray;
    font-size: 13.5pt;
    right: 12px;
    top: 1px;
    pointer-events: none;
}

/* node selection menu box */

#menu-box {
    position: fixed;
    border: 1px solid transparent;
    background-color: lightgray;
    opacity: 0.75;
    padding: 20px;
    z-index: 1;
}

#menu-box:hover {
    opacity: 1;
    box-shadow: 10px 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid lightgray;
}

#menu-box::after,
#menu-box:hover::before {
    content: " ";
    position: absolute;
    border-style: solid;
    right: 100%;
    margin-top: -10px;
}

#menu-box:after {
    top: 40px;
    border-width: 10px;
    border-color: transparent white transparent transparent;
}

#menu-box:hover:before {
    top: 39px;
    border-width: 11px;
    border-color: transparent lightgray transparent transparent;
}

.menu-table {
    background-color: white;
}

.menu-table thead,
.menu-table tbody {
    display: block;
    max-width: 500px;
    max-height: 300px;
    overflow: auto;
}

.menu-table tr {
    padding: 0px 15px;
}

.menu-table tr td {
    border: 1px solid lightgray;
}

.menu-table tr td p {
    text-align: right;
}

.menu-table tr td:nth-last-child(1) {
    max-width: 200px;
    text-overflow: ellipsis;
}

.menu-table tr td button:only-child {
    background-color: lightgray;
    height: 25px;
    margin-top: 10px;
    cursor: pointer;
    outline: none;
    padding: 0px 15px;
    border-radius: 2px;
    font-size: 8pt;
}

.frozen-cell {
    position: relative;
    position: -webkit-sticky; /* Safari */
    position: sticky;
    left: 0;
}

.menu-box-header-cell {
    background-color: white;
}

.header-cell {
    font-weight: bold;
}

.menu-table tr td button:only-child:hover {
    background-color: darkgray;
}

#menu-sm-table {
    margin-bottom: 1em;
}

#menu-select {
    background-color: white;
}

.menu-select-container {
    position: relative;
}

.menu-select-container:after {
    position: absolute;
    content: "\203A";
    transform: rotate(90deg);
    font-size: 13.5pt;
    right: 12px;
    top: 1px;
    pointer-events: none;
}

/* referenced from  https://webglfundamentals.org/webgl/lessons/webgl-text-html.html*/
.container {
    position: absolute;
    top: 0vh;
    left: 0vw;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* This class is added to container and tree-container to keep empress on the
 * left-hand-side of the screen when combined with Emperor
 */
.combined-plot-container {
    width: 50vw !important;
    float: left;
    border-right: 2px solid black;
    /* Having this z-index puts this above the Emperor div, which is useful
     * because it lets us draw the border-line over Emperor.
     */
    z-index: 1;
}

/* Hide scrollbars being created that mess up the page layout: see
 * https://github.com/biocore/empress/issues/356 for morbid details.
 */
#emperor-in-empire {
    overflow: hidden;
}

/* Convenience class for preventing user selection
 * https://stackoverflow.com/a/6900392
 */
.unselectable-text {
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+/Edge */
    user-select: none; /* Standard */
}

/* control panel */

#side-panel {
    position: absolute;
    top: 0px;
    right: 0px;
    width: 450px;
    max-height: 100%;
    overflow-y: auto;
}

#show-ctrl {
    position: absolute;
    top: 0px;
    right: 0px;
    opacity: 0.5;
    background-color: #777;
    font-size: 10pt;
    padding: 0 0 3px 3px;
}

.panel-active {
    opacity: 1 !important;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

.side-header {
    background-color: #777;
    color: white;
    cursor: pointer;
    border: none;
    text-align: left;
    outline: none;
    margin: 0;
}

button.side-header {
    padding: 15px 20px;
    width: 100%;
    font-size: 11pt;
}

#side-header-search-btn {
    color: white;
    background-color: #bebebe;
    height: 34px;
    border: 0;
    cursor: pointer;
    outline: none;
    padding: 0px 15px;
    border-radius: 3px;
    font-size: 10pt;
}

p.side-header {
    margin: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

p.side-header button,
#show-ctrl {
    height: 40px;
    width: 40px;
    min-width: 40px;
    border: none;
    outline: none;
    color: white;
    cursor: pointer;
}

p.side-header button {
    background-color: transparent;
}

#autocomplete-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.autocomplete-items {
    position: absolute;
    border: 1px solid #d4d4d4;
    border-bottom: none;
    border-top: none;
    z-index: 99;
    /*position the autocomplete items to be the same width as the container:*/
    top: 100%;
    left: 0;
    right: 0;
    max-height: 500px;
    overflow: auto;
}
.autocomplete-items div {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #d4d4d4;
}
.autocomplete-items div:hover {
    /*when hovering an item:*/
    background-color: #e9e9e9;
}

.active,
button.side-header:hover,
p.side-header button:hover,
#show-ctrl:hover {
    background-color: #555;
}

/* quick search */

#quick-search {
    color: black;
    height: 36px;
    margin-left: 2px;
    margin-right: 2px;
    padding-left: 18px;
    padding-right: 18px;
    border-color: grey;
    background-color: white;
    font-size: 10.5pt;
}

.invalid-search {
    background-color: #f08080 !important;
}

#quick-search::placeholder {
    color: black;
}

#quick-search:hover::placeholder {
    color: dimgray;
}

/* controls */

.empress-control {
    padding: 5px 20px;
    overflow: hidden;
    color: #444;
    background-color: #e5e5e5;
    font-size: 10.5pt;
}

.empress-control p {
    line-height: 30px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.empress-control p label:first-of-type {
    margin-right: auto;
}

.empress-control p button {
    color: white;
    background-color: gray;
    height: 32px;
    border: 0;
    cursor: pointer;
    outline: none;
    padding: 5px 15px;
    border-radius: 3px;
    font-size: 10pt;
}

.empress-control p button:hover {
    background-color: dimgray;
}

.empress-control p button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.empress-control p button:only-child {
    margin-right: auto;
}

.empress-control div.animate-btns {
    margin-left: 10%;
    margin-right: 10%;
    display: grid;
    grid-template-columns: auto auto auto;
    justify-items: center;
}

.square {
    position: absolute;
    height: 0px;
    width: 0px;
    background-color: #555;
    opacity: 0.5;
}

/* loading screen */

#loading-screen {
    position: absolute;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#loading-text {
    position: absolute;
    top: calc(50% - 8px);
    font-size: 12pt;
    color: dimgray;
}

#loading-animation {
    border: 20px solid lightgray;
    border-top: 20px solid dimgray;
    border-radius: 50%;
    width: 150px;
    height: 150px;
    animation: spin 3s linear infinite;
    -moz-animation: spin 3s linear infinite;
    -webkit-animation: spin 3s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Legends: both the main legend for the tree coloring (#legend-main)
 * and legends for barplot layers
 */

#legend-panel {
    position: absolute;
    left: 0;
    top: 0;
    padding: 20px;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
}

.legend {
    border: 1px solid darkgray;
    white-space: nowrap;
}

.barplot-layer-legend {
    max-height: 15em;
    /* The side panel width is 450px */
    max-width: 430px;
    overflow: auto;
}

/* The legend is resizable, thanks to resize: both; and overflow: auto.
 * See https://stackoverflow.com/a/61976603/10730311.
 *
 * The 0.1px bottom padding prevents an unnecessary vertical scrollbar
 * that kept showing up when setting the legend's width/height back to
 * their defaults ("") in empress.js. It seems like having a tiny bit
 * of extra vertical space is needed to get rid of this. It's barely
 * visible to the user so it shouldn't be a problem.
 */
#legend-main {
    margin: 20px;
    min-width: 150px;
    max-width: 33vw;
    min-height: 30px;
    max-height: 85vh;
    padding-bottom: 0.1px;
    resize: both;
    overflow: auto;
    background-color: rgba(255, 255, 255, 0.5);
}

#legend-main:hover {
    border: 1px solid dimgray;
    background-color: white;
}

.legend-title {
    text-align: center;
    font-weight: bold;
    margin: 5px 0;
}

/* Color key */

.gradient-label {
    white-space: nowrap;
    margin-left: 5px;
    margin-right: 5px;
    height: 15px;
}

.category-color {
    height: 15px;
    width: 15px;
    min-height: 15px;
    min-width: 15px;
    border: 1px solid black;
}

.gradient-color {
    width: 150px;
}

#menu-box p {
    max-width: 500px;
    font-size: small;
}

#menu-box-node-name-warning {
    font-weight: bold;
}

#menu-box-node-id {
    max-width: 500px;
    overflow-x: auto;
    /* Don't break the node ID onto another line -- keep it all one line.
   * See https://css-tricks.com/almanac/properties/w/whitespace/. */
    white-space: nowrap;
}

/* Somewhere else in the CSS adjusts line height and justify-content,
 * so we reset these here.
 *
 * Also, the reason for display: block is because the .empress-control p CSS
 * elsewhere causes weird problems when there are other tags (e.g.
 * <span>s, like in the shearing UI) within <p> tags of class
 * side-panel-notes due to the flex display.
 */
.side-panel-notes {
    font-size: small;
    line-height: normal !important;
    justify-content: start !important;
    display: block !important;
}

.indented {
    margin-left: 2em;
}

.selected-metadata-choice {
    background-color: #333 !important;
}

.side-panel-inner-header {
    font-weight: bold;
    justify-content: center !important;
    margin-top: 0;
    margin-bottom: 0;
}
