/* ------------------ GLOBAL ------------------ */

* {
    box-sizing: border-box;
}

body {
    background-color: beige;
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 0;
}


/* ------------------ CONTAINER ------------------ */

.container {
    width: 100%;
    max-width: 800px;
    min-height: 400px;
    margin: 40px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}


/* ------------------ TODO FORM ------------------ */

.todoform {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.todoform input {
    flex: 1;
    min-width: 200px;
    border: none;
    outline: none;
    padding-left: 10px;
    font-size: large;
    border-bottom: 2px solid gray;
    transition: border-color 0.3s;
}

.todoform input:focus {
    border-bottom: 2px solid rgb(90, 150, 0);
}

.todoform > button {
    min-width: 100px;
    height: 35px;
    border-radius: 5px;
    color: white;
    border: 1px solid black;
    font-size: large;
    cursor: pointer;
    transition: background-color ease-in-out 0.2s;
}

.todoform > button:first-of-type {
    background-color: #70e000;
}

.todoform > button:last-of-type {
    background-color: #f44336;
}

.todoform > button:first-of-type:hover {
    background-color: #64b80f;
}

.todoform > button:last-of-type:hover {
    background-color: #b73b32;
}


/* ------------------ SORT CHECKBOX ------------------ */

.checkboxform {
    background-color: #0091df;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 100px;
    height: 35px;
    border: 1px solid black;
    border-radius: 5px;
    font-size: larger;
    transition: background-color ease-in-out 0.2s;
}

.checkboxform:hover {
    background-color: #0544d8;
}

.checkboxform label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.checkboxform input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: white;
}


/* ------------------ TODO LIST ------------------ */

.todolist {
    display: flex;
    justify-content: center;
}

#todoul {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}


/* ------------------ TODO ITEM ------------------ */

.todoli {
    font-size: large;
    display: flex;
    flex-direction: column;          /* mobile default */
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 10px;
    background-color: #fefefe;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    transition: transform 0.1s, box-shadow 0.2s;
    touch-action: none;              /* mobile drag */
}

.todoli:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}


/* ------------------ TODO TEXT ------------------ */

.textvalue {
    word-break: break-word;
}


/* ------------------ BUTTON GROUP ------------------ */

.libtn {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.todoli > .libtn > button {
    min-width: 85px;
    height: 30px;
    color: white;
    border-radius: 5px;
    border: 1px solid black;
    font-size: small;
    cursor: pointer;
    transition: background-color 0.2s;
}

.editbtn { background-color: #0091df; }
.deletebtn { background-color: #f44336; }
.savebtn { background-color: #40ff00; }
.cancelbtn { background-color: #d0190c; }

.editbtn:hover { background-color: #0544d8; }
.deletebtn:hover { background-color: #b73b32; }
.savebtn:hover { background-color: #00b51e; }
.cancelbtn:hover { background-color: #900a00; }


/* ------------------ COMPLETED ------------------ */

.completed {
    background-color: rgb(219, 219, 219);
}

.completed .textvalue {
    text-decoration: line-through;
}


/* ------------------ EDIT MODE ------------------ */

.editinput {
    padding: 10px;
    width: 100%;
}


/* ------------------ DRAG ------------------ */

.dragging {
    opacity: 0.5;
}


/* ------------------ DESKTOP ONLY ------------------ */

@media (min-width: 768px) {
    body {
        margin: 16px;
        padding: 8px;
    }
    .todoli {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

@media (max-width: 600px) {
    .container {
        width: 100%;
        margin: 16px;
        padding: 8px;
    }
}
