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

body {
    font-family: "Comic Sans MS", "Comic Nue", sans-serif;
    display: flex;
    flex-direction:column;
    justify-content: center;
    align-items:center;
    margin: 0;
    /* background: linear-gradient(135deg, #fae4e7, #fff8dc) #7df07f; */
}

.wrapper {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 360px;
    max-width: 500px;
    padding: 1rem;

}

.todo-container {
    /* max-height: 700px; */
    width: 100%;
    display: flex;
    flex-grow: 1;
    flex-direction: column;
    /*overflow-y: auto; scrollbar will appear after max-height: 700px */
    background: #fffaf4;
    padding: 20px;
    border: 3px solid #f6c9cc;
    border-radius: 20px;
    box-shadow: 0 6px 14px rgba(0,0,0, 0.15);
}

.sidebar {
    /* position: fixed; it covers the list when growing*/
    top: 0;
    margin-top: 20px;
    width: 100%;
    padding: 0.75rem;
    background: #fffaf4;
    border-radius: 20px;
    box-shadow: 0 6px 14px rgba(0,0,0, 0.15);
    border: 3px solid #f6c9cc;
    
}

.sidebar h3 {
    margin-bottom: 11px;
    text-align: center;
}

.sidebar ul {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    justify-content: start;
    column-gap: 0.5rem;
    row-gap: 0.5rem;
    list-style: none;
    padding: 0;
}

.sidebar li {
    margin: auto;
    border-radius: 15px;
    justify-content: center;
    width: 8rem;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    background: #ffeef0;
    
}

.sidebar li:hover {
    background: #f6c9cc;
    color: white;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);

}

.sidebar .active {
    background: #d86b82;
    color: white;
    box-shadow: 0 3px 8px rgba(81, 53, 59, 0.7);
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: none;
}

li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffeef0;
    padding: 8px 11px;
    margin-top: 1rem;
    border: 1px solid #f6c9cc;
    border-radius: 11px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    touch-action: none;/* да няма scroll conflict */
}

li:hover {
    transform: scale(1.02);
}

li.done span {
    text-decoration: line-through;
    color: gray;
}

li button {
    background: #ff9e9e;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 14px;
    line-height: 14px;
    text-align: center;
    padding: 0;
}

li button:hover {
    background: #d86b82;
}

li:dragging {
    opacity: 0.6;
    transform: scale(1.06);
    z-index: 8;
}

li.placeholder {
    border: 2px dashed #b8b1b1;
    background: transparent;
}

.drag-hadnle {
    cursor: grad;
    font-size: 18px;
    margin-right: 8px;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

li.dragging {
    opacity: 0.6;
}

h2 {
    text-align: center;
    color: #d86b82;
    margin-bottom: 15px;
    margin-top: 0;
    padding-top: 0%;
}

h3 {
    text-align: center;
    color: #d86b82;
    margin-bottom: 15px;
}

.input-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
}

input {
    flex: 1;
    padding: 8px;
    border: 2px solid #f6c9cc;
    border-radius: 11px;
    outline: none;
    font-size: 14px;
}

button {
    padding: 8px 11px;
    margin-left: 8px;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    background: #f6c9cc;
    color: #fff;
    font-weight: bold;
    transition: background 0.3s;
}

button:hover {
    background: #d86b82;
}

.toggle {
    padding: 8px 11px;
    margin-left: 8px;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    background: #ec999e;
    color: #fff;
    font-weight: bold;
    transition: background 0.3s;
    width: 56px;
    height: 28px;
    font-size: 14px;
    line-height: 14px;
    text-align: center;
    padding: 0;
}

.toggle:hover {
    background: #d86b82;
}

.delete-category {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 100%;
    cursor: pointer;
    background: #f6c9cc;
    color: #fff;
    font-weight: bold;
    transition: background 0.3s;
}
.delete-category:hover {
    background: #d86b82;
}

.actions {
    display: flex;
    gap: 6px;
}

.author {
    text-align: center;
    margin-top: 11px;
    font-size: 11px;
    color: #888;
}

.author a {
    color: #d86b82;
    text-decoration: none;
    font-weight: bold;
}

.authot a:hover {
    text-decoration: underline;
}

/* daily-theme */
body.daily-theme {
    background: linear-gradient(135deg, #fae4e7, #fff8dc);
    color: #333;
}
body.daily-theme .todo-container,
body.daily-theme .sidebar {
    background: #fffaf4;
    border: 3px solid #f6c9cc;
}
body.daily-theme .category-item.active{
    background: #d86b82;
    color: white;
}

/* shopping-theme */
body.shopping-theme {
    background: linear-gradient(135deg, #e0f7df, #b2e6b0);
    color:  #2d4a2d;
}
body.shopping-theme .todo-container,
body.shopping-theme .sidebar {
    background: #e8fbe6;
    border: 2px solid #7bc47f;
    box-shadow: 0 6px 14px rgba(0, 100, 0, 0.2);
}
body.shopping-theme li {
    background: #cdefcf;
    border: 1px solid #7bc47f;
}
body.shopping-theme .category-item.active{
    background: #acefb1;
    color:  #fff;
}
body.shopping-theme #taskInput {
    border: 2px solid #7bc47f;
}
body.shopping-theme button {
    background: #acefb1;
    border: 2px solid #7bc47f;
}

/* work-theme */
body.work-theme {
    background: linear-gradient(135deg, #e8ecf1, #cfd6de);
    color: #1f2c3a;
}
body.work-theme .todo-container,
body.work-theme .sidebar {
    background: #f0f4f9;
    border: 3px solid #8aa3b5;
    box-shadow: 0 6px 11px rgba(20,40,60, 0.2);
}
body.work-theme li {
    background: #e9eff5;
    border: 1px solid #8aa3b5;
}
body.work-theme .category-item.active{
    background: #4a6fa5;
    color: #fff;
}
body.work-theme #taskInput {
    border: 2px solid #8aa3b5;
}
body.work-theme button {
    background: #4a6fa5;
    border: 2px solid #7bc47f;
}

.insert-category {
    margin: 0;
    margin-top: 20px;
    width: 100%;
    padding: 10px;
    border: 2px dashed #f6c9cc;
    border-radius: 11px;
    background: #fff5f7;
    color: #d86b82;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.insert-category:hover {
    background: #f6c9cc;
    color: white;
}

body.custom-theme {
    background: linear-gradient(135deg, #f2e6f9, #e9ddf2);
    color: #4a355e;
}

body.custom-theme .todo-container,
body.custom-theme .sidebar {
    background: #f9f5fc;
    border: 2px solid #cdb5e3;
    box-shadow: 0 6px 14px rgba(90, 60, 120, 0.15);
}

body.custom-theme li {
    background: #f2e8fa;
    border:  1px solid #cdb5e3;
}

body.custom-theme li:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 10px rgba(90, 60, 120, 0.2);
}

body.custom-theme .category-item.active {
    background: #b48edc;
    color:white;
}

body.custom-theme .sidebar li:hover {
    background: #c9a9e9;
    color: white;
    box-shadow: 0 3px 8px rgba(90, 60, 120, 0.4);
}

body.custom-theme button {
    background: #c9a9e9;
    color: #fff;
    border: none;
    transition: background 0.3s;
}

body.custom-theme button:hover {
    background: #b48edc;
}

body.custom-theme .delete-category {
    background: #d1b4ec;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    margin-left: 8px;
    font-size: 12px;
    cursor: pointer;
    border: none;
}

body.custom-theme .delete-category:hover {
    background: #b48edc;
    color: #fff;
}

@media (min-width:768px) {
    .container{
        width: 100vw;
    }
    .wrapper {
        flex-direction: row;
        justify-content:space-between ;
        max-width: unset;
        width: 100%;
    }
    .sidebar {
        position: sticky;
        max-width: 280px;
        left: 0;
        margin-top: unset;
        /* за да не расте със нарастването на елемента в който е,
        му задаваме да е 100% от съдържанието си
        и максимално да е 100% от съдържанието си,
        при което ще нараства спрямо себе си, а не спрямо елементи във flex-а */
        height: 100%;
        max-height: 100%;
    }
    .sidebar ul {
        flex-direction: column;
    }
    .sidebar li {
        margin: unset;
        width: 100%;
        text-align: right;
    }
}