:root {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-main: #2d3748;
    --text-secondary: #718096;
    --accent: #3182ce;
    --danger: #e53e3e;
    --success: #38a169;
    
    --prio-low: #48bb78;
    --prio-med: #ecc94b;
    --prio-high: #f56565;

    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 16px; /* Bordes más redondeados */
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a202c;
        --card-bg: #2d3748;
        --text-main: #f7fafc;
        --text-secondary: #a0aec0;
        --shadow: 0 4px 12px rgba(0,0,0,0.4);
    }
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /* Evita rebote elástico en iOS */
    overscroll-behavior-y: none; 
}

/* SOLUCIÓN AL ZOOM: 16px mínimo en inputs */
input, select, button, textarea {
    font-size: 16px !important; 
    font-family: inherit;
}

.app-container {
    max-width: 650px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 10px 5px;
}

h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.5px;}

button, .btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    padding: 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
button i, .btn-icon i { font-size: 1.5rem; } /* Iconos más grandes */

/* Inputs Section */
.input-section {
    background: var(--card-bg);
    padding: 20px; /* Más espacio */
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.main-input-group { display: flex; gap: 12px; margin-bottom: 15px; }

input[type="text"] {
    flex-grow: 1;
    padding: 14px;
    background: var(--bg-color);
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--text-main);
    outline: none;
    transition: 0.3s;
}
input[type="text"]:focus { border-color: var(--accent); background: var(--card-bg); }

#btnAdd {
    background-color: var(--accent);
    color: white;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    flex-shrink: 0;
}
#btnAdd i { font-size: 1.5rem; }

.options-group { display: flex; gap: 12px; flex-wrap: wrap;}

select, input[type="date"] {
    background: var(--bg-color);
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-main);
    font-weight: 500;
}

/* Filtro Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

/* Selector de orden (pequeño y discreto) */
#sortSelect {
    background: transparent;
    font-size: 0.9rem !important;
    color: var(--accent);
    padding: 5px;
    border: 1px solid transparent;
    cursor: pointer;
    text-align: right;
}

h2 { font-size: 1.3rem; color: var(--text-secondary); display: flex; align-items: center; gap: 10px;}
.badge { 
    background: var(--accent); color: white; 
    font-size: 0.8rem; padding: 2px 8px; border-radius: 10px; 
}

/* Listas */
.task-list { list-style: none; padding-bottom: 40px; }

.task-item {
    background: var(--card-bg);
    padding: 18px 20px; /* Tarjetas más grandes */
    border-radius: var(--radius);
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start; /* Alineación arriba por si el texto es largo */
    gap: 15px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

/* Indicador de prioridad (Barra lateral) */
.task-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 6px;
}
.task-item[data-prio="low"]::before { background: var(--prio-low); }
.task-item[data-prio="medium"]::before { background: var(--prio-med); }
.task-item[data-prio="high"]::before { background: var(--prio-high); }

.task-content { flex-grow: 1; padding-top: 2px;}
.task-title { 
    font-size: 1.1rem; /* Texto tarea más grande */
    font-weight: 600; 
    line-height: 1.4;
    display: block; 
}
.task-meta { 
    font-size: 0.85rem; 
    color: var(--text-secondary); 
    margin-top: 6px; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; 
    align-items: center;
}

/* Checkbox */
.check-container {
    width: 28px; height: 28px; /* Más grande */
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}
.task-item.completed .check-container {
    background-color: var(--success); border-color: var(--success);
}
.check-container i { color: white; font-size: 16px; opacity: 0; }
.task-item.completed .check-container i { opacity: 1; }

/* Finalizadas */
.task-item.completed .task-title { text-decoration: line-through; opacity: 0.7; }
.task-item.completed { opacity: 0.8; background: rgba(0,0,0,0.02); box-shadow: none; border: 1px solid rgba(0,0,0,0.05);}
