/* --- CONFIGURAÇÕES GERAIS --- */
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    padding: 10px;
    margin: 0;
}

.container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
    margin: 10px auto;
    padding: 20px;
    box-sizing: border-box; /* Garante que o padding não aumente a largura total */
}

h1 {
    text-align: center;
    color: #1a1a1a;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

h2 {
    font-size: 1.1rem;
    color: #555;
    margin-top: 0;
}

/* --- GERENCIAMENTO DE GRUPOS E ENTRADA --- */
.group-management, .input-area {
    display: flex;
    flex-direction: column; /* Empilha no celular */
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #eee;
}

.input-area {
    background-color: transparent;
    padding: 0;
    border: none;
}

/* Ajuste de largura total para inputs no celular */
#group-select, #new-group-input, #task-input {
    width: 100%; 
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px; /* Evita zoom automático no iPhone ao clicar */
    box-sizing: border-box;
}

#add-button, #add-group-button, #delete-group-button {
    width: 100%;
    padding: 12px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
    color: white;
}

#add-button { background-color: #28a745; }
#add-group-button { background-color: #007bff; }
#delete-group-button { background-color: #d9534f; }

/* --- LISTA DE TAREFAS --- */
#task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#task-list li {
    background: #fff;
    margin-bottom: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    display: flex;
    flex-direction: column; /* Texto em cima, botões embaixo no celular */
    padding: 15px;
    gap: 12px;
    transition: transform 0.2s;
}

.task-text {
    font-size: 16px;
    color: #333;
    word-break: break-word; /* Evita que palavras longas quebrem o layout */
}

.completed .task-text {
    text-decoration: line-through;
    color: #888;
}

.completed {
    background-color: #f8f9fa !important;
}

/* --- BOTÕES DE AÇÃO --- */
.actions {
    display: flex;
    gap: 8px;
    width: 100%;
}

.actions button {
    flex: 1; /* Botões dividem o espaço por igual no celular */
    padding: 10px 5px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.complete-btn { background-color: #e7f4e8; color: #28a745; border: 1px solid #28a745 !important; }
.edit-btn { background-color: #fff3cd; color: #856404; border: 1px solid #ffeeba !important; }
.delete-btn { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb !important; }

/* --- DIVISOR --- */
hr {
    border: 0;
    height: 1px;
    background-color: #eee;
    margin: 20px 0;
}

/* --- MEDIA QUERIES (AJUSTES PARA TELAS MAIORES) --- */
@media (min-width: 480px) {
    .group-management, .input-area {
        flex-direction: row; /* Volta a ficar lado a lado no PC */
        flex-wrap: wrap;
    }

    #group-select, #new-group-input {
        width: calc(50% - 5px); /* Dois por linha no gerenciamento de grupo */
    }

    #task-input {
        flex: 1;
    }

    #add-button, #add-group-button, #delete-group-button {
        width: auto;
        padding: 10px 20px;
    }

    #task-list li {
        flex-direction: row; /* Texto e botões na mesma linha no PC */
        justify-content: space-between;
        align-items: center;
    }

    .actions {
        width: auto; /* No PC, os botões não ocupam a largura toda */
    }
    
    .actions button {
        flex: none;
        padding: 8px 12px;
    }
}