:root {
    --primary-blue: #0069c2;

    --text-primary: #1b1b1b;
    --text-secondary: #4e4e4e;
    --text-inactive: #9e9e9ea6;
    --text-yellow: #e3b10b;
    --text-link: var(--primary-blue);
    --text-invert: #fff;
    --background-primary: #fff;
    --background-secondary: #f9f9fb;
    --background-tertiary: #fff;
    --background-yellow: #FDF7DF;
    --background-mark-yellow: #dec90f;
    --background-mark-green: #09954a;
    --background-information: rgba(0, 133, 242, .1);
    --background-warning: rgba(255, 42, 81, .1);
    --background-critical: rgba(211, 0, 56, .1);
    --background-success: rgba(0, 121, 54, .1);
    --border-primary: rgba(0, 0, 0, 0.1);
    --border-secondary: #cdcdcd;

    --button-disabled-background: #9e9e9ea6;
    --button-disabled-text: #4e4e4e;
    --button-blue-background: var(--primary-blue);
    --button-blue-text: #fff;
    --button-green-background: #007936;
    --button-green-text: #fff;
    --button-red-background: #d30038;
    --button-red-text: #fff;
    --button-yellow-background: #df9f05;;
    --button-yellow-text: #fff;

    --text-primary-red: #d30038;
    --text-primary-green: #007936;
    --text-primary-blue: var(--primary-blue);
    --text-primary-yellow: #746a00;

    --hr: rgba(0, 0, 0, 0.1);

    --main-bg: #f5f5f5;
    --header-bg: #ebebeb;
    --input-bg: white;
    --hover: #eeeeee;
    --bullet: #a3a3a3;
    --bullet-active: black;
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary-blue: #8cb4ff;

        --text-primary: #bebebe;
        --text-secondary: #cdcdcd;
        --text-inactive: #5a5a5a;
        --text-yellow: #9e7e13;
        --text-invert: #1b1b1b;
        --background-primary: #1b1b1b;
        --background-secondary: #343434;
        --background-tertiary: #4e4e4e;
        --background-yellow: #57542d;
        --background-toc-active: #343434;
        --background-mark-yellow: #6e6621;
        --background-mark-green: #008d42;
        --background-information: rgba(0, 133, 242, .1);
        --background-warning: rgba(255, 42, 81, .1);
        --background-critical: rgba(211, 0, 56, .1);
        --background-success: rgba(0, 121, 54, .1);
        --border-primary: rgba(255, 255, 255, 0.1);
        --border-secondary: #696969;


        --button-disabled-background: #cdcdcda6;
        --button-disabled-text: #cdcdcd;
        --button-blue-text: #1b1b1b;
        --button-green-background: #00d061;
        --button-green-text: #1b1b1b;
        --button-red-background: #c00d1b;
        --button-red-text: #1b1b1b;
        --button-yellow-background: #c7b700;;
        --button-yellow-text: #1b1b1b;

        --text-primary-red: #ff97a0;
        --text-primary-green: #00d061;
        --text-primary-yellow: #c7b700;

        --hr: rgba(255, 255, 255, 0.1);

        --main-bg: #292929;
        --input-bg: #222222;
        --hover: #252525;
        --header-bg: #222222;
        --bullet: #757575;
        --bullet-active: white;

    }
}


body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 4em 0 6em;
    background-color: var(--main-bg);
    color: var(--text-primary);
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.conn-err {
    z-index: 100;
    display: none;
    position: fixed;
    width: 0.5em;
    height: 0.5em;
    background: var(--button-red-background);
    top: 0;
    margin: 0.1em;
    border-radius: 1em;
}

header {
    z-index: 10;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5em;
    background: var(--header-bg);
}

db-picker {
    display: block;
    font-weight: bold;
    cursor: pointer;
    padding: .1em 1em;
    -webkit-tap-highlight-color: transparent;
}

db-picker .bullets {
    min-width: 5em;
    margin-top: .3em;
    display: flex;
    gap: .4em;
}

edit-button {
    cursor: pointer;
}

edit-button svg {
    width: 1.1em;
    height: auto;
    cursor: pointer;
}

edit-button path {
    fill: var(--text-primary);
}

db-picker .bullets div {
    width: .4em;
    height: .4em;
    border-radius: 1em;
    background: var(--bullet);
}

db-picker .bullets div.active {
    background: var(--bullet-active);
}

.checkbox {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    border: 1px solid grey;
    border-radius: 2px;
    transition: background-color .5s, border-color .5s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.task-item.checked .checkbox, task-item.completed .checkbox {
    background: var(--background-mark-green);
    border-color: var(--background-mark-green);
}

task-item.completed span {
    color: var(--background-mark-green);
}

task-item.completed .checkbox::before {
    content: '';
    width: 1em;
    height: 1em;
    border-radius: 100%;
    transform: scale(0);
    position: absolute;
    background: var(--background-mark-green);
    animation: item-completion 1s;
}

@keyframes item-completion {
    100% {
        transform: scale(5);
        opacity: 0;
    }
}

task-item.completed {
    transform: translateX(.5em);
}

.task-item.checked {
    color: var(--text-inactive);
}

task-item {
    display: block;
    transition: transform 1s;
}


.task-list.dragging task-item:not(.dragged) {
    transition: transform .1s;
}

task-item > div {
    display: flex;
    gap: 1em;
    align-items: center;
    padding: 10px;
}

task-item.dragged {
    position: fixed;
    top: 0;
    left: 0;
    background: var(--hover);
    transition: none;
}

task-item.hidden {
    opacity: 0;
}

task-item.dragged .task-item:hover {
    background: inherit;
}

@media (hover: hover) {
    task-item:hover {
        background: var(--hover);
    }
}

task-item span {
    flex-grow: 1;
    transition: color .5s;
}

.mover {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    margin: -10px;
    padding: 10px;
    cursor: grab;
}

.mover > div {
    width: 3px;
    height: 3px;
    border-radius: 2px;
    background: grey;
}

.new-task-input {
    z-index: 10;
    font-size: 20px;
    padding: 8px;
    width: 100%;
    max-width: 800px;
    border: none;
    background: var(--input-bg);
    color: inherit;
    margin-bottom: 1em;
}

.new-task-input:focus {
    outline: none;
}

.new-task-input::placeholder {
    color: var(--text-secondary);
}

.add-task-container {
    position: fixed;
    display: flex;
    left: 0;
    bottom: 0;
    right: 0;
    padding: 0.5em;
    justify-content: center;
    background: var(--input-bg);
}


/* Align the remove buttons to the right */
.task-item svg {
    display: none;
    border: 1px solid #d32f2f;
    border-radius: 2px;
    cursor: pointer;
    padding: 4px;
    fill: #fff;
    width: .6em;
    height: .6em;
    flex-shrink: 0;
}

select {
    background: none;
    border: 1px solid var(--border-primary);
    padding: 0.25em;
    outline: none;
    font-size: inherit;
    font-weight: bold;
    color: var(--text-primary);
}


.container.edit .mover {
    display: grid;
}

.container.edit svg {
    display: block;
}

.container.edit .checkbox {
    display: none;
}
