html,
body {
    min-height: 100vh;
    height: 100%;

    --accent-color: #003399;
    --background-grey: #f4f4f4;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding-left: 0.5em;
    padding-right: 0.5em;

}


#viewer {
    display: flex;
    flex-direction: row;
    height: fit-content;
    min-height: 100vh;
}

#catalog-list {
    max-width: 400px;
    padding: 10px;
    overflow-y: scroll;
    background-color: var(--background-grey);
    border-right: 1px solid #ddd;
}

#catalog-list h2 {
    margin-top: 0;
}

#details {
    width: 70%;
    padding: 10px;
}

.sidebar-header {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 0.5em;
}

.sidebar-header button {
    width: 7em;
    height: 2em;
    padding: 0;
}

canvas {
    width: 100%;
    height: 300px;
    border: 1px solid #ccc;
    margin-top: 20px;
}

/* Updated CSS for the item elements in the catalog list */
.item {
    display: flex;
    flex-direction: column;

    background-color: white;
    border: 1px solid #ddd;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.item-title {
    font-size: 18px;
    margin: 0;
    color: #333;
}

.item-type {
    font-size: 14px;
    margin: 5px 0;
    color: #666;
}

.item-id,
.item-key-type {
    font-size: 12px;
    color: #999;
}

.item-description {
    font-size: 13px;
    margin: 5px 0;
    color: #444;
    font-style: italic;
}

.item.selected {
    background-color: var(--background-grey);
    border-color: var(--accent-color);
}


summary {
    h2 {
        display: inline;
    }
}
details[open] summary:has(> h2) {
    margin-bottom: 0.5em;
}

.json-pre {
    white-space: pre-wrap;
    /* background-color: #f9f9f9; */
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
}


/* Button styles */
button {
    height: 3em;
    padding: 10px 20px;
    /* Padding around button text */
    margin: 0 5px;
    /* Margin between buttons */
    background-color: var(--accent-color);
    /* ECMWF blue */
    color: white;
    /* White text color */
    border: none;
    /* Remove default button border */
    cursor: pointer;
    /* Pointer cursor on hover */
    border-radius: 5px;
    /* Rounded corners */
    transition: background-color 0.3s ease;
    /* Smooth background color transition */
}

button:hover {
    background-color: #001f66;
}


.item {
    position: relative;

    button.all {
        position: absolute;
        right: 10px;
        top: 10px;
        text-align: right;
        padding: 0;
        width: 1em;
        height: 1em;
        color: black;
        background-color: transparent;
        border-radius: 50%;
        font-size: 2em;
    }

    .checkbox-container[disabled]  {
        background-color: #d3d3d3;
    }

    .checkbox-container {
        display: grid;
        grid-template-columns: auto auto 1fr;
        grid-auto-rows: auto;
        grid-column-gap: 10px;
        grid-row-gap: 10px;

        margin-top: 20px;
        max-height: 200px;
        overflow-y: auto;
        padding: 10px;
        border: 1px solid #ccc;
        border-radius: 4px;
        background-color: #fff;

        div.checkbox-row:hover > * {
            color: var(--accent-color);
            &[type='checkbox'] {box-shadow: 0px 0px 5px var(--accent-color);}
        }

        div.checkbox-row {
            display: contents;

            /* Set the checkbox checked colour */
            input[type=checkbox]  {
                accent-color: var(--accent-color);
            }

            input[type='checkbox'] {
                grid-column-start: 1;
                height: 1.5em;
                width: 1.5em;
                align-self: center;
                cursor: pointer;
            }

            a.more-info {
                cursor: help;
                text-decoration: none;
                font-size: 0.7em;
                display: inline-flex;
                width: fit-content;
                min-width: 1em;
                padding: 0.1em;
                align-items: center;
                justify-content: center;
                aspect-ratio: 1 / 1;
                border-radius: 50%;
                border: 2px solid #666;
            }

            label {
                grid-column-start: 2;
                align-self: center;
                font-size: 16px;
                color: #333;
            }

            label.code {
                grid-column-start: 3;
                text-align: right;
                align-self: center;
            }

        }
    }

    .checkbox-container:hover .key-value {
        color: var(--accent-color);
    }
}

.list-label {
    font-weight: bold;
    margin-bottom: 0.5em;
    display: block;
    color: var(--accent-color);
}

span.key,
span.value {
    color: #ba2121;
    ;
}

span.key {
    font-weight: bold;
}

span.key:hover,
span.value:hover {
    color: #ff2a2a;
    cursor: pointer;
}

/* Change layout for narrow viewport */
@media (max-width: 800px) {
    #viewer {
        flex-direction: column;
    }

    #catalog-list {
        width: 100%;
        border-right: none;
    }

    #details {
        width: 100%;
    }
}

details h2 {
    font-size: medium;
}

.has-data {
    background-color: rgba(160, 255, 160, 0.346);
}


#date-picker {
    align-self: center;
    width: calc(50%);
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

div.air-datepicker {
    align-self: center;;
}
