/* =========================
   RESET
========================= */

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

body {
    min-height: 100vh;
    background: #f2f4f1;
    color: #2b2e2c;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    display: flex;
    flex-direction: column;
    align-items: center;

    padding: 40px 18px;
}


/* =========================
   CONTENEDOR PRINCIPAL
========================= */

body > div {
    width: 100%;
    max-width: 460px;
}


/* =========================
   TITULO
========================= */

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2b2e2c;

    text-align: center;

    margin-bottom: 20px;
}


/* =========================
   LISTA
========================= */

ul {
    list-style: none;

    display: flex;
    flex-direction: column;
    gap: 8px;

    margin-bottom: 20px;
}


/* =========================
   TAREAS
========================= */

li {
    background: #ffffff;

    border: 1px solid #e1e4df;
    border-radius: 10px;

    min-height: 48px;

    padding: 10px 12px;

    display: flex;
    align-items: center;
    gap: 10px;
}


/* Texto de la tarea */

li span {
    flex: 1;

    font-size: 1rem;
    line-height: 1.4;

    overflow-wrap: anywhere;
}


/* =========================
   CHECKBOX
========================= */

li input[type="checkbox"] {
    width: 19px;
    height: 19px;

    accent-color: #3f6659;

    cursor: pointer;

    flex-shrink: 0;
}


/* =========================
   BOTON ELIMINAR (tarea individual)
========================= */

li button {
    border: none;
    background: transparent;

    color: #9a9d97;

    font-size: 1.1rem;
    line-height: 1;

    width: 28px;
    height: 28px;

    border-radius: 50%;

    cursor: pointer;

    flex-shrink: 0;

    transition: background 0.15s ease, color 0.15s ease;
}

li button:hover {
    background: #f3ece9;
    color: #b5483d;
}


/* =========================
   INPUT + BOTON AGREGAR
========================= */

body > div:nth-child(3) {
    display: flex;
    gap: 8px;
}

#new-task {
    flex: 1;

    min-width: 0;

    border: 1px solid #d8dbd4;
    border-radius: 8px;

    background: #ffffff;

    padding: 12px 14px;

    font-size: 1rem;
    color: #2b2e2c;

    outline: none;
}

#new-task:focus-visible {
    border-color: #3f6659;
    box-shadow: 0 0 0 3px rgba(63, 102, 89, 0.15);
}

#new-task::placeholder {
    color: #9a9d97;
}


/* =========================
   BOTON AGREGAR
========================= */

#add-task {
    border: none;
    border-radius: 8px;

    padding: 0 18px;

    font-size: 0.95rem;
    font-weight: 600;

    background: #3f6659;
    color: #ffffff;

    cursor: pointer;

    transition: background 0.15s ease;
}

#add-task:hover {
    background: #335447;
}

#add-task:focus-visible {
    outline: 2px solid #3f6659;
    outline-offset: 2px;
}


/* =========================
   BOTON BORRAR TODAS
========================= */

#clear-tasks {
    display: block;

    width: 100%;
    max-width: 460px;

    margin-top: 14px;

    border: none;
    background: transparent;

    color: #8b9089;

    font-size: 0.85rem;

    padding: 6px 0;

    cursor: pointer;

    text-align: center;

    transition: color 0.15s ease;
}

#clear-tasks:hover {
    color: #b5483d;
}

#clear-tasks:focus-visible {
    outline: 2px solid #3f6659;
    outline-offset: 2px;
}


/* =========================
   ACCESIBILIDAD
========================= */

button:active {
    transform: scale(0.97);
}


/* =========================
   PANTALLAS PEQUEÑAS
========================= */

@media (max-width: 380px) {

    body {
        padding: 28px 12px;
    }

    h1 {
        font-size: 1.3rem;
    }

    #add-task {
        padding: 0 14px;
    }

    li {
        padding: 9px;
    }
}
