/* ============================================================
   GESTOR DE TAREAS — styles.css
   Tipografía: DM Sans (Google Fonts)
   Paleta: neutros cálidos + acento índigo
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

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

:root {
  --bg:        #F7F6F3;
  --surface:   #FFFFFF;
  --border:    #E4E2DC;
  --border-md: #CCC9BF;
  --text:      #1A1916;
  --muted:     #7A7870;
  --hint:      #B0AEA8;

  --accent:    #4F46E5;
  --accent-lt: #EEF2FF;

  --alta-bg:   #FEF2F2;
  --alta-tx:   #991B1B;
  --media-bg:  #FFFBEB;
  --media-tx:  #92400E;
  --baja-bg:   #F0FDF4;
  --baja-tx:   #166534;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
}

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

/* ── Layout ───────────────────────────────────────────────── */
.wrapper {
  max-width: 680px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.brand-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-header h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--accent);
}
.version-badge {
  font-size: 11px;
  font-weight: 500;
  background: var(--border);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 4px;
}
.slogan {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  font-style: italic;
}
.count-badge {
  font-size: 12px;
  font-weight: 500;
  background: var(--accent-lt);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 20px;
  margin-top: 6px;
  white-space: nowrap;
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 12px;
  color: var(--hint);
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.site-footer a:hover { color: var(--accent); }

/* ── Add form ─────────────────────────────────────────────── */
.add-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.add-card h2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
}
.field { margin-bottom: 10px; }
.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--accent); }
.field textarea { height: 72px; resize: vertical; }

.form-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.form-row select { flex: 1; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s, transform .1s;
}
.btn-primary:hover  { opacity: .9; }
.btn-primary:active { transform: scale(.97); }

/* ── Filters ──────────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.filters input,
.filters select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.filters input { flex: 1; min-width: 160px; }
.filters select { min-width: 140px; }
.filters input:focus,
.filters select:focus { border-color: var(--accent); }

/* ── Stats ────────────────────────────────────────────────── */
.stats {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: .75rem;
}

/* ── Task list ────────────────────────────────────────────── */
#task-list { display: flex; flex-direction: column; gap: 8px; }

.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  transition: opacity .2s, border-color .15s;
  animation: slideIn .18s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.task-item:hover { border-color: var(--border-md); }
.task-item.is-done { opacity: .45; }

/* Checkbox */
.task-check {
  width: 19px; height: 19px;
  border: 1.5px solid var(--border-md);
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
  font-size: 11px;
  color: transparent;
}
.task-check:hover          { border-color: var(--accent); }
.task-check.is-checked     { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Body */
.task-body  { flex: 1; min-width: 0; }
.task-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}
.is-done .task-title { text-decoration: line-through; }
.task-desc  { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

/* Meta row */
.task-meta  { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 20px;
}
.badge-alta  { background: var(--alta-bg);  color: var(--alta-tx); }
.badge-media { background: var(--media-bg); color: var(--media-tx); }
.badge-baja  { background: var(--baja-bg);  color: var(--baja-tx); }
.task-date   { font-size: 11px; color: var(--hint); }

/* Botones de acción (lápiz + eliminar) */
.task-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.btn-edit,
.btn-del {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  transition: color .15s;
}
.btn-edit { color: var(--hint); }
.btn-edit:hover { color: var(--accent); }
.btn-del  { color: var(--hint); }
.btn-del:hover  { color: #DC2626; }

/* Formulario edición inline */
.task-edit { margin-top: 4px; }
.edit-titulo {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  margin-bottom: 6px;
  transition: border-color .15s;
}
.edit-titulo:focus { border-color: var(--accent); }
.task-edit textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  height: 60px;
  resize: vertical;
  margin-bottom: 6px;
  transition: border-color .15s;
}
.task-edit textarea:focus { border-color: var(--accent); }
.edit-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.edit-row select {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
}
.btn-save {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-save:hover { opacity: .88; }
.btn-cancel {
  background: none;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s;
}
.btn-cancel:hover { border-color: var(--accent); color: var(--accent); }

/* ── Empty state ──────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: 14px;
}
.empty-icon { font-size: 32px; margin-bottom: 8px; }

/* ── Toast ────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: var(--surface);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 30px;
  pointer-events: none;
  transition: transform .25s ease, opacity .25s;
  opacity: 0;
  z-index: 999;
  white-space: nowrap;
}
#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Loading overlay ──────────────────────────────────────── */
.loading { text-align: center; padding: 2rem; color: var(--muted); font-size: 14px; }
