.chsp-meta {
    z-index: 1;
    cursor: pointer;
}

.chsp-meta .chsp-info-icon {
    float: right;
    margin-top: 5px;
    margin-left: 3px;
}

.chsp-meta .chsp-info-icon svg {
    display: block;
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

.chsp-authors-list {
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    justify-content: center;
}

.chsp-authors-list li {
    border: solid #dee2e6 1px;
    padding: 10px;
    list-style-type: none;
    white-space: nowrap;
}

.chsp-open-map-settings {
    position: absolute;
    top: 3px;
    left: 5px;
    z-index: 10;
}

.chsp-open-viewer-settings {
    position: absolute;
    top: 5px;
    right: 5px;
}

.chsp-extra-options-btn {
    margin: auto;
    display: block;
}

/* Tooltip text */
.chsp-tooltip {
    visibility: hidden;
    background: #69738a;
    color: white;
    padding: 6px;
    font-size: 12px;
    line-height: 12px;
    white-space: nowrap;
    border-radius: 2px;
    text-align: center;
    display: inline-block;
    width: 9em;
    position: absolute;
    z-index: 100000;
}

.chsp-tooltip-right {
    top: 0px;
    right: -9.5em;
}

.chsp-tooltip-below {
    top: 35px;
    left: -3.5em;
}

.chsp-has-tooltip:hover .chsp-tooltip {
    visibility: visible;
}

.chsp-legend-tooltip {
    display: none;
    position: absolute;
    z-index: 10;
    pointer-events: none;
    background: #69738a;
    color: white;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 2px;
    white-space: nowrap;
}

.chsp-pin-marker {
    border-radius: 50%;
    border: solid 1px black;
    --size: 12px;
    width: var(--size);
    height: var(--size);
    z-index: 10;
}

.chsp-map-pin-marker {
    position: absolute;
    /* ensure the top/right/left/bottom positioning is relative to the center of the div */
    transform: translate(calc(-50% + var(--size)), -50%);
}

.chsp-pin-marker:hover {
    --size: 20px;
    cursor: pointer;
}

/* This class is added on top of .chsp-pin-marker for the active pinned structure/environment */
.chsp-active-pin {
    border-width: 2px;
    --size: 20px;
}

.chsp-active-pin:hover {
    --size: 22px;
    cursor: default;
}

.chsp-viewer-button {
    position: absolute;
    padding: 1px;
    margin: 0;
    height: 28px;
    width: 28px;
    z-index: 10;
}

.chsp-viewer-action-button {
    background-color: white;
    border: none;
}

.chsp-viewer-action-button:hover {
    background: white;
}

.chsp-viewer-action-button svg {
    opacity: 0.4;
    transition: opacity 0.15s ease-in-out;
}

.chsp-viewer-action-button:hover svg {
    opacity: 0.6;
}

.chsp-structure-viewer-grid {
    display: grid;
    position: relative;
    width: 100%;
    height: 100%;
    grid-column-gap: 2px;
    grid-row-gap: 2px;
}

.chsp-structure-viewer-cell {
    width: 99%;
    height: 99%;
    left: 0.5%;
    top: 0.5%;
    position: relative;
    border: 1px solid lightgray;
    padding: 1px;
}

.chsp-structure-viewer-cell-active {
    border-color: gray;
}

.chsp-map-options {
    display: grid;
    grid-template-columns: 1fr 0.5fr;
    align-items: center;
    justify-content: center;
    align-content: start;
    column-gap: 1em;
}

.chsp-map-options label {
    min-width: 6em;
}

.chsp-map-options > :nth-child(n + 3):not(.chsp-map-extra-options) {
    margin-top: 1rem;
}

.chsp-map-extra-options {
    display: grid;
    align-items: center;
    justify-items: center;
    grid-template-columns: auto 1fr 1fr;
    column-gap: 1em;
}

.chsp-map-extra-options > * {
    margin: 0.4em 0 0 0;
}

.chsp-map-extra-options label {
    min-width: auto;
}

.chsp-map-extra-options {
    grid-column: 1 / span 2;
}

.chsp-map-options .form-check-label {
    width: auto;
}

.chsp-modal-header {
    cursor: grab;
}

.chsp-play-button {
    border: 0;
    background: transparent;
    box-sizing: border-box;
    height: 1.2em;
    width: 1.2em;
    margin-left: 0.5ex;

    border-color: transparent transparent transparent #202020;
    transition: 100ms all ease;
    cursor: pointer;

    border-style: solid;
    border-width: 0.7em 0 0.7em 1em;
}

.chsp-play-button.chsp-playing {
    border-style: double;
    border-width: 0px 0 0px 1.2em;
}

.chsp-play-button:hover {
    border-color: transparent transparent transparent #404040;
}

.chsp-properties-table {
    height: 100%;
    width: 90%;
    margin: auto;
    border: 1px solid #222;
    background-color: #ffffffee;
    color: #222;
}

.chsp-properties-table td,
.chsp-properties-table th {
    width: 50%;
    border-top: none;
}

/* plot container inside property table */
.chsp-info-plot-holder {
    width: 80%;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
}

.chsp-settings-section-title {
    font-weight: bold;
}

/* Change Plotly modebar style to match the style of the structure grid buttons */

.chsp-map .modebar-group {
    padding-left: 0 !important;
}

.chsp-map .modebar-btn {
    cursor: default !important;
    font-family: apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
        'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
        'Noto Color Emoji';
}

.chsp-map .modebar-btn::after {
    opacity: 0.9;
}

.chsp-map .icon:hover + .modebar-btn::after {
    visibility: visible;
}

.chsp-map .modebar-btn::before {
    content: none !important;
}

.chsp-map .modebar-btn .icon {
    transition: opacity 0.15s ease-in-out;
    padding: 3px;
    opacity: 0.3;
    cursor: pointer;
}

.chsp-map .modebar-group svg.icon {
    width: 2em;
    height: 2em;
    border-radius: 0.2em;
}

.chsp-map .modebar-group svg.icon:active {
    color: #212529;
    background-color: #dae0e5;
    border-color: #d3d9df;
    box-shadow: 0 0 0 0.2rem rgb(216 217 219 / 50%);
}

.chsp-map .modebar-btn .icon path {
    transition:
        color 0.15s ease-in-out,
        background-color 0.15s ease-in-out,
        border-color 0.15s ease-in-out,
        box-shadow 0.15s ease-in-out;
    fill: black !important;
}

.chsp-map .modebar-btn .icon:hover {
    opacity: 0.6;
}

.chsp-map .modebar-btn.active .icon {
    opacity: 0.6;
}

.chsp-info-btns {
    display: flex;
    position: relative;
    margin-bottom: 0.5ex;
    margin-top: 0.5ex;
    justify-content: center;
}

.chsp-info-structure-btn {
    min-width: 8em;
    padding-left: 6px;
    padding-right: 4px;
    font-weight: bold;
    font-size: small;
    background-color: none;
    border-color: #66a5e8;
    border-width: 2px;
    float: left;
}

.chsp-info-structure-btn:hover {
    background-color: #5b94d0;
}

.chsp-info-atom-btn {
    margin-left: 1em;
    padding-left: 6px;
    padding-right: 4px;
    min-width: 8em;
    font-weight: bold;
    font-size: small;
    background-color: none;
    border-color: #4cb64c;
    border-width: 2px;
}

.chsp-info-atom-btn:hover {
    background-color: #44a344;
}

.chsp-info-btns-svg {
    float: left;
    padding-right: 6px;
    padding-top: 3px;
}

.chsp-info-btns-svg svg {
    display: block;
    opacity: 0.6;
}

.chsp-info-number {
    -moz-appearance: textfield;
    appearance: textfield;
    border: none;
    transition: background-color 0.15s;
    background-color: #ebedf0;
    color: #222;
    margin-left: 2px;
    margin-right: 3px;
    font-family: inherit;
    width: 4em;
}

.chsp-info-atom-btn:hover .chsp-info-number {
    background-color: #69b569;
}

.chsp-info-structure-btn:hover .chsp-info-number {
    background-color: #7ba9d9;
}

.chsp-info-number::-webkit-outer-spin-button,
.chsp-info-number::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.chsp-info-tables {
    position: relative;
    width: 100%;
}

.chsp-info-table {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background-color: transparent;
    width: 100%;
    /* max-height is set in JavaScript */
    overflow: auto;
}

.chsp-info-table.collapsing {
    overflow: hidden;
}

.chsp-info-table table {
    margin: 0;
}

.chsp-info-plotarea {
    background-color: #eeeeeebb !important;
}

/* Change the atoms slider thumb color to green, to match structure highlight */
.chsp-atom-slider::-webkit-slider-thumb {
    background-color: #008000;
}

.chsp-atom-slider::-moz-range-thumb {
    background-color: #008000;
}

.chsp-atom-slider::-ms-thumb {
    background-color: #008000;
}

.chsp-atom-slider::-webkit-slider-thumb:active {
    background-color: #99cc99;
}

.chsp-atom-slider::-moz-range-thumb:active {
    background-color: #99cc99;
}

.chsp-atom-slider::-ms-thumb:active {
    background-color: #99cc99;
}

.chsp-atom-slider:focus::-webkit-slider-thumb {
    box-shadow:
        0 0 0 1px #fff,
        0 0 0 0.2rem rgba(0, 255, 0, 0.25);
}

.chsp-atom-slider:focus::-moz-range-thumb {
    box-shadow:
        0 0 0 1px #fff,
        0 0 0 0.2rem rgba(0, 255, 0, 0.25);
}

.chsp-atom-slider:focus::-ms-thumb {
    box-shadow:
        0 0 0 1px #fff,
        0 0 0 0.2rem rgba(0, 255, 0, 0.25);
}

.chsp-settings-representation {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-row-gap: 0.25ex;
}

.chsp-settings-representation label {
    cursor: help;
}

.chsp-settings-supercell {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 2fr;
}

.chsp-supercell-count {
    max-width: 3.5em;
}

.chsp-settings-camera {
    display: grid;
    gap: 1em;
    grid-template-columns: repeat(9, auto);
    justify-content: center;
}

.chsp-settings-environments {
    display: grid;
    align-items: center;
    column-gap: 1em;
    grid-template-columns: 1fr 1fr 1fr;
}

.chsp-settings-extra-options {
    display: grid;
    gap: 1em;
    grid-template-columns: 1fr 1fr 1fr;
    grid-column: 1 / span 3;
}

.chsp-settings-extra-options > :nth-child(-n + 3) {
    margin-top: 1em;
}

.chsp-settings-trajectory {
    display: grid;
    grid-template-columns: 12em 12em;
    justify-content: center;
    align-content: center;
    gap: 1em;
    margin-bottom: 1ex;
}

.chsp-cell-info {
    position: absolute;
    bottom: 5px;
    left: 5px;
    font-size: 0.8em;
}

.chsp-toggle-plot-btn {
    display: block;
    position: relative;
    margin-top: 3px;
    margin-bottom: 1px;
}

.chsp-atom-color-property {
    display: grid;
    align-items: center;
    justify-items: center;
    grid-template-columns: 1fr 1fr;
    column-gap: 1em;
    margin: 0.5em 0;
}

.chsp-atom-extra-options {
    display: grid;
    align-items: center;
    justify-items: center;
    grid-template-columns: auto 1fr 1fr;
    column-gap: 1em;
}

.chsp-atom-labels-property {
    display: grid;
    align-items: center;
    justify-items: center;
    grid-template-columns: 1fr 1fr;
    column-gap: 1em;
    margin: 0.5em 0;
}

.chsp-atom-extra-options > * {
    margin: 0.5em 0;
}

.chsp-atom-extra-options label {
    min-width: auto;
}

.chsp-atom-extra-options {
    grid-column: 1 / span 2;
}

.chsp-target-toggle {
    padding-left: 5px;
    padding-right: 5px;
    display: flex;
    justify-content: flex-end;
    gap: 5px;
}

.chsp-target-spinner {
    width: 25px;
    height: 25px;
    margin-left: 5px;
}

/* make sure there are sane styling options for the modal dialogues,
to avoid unreadable text when using dark themes */
:root {
    --cs-modal-background-light: #eee;
    --cs-modal-text-light: #222;
    --cs-modal-background-dark: #222;
    --cs-modal-text-dark: #eee;
}

.modal-content,
.modal-header,
.modal-footer {
    color: var(--cs-modal-text-light);
    background-color: var(--cs-modal-background-light);
}

@media (prefers-color-scheme: dark) {
    .modal-content,
    .modal-header,
    .modal-footer {
        background-color: var(--cs-modal-background-dark);
        color: var(--cs-modal-text-dark);
    }
}
