:root {
    --form-control-color: rgb(55, 0, 143);
    --sidebar-width: 25rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    padding: 0;
    margin: 0;
    position: relative;
}

h1 {
    font-size: 150%;
    color: white;
    margin: 0;
    position: fixed;
    top: 1em;
    left: 1em;
    z-index: 3;
}

main {
    display: flex;
    gap: 1em;
}

aside {
    position: fixed;
    padding: 1em 1.4em;
    padding-top: 4.3em;
    /* background-color: #3423A6; */
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    min-height: 100%;
    box-sizing: border-box;
    background-color: var(--form-control-color);
    display: flex;
    flex-direction: column;
    color: white;
    gap: 0.7em;
    z-index: 2;
}

h1 svg {
    height: 1em;
    margin-bottom: -3px;
}

aside a,
aside a:hover {
    color: white;
}

aside pre {
    max-width: 26em;
    max-height: 15.7em;
    font-size: 80%;
    overflow: auto;
    user-select: all;
}

aside p {
    font-size: 90%;
}

aside details {
    margin-top: 0em;
    max-width: 20em;
}

aside details summary {
    cursor: pointer;
}

aside button {
    padding: 1em;
    border: 2px solid var(--form-control-color);
    background-color: var(--form-control-color);
    color: white;
    border-radius: 10px;
    box-shadow: inset 0 0 5px #ccc;
    cursor: pointer;
}

aside button:hover {
    transform: scale(1.02);
    background-color: rgb(83, 35, 160);
}

aside button:active {
    transform: scale(0.98);
    background-color: rgb(98, 46, 182);
}

aside button:disabled {
    background-color: rgb(87, 71, 112);
    box-shadow: inset 0 0 5px #333;
    color: #bbb;
    cursor: not-allowed;
}

aside button#random-options-button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

aside button#random-button {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    margin-right: -2px;
    background-color: hsl(282, 62%, 37%);
}

aside button#random-button:hover {
    background-color: hsl(282, 62%, 45%);
}

.checkbox-option label,
.checkbox-option input {
    cursor: pointer;
}

aside #credits {
    font-size: 80%;
    margin-top: auto;
}

aside input[type=checkbox] {
    accent-color: rgb(132, 24, 179);
    width: 1.5em;
    height: 1.5em;
}

aside .checkbox-option {
    display: flex;
    gap: 0.3em;
    align-items: center;
}

#committee-size-controls {
    accent-color: rgb(238, 203, 253);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5em;
    border: 1px solid rgba(255, 255, 255, 0.269);
    padding: 1em;
    border-radius: 0.5em;
}

#committee-size-controls>div {
    text-align: center;
}

#committee-size-input {
    width: 3em;
    background-color: hsl(282, 93%, 95%);
    border: 0;
    border-radius: 5px;
    padding: 3px;
    padding-left: 6px;
}

section {
    padding: 1em 1em 1em calc(var(--sidebar-width) + 1em);
    display: flex;
    flex-direction: column;
    order: 2;
    align-items: flex-start;
    justify-content: flex-start;
}

#dismissable-about {
    background-color: hsl(50, 80%, 90%);
    border: 1px solid hsl(50, 80%, 60%);
    margin: 0;
    margin-bottom: 1em;
    padding: 1em;
    padding-right: 1.4em;
    position: relative;
    box-sizing: border-box;
    width: calc(100vw - var(--sidebar-width) - 2em);
    z-index: 2;
}

#dismiss-button {
    position: absolute;
    top: 0.1em;
    right: 0.1em;
    cursor: pointer;
    font-size: 130%;
    color: hsl(50, 80%, 35%);
    display: inline-block;
    text-align: center;
    width: 1.2em;
    height: 1.2em;
    border-radius: 1em;
}

#dismiss-button:hover {
    color: hsl(50, 80%, 20%);
    background-color: hsl(50, 80%, 60%);
}

table {
    border-spacing: 0;
    display: block;
    margin-bottom: var(--ifm-spacing-vertical);
}

table thead {
    position: sticky;
    inset-block-start: 0;
    background-color: #f7f7f7;
}

table tr.voter-row:nth-child(2n) {
    background-color: rgba(0, 0, 0, 0.03);
}

table th,
table td {
    border-right: 1px solid #dadde1;
    border-top: 1px solid #dadde1;
    padding: 0.4rem;
}

table th:first-child,
table td:first-child {
    border-left: 1px solid #dadde1;
    width: 8em;
    text-align: left;
}

body.using-weights table th:first-child,
body.using-weights table td:first-child {
    width: auto;
    min-width: 5em;
}

table tbody tr:first-child td {
    border-top: 0;
}

table tr.last-voter td,
table tr:last-child td {
    border-bottom: 1px solid #dadde1;
}

table thead tr td {
    border-bottom: 2px solid #dadde1 !important;
}

table th {
    font-weight: bold;
}

table td {
    text-align: center;
}

td.empty-cell {
    border: 0 !important;
    background: white;
    text-align: left;
    padding: 0;
    position: relative;
}

td.hidden-column { 
    display: none; 
}

td.weight-cell input {
    width: 3em;
}

#profile-table .rule-table-rows {
    position: sticky;
    inset-block-end: 0;
    bottom: 0;
    box-shadow: 0 0 1em white, 0 0 1em white;
}

#profile-table .rule-table-rows tr {
    background-color: white;
}

#profile-table tr.rule-row:hover {
    background-color: hsl(282, 76%, 94%);
    color: hsl(282, 76%, 20%);
    cursor: pointer;
    box-shadow: inset 0 0 4px #ccc, inset 0 0 2px #eee;
}

#profile-table tr.rule-row:active {
    background-color: hsl(282, 76%, 88%);
    cursor: pointer;
    transform: scale(0.99);
}

#profile-table td.in-committee {
    background-color: hsla(282, 30%, 60%, 0.1);
}

.delete-icon {
    cursor: pointer;
    display: inline;
    color: #a0a0a0;
}

.delete-icon:hover {
    color: #666;
}

.delete-icon:hover svg {
    transform: scale(1.1);
}

.delete-icon:active svg {
    transform: scale(0.98);
}

.info-cell {
    line-height: 0;
}

.info-cell:hover {
    color: rgb(55, 0, 143);
    background-color: rgba(0, 0, 0, 0.05);
    cursor: pointer;
}

.property-cell-satisfied {
    color: darkgreen;
    font-size: 90%;
    padding: 0.1rem;
    position: absolute;
    top: 0.5em;
    left: 0.5em;
    width: 5em;
}

.property-cell-failed {
    color: darkred;
    font-size: 90%;
    padding: 0.1rem;
    position: absolute;
    top: 0.5em;
    left: 0.5em;
    width: 5em;
}

button.active {
    background-color: darkgreen;
    color: white;
}

button.approval-button {
    border: none;
    border-radius: 5px;
    padding: 5px;
    width: 2em;
    height: 2em;
    cursor: pointer;
}

button.approval-button.unapproved {
    background-color: #ddd;
    color: #777;
}

button.approval-button.approved {
    background-color: darkgreen;
    color: white;
}

button.approval-button:hover {
    transform: scale(1.05);
}

button.approval-button.unapproved:hover {
    background-color: #ccc;
}

button.approval-button.approved:hover {
    background-color: rgb(9, 129, 9);
}

button.approval-button:active {
    transform: scale(0.96);
}

/************************
    * Modal styling
************************/

.hystmodal__window {
    padding: 1em;
}

#committee-info-modal pre,
#export-modal pre {
    max-height: 17em;
    background-color: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    overflow-y: scroll;
    white-space: pre-wrap;
    padding: 0.3rem 0.6rem;
}

#export-modal pre {
    max-height: 14em;
    margin-bottom: 0.3em;
    /* single click select all */
    user-select: all;
}

#export-modal button {
    margin-bottom: 0.6em;
}

summary {
    cursor: pointer;
}

#committee-info-modal-properties-list details {
    margin: 0.5em;
}

#committee-info-modal-properties-list summary.satisfied {
    color: darkgreen;
}

#committee-info-modal-properties-list summary.failed {
    color: darkred;
}

#rule-choice-list {
    list-style-type: none;
    padding: 0;
}

#rule-choice-list li {
    margin-top: 0.25em;
}

#rule-choice-list li input {
    margin-right: 0;
    cursor: pointer;
    transform: scale(1.12);
}

#rule-choice-list li label {
    cursor: pointer;
    padding-left: 0.4em;
}

ul#probability-distributions-list {
    list-style-type: none;
    padding: 0;
}

ul#probability-distributions-list li {
    margin-top: 0.25em;
}

.random-parameter {
    margin-top: 0.5em;
    margin-left: 2em;
}

#library-list li {
    margin: 0.5em 0;
}

.citation {
    display: block;
    font-size: 90%;
    color: #333;
}

@media screen and (max-width: 1024px) {
    :root {
        --sidebar-width: 20rem;
    }

    aside {
        gap: 0.5em;
        padding: 0.7em;
        padding-top: 3.3em;
    }

    h1 {
        top: 0.6em;
        left: 0.7em;
    }

    #copy-button {
        display: none;
    }
}

@media screen and (max-width: 768px) {
    :root {
        --sidebar-width: 16rem;
    }

    main {
        gap: 0;
    }

    aside {
        gap: 0.3em;
        padding: 0.5em 0.7em;
        padding-top: 3.3em;
        font-size: 88%;
    }

    h1 {
        font-size: 120%;
    }

}

@media screen and (max-width: 600px) {
    :root {
        --sidebar-width: 0rem;
    }

    body {
        /* prevent horizontal overflow */
        overflow-x: hidden;
    }

    main {
        flex-direction: column;
        gap: 0;
        width: 100vw;
    }

    aside {
        position: static;
        min-height: none;
        width: 100vw;
        gap: 0.5em;
        padding: 3em 1em 0 1em;
        height: auto;
        box-shadow: 0px 3px 3px #ccc;
    }

    h1 {
        font-size: 120%;
        margin: 0;
    }

    aside #credits {
        margin-top: 0.2em;
        font-size: 75%;
    }

    #committee-size-controls {
        padding: 0.3em;
        font-size: 90%;
        gap: 0.1em;
    }

    aside button {
        padding: 0.5em;
    }

    aside .checkbox-option {
        font-size: 90%;
    }

    section {
        padding: 0.1em;
        width: 100vw;
        max-width: 100vw;
        overflow-x: scroll;
        font-size: 90%;
    }

    #dismissable-about {
        width: 100%;
        margin-top: 0.3em;
    }

    aside button {
        width: 100%;
        max-width: 100%;
    }

    #hint-paste,
    #hint-drop,
    #copy-button {
        display: none;
    }

    table td {
        padding: 2px;
    }

    button.approval-button {
        width: 18px;
        height: 18px;
        padding: 1px;
    }
}

#loading-container {
    display: none;
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 1;
}

@media screen and (max-width: 600px) {
    #loading-container {
        z-index: 4;
    }
}

#loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.5);
    padding: 1em;
    border-radius: 5px;
    box-shadow: 30px 0 0 rgba(255, 255, 255, 0.5);
}

#drop-overlay {
    pointer-events: none;
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.5);
    z-index: 9999;
}

#drop-overlay-instruction {
    pointer-events: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.8);
    padding: 1em;
    border-radius: 5px;
    box-shadow: 30px 0 0 rgba(255, 255, 255, 0.5);
    font-size: 150%;
}

/* dark mode */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #222;
        color: #eee;
    }

    #dismissable-about {
        background-color: hsl(50, 80%, 25%);
        border: 1px solid hsl(50, 80%, 40%);
        color: #eee;
    }

    table thead {
        position: sticky;
        inset-block-start: 0;
        background-color: #363636;
    }

    table tr.voter-row:nth-child(2n) {
        background-color: #303030;
    }

    td {
        border-color: #555 !important;
    }

    td.empty-cell {
        background: #222;
    }

    #profile-table .rule-table-rows {
        box-shadow: 0 0 1em #444, 0 0 1em #444;
    }

    #profile-table .rule-table-rows tr {
        background-color: #222;
    }

    #profile-table tr.rule-row:hover {
        background-color: hsl(282, 76%, 20%);
        color: hsl(282, 76%, 90%);
        box-shadow: inset 0 0 4px #333, inset 0 0 2px #444;
    }

    #profile-table tr.rule-row:active {
        background-color: hsl(282, 76%, 35%);
    }

    #profile-table td.in-committee {
        background-color: hsla(282, 70%, 37%, 0.8);
    }

    button.approval-button.unapproved {
        background-color: #555;
        color: #bbb;
    }

    button.approval-button.unapproved:hover {
        background-color: #777;
        color: #ccc;
    }

    button.approval-button.approved {
        background-color: rgb(23, 151, 23);
        color: white;
    }

    #loading-indicator,
    #loading-container {
        background-color: rgba(255, 255, 255, 0.15);
        color: white;
        box-shadow: none;
    }

    .hystmodal__window {
        background-color: #222 !important;
        color: #eee;
    }

    .hystmodal__window button {
        background-color: #444;
        color: #eee;
    }

    #committee-info-modal pre,
    #export-modal pre {
        background-color: #333;
        border-color: #444;
    }

    #committee-info-modal-properties-list summary.failed,
    .property-cell-failed {
        color: rgb(213, 27, 27);
    }

    #committee-info-modal-properties-list summary.satisfied,
    .property-cell-satisfied {
        color: rgb(14, 137, 14);
    }

    .citation,
    .citation a {
        color: #ddd;
    }

    table thead tr td {
        border-bottom: 2px solid #777 !important;
    }

    #drop-overlay-instruction {
        color: black;
    }
}