/* Color scheme variables */
:root {
    --bg-primary: #faf9f5;
    --bg-secondary: #f0eee6;
    --text-primary: #1d1d1f;
    --text-secondary: #a5a295;
    --text-completed: #cac8b9;
    --border-color: #e5e2d5;
    --accent-blue: #007aff;
    --hover-bg: #f3f2ec;
    --checkbox-bg: #ffffff;
    --checkbox-border: #a5a295;
    --delete-hover: #ff3b30;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1c1c1e;
        --bg-secondary: #2c2c2e;
        --text-primary: #f5f5f7;
        --text-secondary: #98989d;
        --text-completed: #48484a;
        --border-color: #38383a;
        --accent-blue: #0a84ff;
        --hover-bg: #2c2c2e;
        --checkbox-bg: #2c2c2e;
        --checkbox-border: #48484a;
        --delete-hover: #ff453a;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family:
        Iowan Old Style,
        Apple Garamond,
        Baskerville,
        Times New Roman,
        Droid Serif,
        Times,
        Source Serif Pro,
        serif,
        Apple Color Emoji,
        Segoe UI Emoji,
        Segoe UI Symbol;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

.container {
    padding: 40px;
}

header {
    margin-bottom: 20px;
}

h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    outline: none;
    cursor: text;
    border-radius: 4px;
    padding: 4px 8px;
    margin-left: -8px;
    transition: background-color 0.2s ease;
}

h1:hover {
    background-color: var(--hover-bg);
}

h1:focus {
    background-color: var(--hover-bg);
}

.todo-list {
    overflow: hidden;
}

.add-todo-form {
    max-width: 500px;
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--bg-secondary);
}

#new-todo-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}

#new-todo-input::placeholder {
    color: var(--text-secondary);
}

.todos {
    list-style: none;
    min-width: 500px;
    display: inline-block;
}

.todo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 8px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
    gap: 12px;
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-item:hover {
    background-color: var(--hover-bg);
}

.todo-item.completed .todo-text {
    color: var(--text-completed);
    text-decoration: line-through;
}

/* Checkbox-4 styles */
.checkbox-wrapper {
    flex-shrink: 0;
    display: flex;
}

.checkbox-wrapper * {
    box-sizing: border-box;
}

.checkbox-wrapper .cbx {
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
    display: inline-block;
}

.checkbox-wrapper .cbx:not(:last-child) {
    margin-right: 6px;
}

.checkbox-wrapper .cbx:hover {
    background: rgba(0, 119, 255, 0.06);
}

.checkbox-wrapper .cbx span {
    float: left;
    vertical-align: middle;
    transform: translate3d(0, 0, 0);
}

.checkbox-wrapper .cbx span:first-child {
    position: relative;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    transform: scale(1);
    border: 1px solid #cccfdb;
    transition: all 0.2s ease;
    box-shadow: 0 1px 1px rgba(0, 16, 75, 0.05);
}

.checkbox-wrapper .cbx span:first-child svg {
    position: absolute;
    top: 3px;
    left: 2px;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 16px;
    stroke-dashoffset: 16px;
    transition: all 0.3s ease;
    transition-delay: 0.1s;
    transform: translate3d(0, 0, 0);
}

.checkbox-wrapper .cbx span:last-child {
    padding-left: 8px;
    line-height: 18px;
    font-size: 15px;
    color: var(--text-primary);
    transition:
        color 0.2s ease,
        text-decoration 0.2s ease;
}

.checkbox-wrapper .cbx:hover span:first-child {
    border-color: #07f;
}

.checkbox-wrapper .inp-cbx {
    position: absolute;
    visibility: hidden;
}

.checkbox-wrapper .inp-cbx:checked + .cbx span:first-child {
    background: #07f;
    border-color: #07f;
}

.checkbox-wrapper .cbx span:first-child.animate {
    animation: wave-4 0.4s ease;
}

.checkbox-wrapper .inp-cbx:checked + .cbx span:first-child svg {
    stroke-dashoffset: 0;
}

.checkbox-wrapper .inline-svg {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
    user-select: none;
}

@media screen and (max-width: 640px) {
    .checkbox-wrapper .cbx {
        width: 100%;
        display: inline-block;
    }
}

@keyframes wave-4 {
    50% {
        transform: scale(0.9);
    }
}

/* Completed state for text */
.todo-item.completed .checkbox-wrapper .cbx span:last-child {
    color: var(--text-completed);
    text-decoration: line-through;
}

.delete-btn {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    transition:
        opacity 0.2s ease,
        color 0.2s ease;
    flex-shrink: 0;
}

.todo-item:hover .delete-btn {
    opacity: 1;
}

.todo-item.completed .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    color: var(--delete-hover);
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}
