* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

/* Body & Layout */
body {
    width: 300px;
    height: 100vh;
    min-height: 400px;
    max-height: 900px;
    background-color: #f9f9f9;
    color: #333;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.container {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
header {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.filter {
    display: flex;
    margin-bottom: 12px;
}

.filter-btn {
    flex: 1;
    padding: 6px;
    border: 1px solid #ccc;
    background-color: white;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    font-size: 14px;
    user-select: none;
    /* Remove border-radius on all but corners to link buttons */
    border-radius: 0;
    position: relative;
    z-index: 1;
}

/* First button: rounded left corners */
.filter-btn:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

/* Last button: rounded right corners */
.filter-btn:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Remove double borders between buttons by hiding left border on buttons except first */
.filter-btn:not(:first-child) {
    border-left: none;
}

/* Selected/active style */
.filter-btn.selected,
.filter-btn.active {
    background-color: #4caf50;
    color: white;
    border-color: #4caf50;
    z-index: 2;
    /* put selected on top */
}

/* Hover style */
.filter-btn:hover:not(.selected):not(.active) {
    background-color: #eee;
    color: black;
}

.inpt {
    display: flex;
    gap: 8px;
}

#todo-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}

#add-btn {
    padding: 8px 12px;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

#add-btn:hover {
    background-color: #45a049;
}

/* Main Todo List */
main {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    margin-right: -4px;
}

/* Scrollbar for main */
main::-webkit-scrollbar {
    width: 6px;
}

main::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

main::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

main::-webkit-scrollbar-thumb:hover {
    background: #999;
}

#todo_list {
    list-style: none;
    padding-left: 0;
}

/* Todo Items */
.todo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    margin-bottom: 6px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.todo-item.completed .content {
    text-decoration: line-through;
    color: #999;
}

.todo-item .view {
    display: flex;
    align-items: center;
    flex-grow: 1;
    gap: 8px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    white-space: normal;
}

.toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* Style when checked */
.toggle:checked {
    background-color: #4caf50;
    border-color: #4caf50;
}

/* Checkmark */
.toggle:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.content {
    flex-grow: 1;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: 14px;
}

/* Fix: Make the delete button always visible and styled */
.destroy {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    background-color: transparent;
    border: none;
    color: black;
    font-size: 16px;
    padding: 0 6px;
    user-select: none;
    flex-shrink: 0;
}

.todo-item:hover .destroy {
    display: inline-block;
    opacity: 1;
}

.destroy:hover {
    color: #4caf50;
}

/* Footer */
footer {
    width: 100%;
    height: 50px;
    position: fixed;
    bottom: 0;
    left: 0;
    display: flex;
    justify-content: space-between;
    /* align content to right */
    align-items: center;
    gap: 12px;
    background-color: #f9f9f9;
    border-top: 1px solid #ddd;
    padding: 10px 20px;
    /* add some right padding */
    font-size: 14px;
    color: #555;
}

/* Link inside footer */
footer a {
    text-decoration: none;
    color: #4caf50;
    font-weight: 600;
    font-size: 12px;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
    transition: color 0.3s ease;
}

/* Float animation */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

/* Hover effect */
footer a:hover {
    color: #388e3c;
    animation-play-state: paused;

}

/* Hover effect */
footer a:hover {
    color: #388e3c;
    /* darker green on hover */
    animation-play-state: paused;
    /* pause float on hover */
}

/* Responsive */
@media (max-height: 500px) {
    body {
        max-height: none;
        height: 100vh;
    }

    .container {
        padding-bottom: 50px;
    }

    footer {
        height: 40px;
    }

    .github-icon {
        width: 25px;
        height: 25px;
    }
}

@media (min-height: 600px) {
    main {
        min-height: 300px;
    }
}

.toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 50%;
    /* makes it a circle */
    background-color: white;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* Style when checked */
.toggle:checked {
    background-color: #4caf50;
    border-color: #4caf50;
}

/* Checkmark */
.toggle:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 0px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.msg {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    /* remove default margin */
    text-align: center;
    width: 100%;
}

#theme-toggle {
    background-color: none;
    align-items: start;
    font-size: 1.8rem;
    color: #333;
    border-radius: 50%;
    font-size: 20px;
    display: flex;
    justify-content: center;
    cursor: pointer;
    align-items: center;
    transition: background-color 0.3s, transform 0.2s;
}

#theme-toggle:hover {
    transform: scale(1.1);
}