/* Reset and box-sizing */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body styles*/
body {
    background: linear-gradient(135deg, #1a1823, #1a003d);
    color: #fff;
    font-family: 'Inter', sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 40px 20px;
}

/* Main todo container */
.todo-app {
    width: 100%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px); /* Glassmorphism effect */
    border-radius: 16px;
    padding: 30px 40px;
    box-shadow: 0 8px 30px #00000080;
    animation: fadeIn 0.5s ease;
}

/* Header text */
.todo-app h1 {
    font-size: 2.4rem;
    margin-bottom: 10px;
    text-align: center;
}

.todo-app h3 {
    font-weight: 400;
    font-size: 1.1rem;
    color: #ccc;
    margin-bottom: 30px;
    text-align: center;
}

/* Counters */
.todo-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    gap: 10px;
}

.counter {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(112, 110, 110, 0.418);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.counter:hover {
    background: rgba(176, 102, 255, 0.2);
}

.counter p:first-child {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.counter p:last-child {
    font-size: 1rem;
    color: #ccc;
    margin-bottom: 6px;
}

/* Add task button */
.todo-add {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    justify-content: end;
}

.add-task-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    background: #52b44a;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-task-btn:hover {
    background: #32712d;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 12px rgba(102, 255, 120, 0.6);
}

/* Tabs */
.todo-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.todo-tabs button {
    margin: 0 5px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.todo-tabs button.active,
.todo-tabs button:hover {
    background: #52b44a;
}

/* Task list */
.task-list ul {
    list-style: none;
}

.task-item {
    display: flex; /* Circle + info +actions in a row*/
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;

}

/* Task completion circle */
.task-circle {
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-radius: 50%;
    margin-right: 15px;
    margin-top: 10px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    transition: all 0.3s ease;
}

.task-circle:hover,
.task-circle:focus {
    transform: scale(1.2);
    border-color: #52b44a;
    outline: none;
}

.task-circle.completed {
    background: #52b44a;
    border-color: #52b44a;
}

.task-circle.completed::after {
    content: '✔';
    color: white;
    font-size: 14px;
}

/* Completed tasks */
.task-item.completed .task-desc,
.task-item.completed .task-title {
    color: #888;
}

.task-item.completed .task-title {
    text-decoration: line-through;
}

.task-info {
    flex: 1; /*Fill space between circle and actions */
    text-align: left;
    cursor: pointer;
}

.task-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
}

.task-desc {
    font-size: 0.9rem;
    color: #ddd;
}

.task-date {
    font-size: 0.7rem;
    color: #888;
    display: inline;
    margin-top: 4px;
}

/* Action buttons container */
.task-actions {
    display: flex;
    margin-top: 10px;
}

/* Buttons inside tasks */
.action-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    outline: none;
    transition: all 0.2s ease;
}

.action-btn svg {
    fill: none;
    stroke: white;
    stroke-width: 2;
    transition: all 0.2s ease;
}

.action-btn:hover svg {
    opacity: 0.7;
    transform: scale(1.1);
}

.action-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-btn.disabled svg {
    pointer-events: none;
}

/* Task enter/exit animations */
.task-enter {
    opacity: 0;
    transform: translateY(-8px);
}

.task-exit {
    opacity: 0;
    transform: translateY(8px);
}

/* Modal */
.modal {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
    transform: opacity 0.25s ease, transform 0.25s ease;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(1, 6, 2, 0.829);
    backdrop-filter: blur(8px);
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

/* Modal content box */
.modal-content {
    background-color: #1f232f;
    margin: 100px auto;
    padding: 30px;
    border-radius: 16px;
    max-width: 500px;
    color: #fff;
    display: flex;
    flex-direction: column; /* Stack inputs + buttons */
    gap: 15px;
    animation: fadeIn 0.3s ease;
}

.modal-content .modal-header {
    display: flex;
    justify-content: space-between;
}

.modal-content .close-modal {
    color: #595d69;
    font-size: 1.5em;
}

.modal-content input,
.modal-content textarea {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #444;
    background: #161821;
    color: #fff;
}

.modal-content textarea {
    height: 100px;
    resize: none;
}

.modal-content .task-btns {
    display: flex;
    justify-content: space-between;
}

.modal-content button {
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

#add-task-btn {
    background-color: #52b44a;
    width: 48%;
}

#add-task-btn:hover,
#add-task-btn:focus {
    background-color: #35712d;
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 0 10px rgba(102, 255, 120, 0.5);
    outline: none;
}

#cancel-task-btn {
    background-color: #595d69;
    width: 48%;
}

#cancel-task-btn:hover,
#cancel-task-btn:focus {
    background-color: #444;
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 0 8px rgba(150, 150, 150, 0.5);
    outline: none;
}

/* Input error highlight */
.input-error {
    outline: 2px solid rgba(245, 85, 85, 0.6);
}

/* Fade-in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Responsive design */
@media (max-width: 600px) {
    .todo-app {
        padding: 15px 10px;
    }

    .todo-header {
        flex-direction: column;
        gap: 10px;
    }

    .counter {
        padding: 12px;
        font-size: 0.9rem;
    }

    .todo-tabs{
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }

    .todo-tabs button{
        flex: 1 1 calc(33% - 10px);
    }

    .task-item {
        flex-wrap: wrap; /*Stack elements if not enough space */
        gap: 6px;
        padding: 10px;
    }

    .task-circle {
        width: 24px;
        height: 24px;
    }
    .task-circle.completed::after{
        font-size: 16px;
        transition: all 0.2s ease;
    }

    .task-title,
    .task-reak-desc{
        word-break: break-word; /* Prevent overflow */
    }

    .task-actions {
        flex: 1 1 100%; /* Full width actions for mobile */
        justify-content: flex-end;
        gap: 10px;
        margin-top: 6px;
    }

    .action-btn {
        padding: 6px;
    }

    .action-btn svg {
        width: 20px;
        height: 20px;
    }

    .todo-tabs button {
        padding: 8px 12px;
        margin: 3px;
        font-size: 0.85rem;
    }

    .modal-content {
        margin: 10vh 10px;
        padding: 20px;
    }

    .modal-content input,
    .modal-content textarea {
        font-size: 0.9rem;
    }

    .add-task-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}