:root {
    --form-control-color: hsl(198, 100%, 28%);
    --sidebar-width: 26rem;
    --indifference-class-gap: 10px;
}

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;
    min-height: 100vh;
}

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: hsl(198, 64%, 38%);
}

aside button:active {
    transform: scale(0.98);
    background-color: hsl(198, 60%, 45%);
}

aside button:disabled {
    background-color: hsl(198, 22%, 36%);
    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(198, 62%, 37%);
}

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

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

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

aside input[type=checkbox] {
    accent-color: hsl(198, 76%, 40%);
    width: 1.5em;
    height: 1.5em;
}

aside input[type=checkbox]:checked {
    outline: 1px solid #cccccc55;
}

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

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 tr.voter-row .delete-voter-icon {
    display: none;
}

table tr.voter-row:hover .delete-voter-icon {
    display: inline;
}

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: 10em;
    text-align: left;
    height: 20px;
}

/* 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 tr.category-row:first-child td {
    border-top: 0;
    padding-top: 0;
}

table tr.category-row td {
    text-transform: uppercase;
    font-size: 75%;
    border-left: none;
    border-right: none;
    font-weight: 600;
    padding-top: 7px;
    padding-bottom: 0;
}

table th {
    font-weight: bold;
}

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

#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(243, 76%, 94%);
    color: hsl(243, 76%, 10%);
    cursor: pointer;
    box-shadow: inset 0 0 4px #ccc, inset 0 0 2px #eee;
}

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

#profile-table tr.rule-row .candidate-chip {
    cursor: default;
}

.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);
}

/*             */
/*             */
/* Weak orders */
/*             */
/*             */
/*             */

.weak-order {
    display: flex;
    flex-direction: row;
    margin-left: calc(-1 * var(--indifference-class-gap) + 5px);
    margin-right: 5px;
}

.weak-order-indifference-class {
    display: flex;
    flex-direction: row;
    margin-left: calc(var(--indifference-class-gap) / 2);
    margin-right: calc(-1 * var(--indifference-class-gap) / 2);
    transition: margin 70ms ease-in-out; /* for animation */
}

.weak-order-indifference-class:has(.weak-order-item) {
    margin-left: var(--indifference-class-gap);
    margin-right: 0;
}

.candidate-chip.weak-order-item {
    user-select: none;
    margin: 0;
    border-radius: 0;
}

.weak-order-item:first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
}

.weak-order-item:last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
}

.weak-order-item.weak-order-dragging {
    background-color: antiquewhite;
}

.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;
}

.ranking-trash {
    width: 3em;
    height: 1.2em;
    background: center / auto 0.9em no-repeat url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" class="bi bi-trash3" viewBox="0 0 16 16"><path d="M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5ZM11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H2.506a.58.58 0 0 0-.01 0H1.5a.5.5 0 0 0 0 1h.538l.853 10.66A2 2 0 0 0 4.885 16h6.23a2 2 0 0 0 1.994-1.84l.853-10.66h.538a.5.5 0 0 0 0-1h-.995a.59.59 0 0 0-.01 0H11Zm1.958 1-.846 10.58a1 1 0 0 1-.997.92h-6.23a1 1 0 0 1-.997-.92L3.042 3.5h9.916Zm-7.487 1a.5.5 0 0 1 .528.47l.5 8.5a.5.5 0 0 1-.998.06L5 5.03a.5.5 0 0 1 .47-.53Zm5.058 0a.5.5 0 0 1 .47.53l-.5 8.5a.5.5 0 1 1-.998-.06l.5-8.5a.5.5 0 0 1 .528-.47ZM8 4.5a.5.5 0 0 1 .5.5v8.5a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5Z"/></svg>') #dfdfdf;
    border-radius: 5px;
    padding-top: 2px;
    padding-bottom: 4px;
    margin-left: 8px;
    display: none;
    font-size: 13px;
    vertical-align: middle;
    text-align: center;
}

.candidate-chip {
    display: inline-block;
    user-select: none;
    font-size: 13px;
    border: none;
    border-radius: 5px;
    padding-top: 2px;
    padding-bottom: 4px;
    margin: 0 5px;
    width: 2.5em;
    height: 1em;
    cursor: pointer;
    color: white;
    text-shadow: 0px 0px 4px black;
    text-align: center;
}

.candidate-chip.ghost-chip {
    outline: 2px solid #ccc;
}

.ranking-trash .ghost-chip {
    font-size: 10px;
}

.candidate-chip.not-agenda {
    background-color: #dfdfdf !important;
    text-shadow: none;
    color: #999;
}

/************************
    * 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.category-item {
    margin-top: 1em;
    text-transform: uppercase;
    font-size: 78%;
    font-weight: 600;
}

#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%;
    }

    #budget-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;
    }

    #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;
    }

    .candidate-chip {
        width: 28px;
        height: 25px;
        padding-bottom: 0;
        line-height: 1.7;
    }
}

#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(243, 76%, 20%);
        color: hsl(243, 76%, 90%);
        box-shadow: inset 0 0 4px #333, inset 0 0 2px #444;
    }

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

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

    #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;
    }
}