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

:root {
  --bg: #f0f4ff;
  --surface: #ffffff;
  --surface-2: #f7f9ff;
  --border: #e2e8f8;
  --primary: #5b6ef5;
  --primary-dark: #4657e0;
  --primary-light: #eef0ff;
  --text: #1e2545;
  --text-muted: #8892b0;
  --danger: #f55b6e;
  --danger-light: #fff0f2;
  --success: #34d399;
  --success-light: #ecfdf5;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(91, 110, 245, 0.10);
  --shadow-sm: 0 2px 8px rgba(91, 110, 245, 0.08);
  --transition: 0.2s ease;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px 80px;
  color: var(--text);
}

/* ── Container ─────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Header ────────────────────────────────────────────────── */
header {
  text-align: center;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Input Section ─────────────────────────────────────────── */
.input-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.input-wrapper {
  display: flex;
  gap: 10px;
}

#task-input {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

#task-input::placeholder {
  color: var(--text-muted);
}

#task-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 110, 245, 0.15);
  background: var(--surface);
}

#add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(91, 110, 245, 0.35);
}

#add-btn:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 16px rgba(91, 110, 245, 0.45);
}

#add-btn:active {
  transform: scale(0.97);
}

/* ── Filters ───────────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 8px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow-sm);
}

.filter-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.filter-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(91, 110, 245, 0.30);
}

/* ── Task List ─────────────────────────────────────────────── */
#task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#task-list:empty::after {
  content: 'No tasks here yet. Add one above!';
  display: block;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ── Task Item ─────────────────────────────────────────────── */
.task-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
  transition: box-shadow var(--transition), border-color var(--transition), opacity var(--transition);
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.task-item:hover {
  box-shadow: var(--shadow);
  border-color: var(--border);
}

.task-item.completed {
  background: var(--success-light);
  border-color: rgba(52, 211, 153, 0.25);
}

/* Custom checkbox */
.task-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: border-color var(--transition), background var(--transition);
}

.task-checkbox:hover {
  border-color: var(--primary);
}

.task-checkbox:checked {
  background: var(--success);
  border-color: var(--success);
}

.task-checkbox:checked::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  width: 6px;
  height: 10px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* Task text */
.task-text {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.4;
  word-break: break-word;
  transition: color var(--transition), text-decoration var(--transition);
}

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

/* Delete button */
.delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  opacity: 0;
  transition: background var(--transition), color var(--transition), opacity var(--transition);
}

.task-item:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* ── Footer ────────────────────────────────────────────────── */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer.hidden {
  display: none;
}

#clear-completed-btn {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background var(--transition);
}

#clear-completed-btn:hover {
  background: var(--danger-light);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
  body { padding-top: 28px; }
  header h1 { font-size: 1.6rem; }
  .input-wrapper { flex-direction: column; }
  #add-btn { justify-content: center; }
  .delete-btn { opacity: 1; }
}
