/* ─── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0F172A;
    --surface:   #1E293B;
    --surface2:  #263347;
    --border:    #334155;
    --indigo:    #6366F1;
    --indigo-hv: #4F46E5;
    --green:     #10B981;
    --amber:     #F59E0B;
    --red:       #EF4444;
    --text:      #F8FAFC;
    --muted:     #94A3B8;
    --radius:    12px;
    --shadow:    0 4px 24px rgba(0,0,0,.4);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ─── Navbar ────────────────────────────────────────────────────────── */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -.02em;
}

.navbar-brand .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--indigo);
    box-shadow: 0 0 10px var(--indigo);
}

.navbar-actions { display: flex; gap: .75rem; align-items: center; }

/* ─── Layout ────────────────────────────────────────────────────────── */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

/* ─── Stats Bar ─────────────────────────────────────────────────────── */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: grid; place-items: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon.total   { background: rgba(99,102,241,.15); }
.stat-icon.done    { background: rgba(16,185,129,.15);  }
.stat-icon.pending { background: rgba(245,158,11,.15);  }

.stat-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }

/* ─── Section header ────────────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}

/* ─── Buttons ───────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s ease;
    font-family: inherit;
    line-height: 1;
}

.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-hv); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,.4); }

.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-success { background: rgba(16,185,129,.15); color: var(--green); border: 1px solid rgba(16,185,129,.3); }
.btn-success:hover { background: rgba(16,185,129,.25); }

.btn-danger { background: rgba(239,68,68,.1); color: var(--red); border: 1px solid rgba(239,68,68,.2); }
.btn-danger:hover { background: rgba(239,68,68,.2); }

.btn-sm { padding: .35rem .7rem; font-size: .8rem; border-radius: 6px; }

/* ─── Task Cards ────────────────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: .75rem; }

.task-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: border-color .2s, transform .15s;
    position: relative;
    overflow: hidden;
}

.task-card:hover { border-color: #4A5568; transform: translateX(2px); }

.task-card.completed { opacity: .65; }
.task-card.completed::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--green);
    border-radius: var(--radius) 0 0 var(--radius);
}

.task-card:not(.completed)::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    border-radius: var(--radius) 0 0 var(--radius);
}

.task-card.priority-ALTA:not(.completed)::before   { background: var(--red); }
.task-card.priority-MEDIA:not(.completed)::before  { background: var(--amber); }
.task-card.priority-BAJA:not(.completed)::before   { background: var(--indigo); }

.task-check {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
    display: grid; place-items: center;
    transition: all .15s;
}

.task-check:hover { border-color: var(--green); }
.task-card.completed .task-check { background: var(--green); border-color: var(--green); color: #fff; }

.task-body { flex: 1; min-width: 0; }

.task-title {
    font-size: .975rem;
    font-weight: 600;
    margin-bottom: .25rem;
}

.task-card.completed .task-title { text-decoration: line-through; color: var(--muted); }

.task-desc { font-size: .85rem; color: var(--muted); margin-bottom: .6rem; }

.task-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.badge {
    font-size: .7rem;
    font-weight: 600;
    padding: .2rem .55rem;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.badge-ALTA  { background: rgba(239,68,68,.15);  color: var(--red); }
.badge-MEDIA { background: rgba(245,158,11,.15); color: var(--amber); }
.badge-BAJA  { background: rgba(99,102,241,.15); color: #A5B4FC; }
.badge-done  { background: rgba(16,185,129,.15); color: var(--green); }

.task-actions { display: flex; gap: .4rem; flex-shrink: 0; align-items: flex-start; }

/* ─── Empty state ───────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { font-size: .95rem; }

/* ─── Modal ─────────────────────────────────────────────────────────── */
.modal-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop.active { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow);
    animation: slideUp .2s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title  { font-size: 1.1rem; font-weight: 700; }

.btn-close {
    background: var(--surface2);
    border: none; color: var(--muted);
    width: 30px; height: 30px;
    border-radius: 6px;
    cursor: pointer; font-size: 1rem;
    display: grid; place-items: center;
    transition: all .15s;
}

.btn-close:hover { background: var(--border); color: var(--text); }

/* ─── Form ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }

label {
    display: block;
    font-size: .8rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: .4rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

input[type="text"], textarea, select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .65rem .9rem;
    color: var(--text);
    font-family: inherit;
    font-size: .9rem;
    transition: border-color .15s;
    outline: none;
}

input[type="text"]:focus, textarea:focus, select:focus {
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; }

.field-error { font-size: .78rem; color: var(--red); margin-top: .3rem; }
.input-error { border-color: var(--red) !important; }

.form-footer { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.5rem; }

/* ─── Alert ─────────────────────────────────────────────────────────── */
.alert {
    padding: .85rem 1.1rem;
    border-radius: 8px;
    font-size: .9rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.alert-success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3); color: var(--green); }

/* ─── Edit Page ─────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.page-header { margin-bottom: 1.75rem; }
.page-title { font-size: 1.4rem; font-weight: 700; }
.page-subtitle { color: var(--muted); font-size: .9rem; margin-top: .25rem; }

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .stats-bar { grid-template-columns: 1fr; }
    .task-card { flex-wrap: wrap; }
    .task-actions { width: 100%; justify-content: flex-end; }
    .navbar { padding: 0 1rem; }
}
