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

:root {
  --bg-color: #f4f4f5;
  --bg-card: #ffffff;
  --text-color: #111827;
  --text-muted: #6b7280;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --border-color: #e5e7eb;
  --danger: #ef4444;
  --shadow-soft: 0 10px 25px rgba(15, 23, 42, 0.08);
}

body.dark-theme {
  --bg-color: #020617;
  --bg-card: #020617;
  --text-color: #e5e7eb;
  --text-muted: #9ca3af;
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.15);
  --border-color: #1f2937;
  --shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.8);
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #1d4ed8 0, transparent 55%),
    var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px 16px;
}

.app {
  background: var(--bg-card);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  width: 100%;
  max-width: 640px;
  padding: 24px 20px 28px;
  border: 1px solid var(--border-color);
}

/* HEADER */

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}

.app-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
}

.app-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* THEME TOGGLE */

.theme-toggle {
  border-radius: 999px;
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s ease, box-shadow 0.1s ease,
    background 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.18);
}

/* ADD TASK */

.add-task {
  margin-bottom: 16px;
}

#task-form {
  display: flex;
  gap: 10px;
}

#task-input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: rgba(148, 163, 184, 0.05);
  color: var(--text-color);
  outline: none;
  font-size: 0.95rem;
}

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

#task-form button {
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.1s ease;
}

#task-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.6);
}

/* CONTROLS */

.task-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.filters {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.1);
}

.filter-btn {
  border-radius: 999px;
  border: none;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.filter-btn.active {
  background: var(--accent);
  color: #f9fafb;
  transform: translateY(-1px);
}

.task-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* TASK LIST */

.task-list-section {
  margin-top: 8px;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 4px;
}

.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.02);
  border: 1px solid var(--border-color);
  transition: background 0.15s ease, transform 0.1s ease,
    box-shadow 0.12s ease;
}

.task-item:hover {
  background: rgba(148, 163, 184, 0.06);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
}

.task-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.task-text {
  font-size: 0.95rem;
  word-break: break-word;
}

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

.task-actions {
  display: flex;
  gap: 6px;
}

.task-actions button {
  border-radius: 999px;
  border: none;
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-color);
  transition: background 0.15s ease, transform 0.1s ease, opacity 0.1s ease;
}

.task-actions button:hover {
  transform: translateY(-1px);
}

.task-actions .edit-btn {
  background: rgba(34, 197, 94, 0.15);
}

.task-actions .delete-btn {
  background: rgba(239, 68, 68, 0.2);
  color: #fee2e2;
}

/* SCROLLBAR (sutil) */

.task-list-section::-webkit-scrollbar {
  width: 6px;
}

.task-list-section::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 999px;
}

/* RESPONSIVO */

@media (max-width: 600px) {
  .app {
    padding: 18px 14px 22px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  #task-form {
    flex-direction: column;
  }

  #task-form button {
    width: 100%;
    justify-content: center;
  }

  .task-controls {
    flex-direction: column;
    align-items: flex-start;
  }
}
