
/* =========================
   1. RESET & GLOBAL STYLES
========================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --background: #f5f7fb;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 10px 35px rgba(15, 23, 42, 0.06);
}

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

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

/* =========================
   2. MAIN CONTAINER
========================= */

.app-container {
  max-width: 720px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 36px;
  box-shadow: var(--shadow);
}

/* =========================
   3. HEADER
========================= */

.app-header {
  text-align: center;
  margin-bottom: 36px;
}

.app-header h1 {
  font-size: clamp(2rem, 5vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -1.5px;
  color: var(--primary);
  line-height: 1.2;
}

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

/* =========================
   4. TASK FORM
========================= */

.task-form-section {
  margin-bottom: 30px;
}

#task-form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
}

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

#task-input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#task-input::placeholder {
  color: #94a3b8;
}

#task-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* =========================
   5. BUTTONS
========================= */

button {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 9px;
  transition:
    background-color 0.2s,
    color 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
}

button:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.35);
  outline-offset: 3px;
}

#add-task-btn {
  padding: 14px 20px;
  background: var(--primary);
  color: white;
  white-space: nowrap;
}

#add-task-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

#add-task-btn:active {
  transform: translateY(0);
}

/* =========================
   6. TASK SUMMARY CARDS
========================= */

.task-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}

.summary-item {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 12px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.summary-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.summary-item span {
  display: block;
  font-size: 1.8rem;
  line-height: 1.3;
  font-weight: 800;
  color: var(--primary);
}

.summary-item p {
  margin-top: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* =========================
   7. TASK LIST HEADER
========================= */

.task-list-section {
  min-width: 0;
}

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

.task-list-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.4px;
}

#clear-completed-btn {
  padding: 9px 12px;
  color: var(--danger);
  background: #fef2f2;
  font-size: 0.78rem;
}

#clear-completed-btn:hover {
  background: #fee2e2;
}

/* =========================
   8. FILTER BUTTONS
========================= */

.task-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 18px;
}

.filter-btn {
  padding: 9px 16px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.filter-btn:hover {
  background: #f1f5f9;
  color: var(--text);
}

.filter-btn.active {
  background: #eef2ff;
  color: var(--primary-hover);
  border-color: #c7d2fe;
}

/* =========================
   9. TASK ITEMS
========================= */

#task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/*
Each task <li> should have class "task-item".
The checkbox should have class "task-checkbox".
The task text should have class "task-text".
The delete button should have class "delete-task-btn".
*/

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  transition: border-color 0.2s, background-color 0.2s;
  animation: slide-in 0.25s ease;
}

.task-item:hover {
  border-color: #c7d2fe;
  background: #fcfcff;
}

.task-checkbox {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.task-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

/* Completed task state */

.task-item.completed .task-text {
  text-decoration: line-through;
  color: #94a3b8;
}

.task-item.completed {
  background: #f8fafc;
}

/* Delete button */

.delete-task-btn {
  flex-shrink: 0;
  padding: 8px 10px;
  color: var(--danger);
  background: #fef2f2;
  font-size: 0.78rem;
}

.delete-task-btn:hover {
  background: #fee2e2;
}

/* =========================
   10. EMPTY STATE
========================= */

#empty-message {
  padding: 30px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* JavaScript should add the "hidden" class when tasks exist. */

#empty-message.hidden {
  display: none;
}

/* =========================
   11. FOOTER
========================= */

.app-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.app-footer p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* =========================
   12. ANIMATIONS
========================= */

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   13. RESPONSIVE DESIGN
========================= */

@media (max-width: 600px) {
  body {
    padding: 20px 12px;
  }

  .app-container {
    padding: 24px 18px;
    border-radius: 16px;
  }

  .app-header {
    margin-bottom: 28px;
  }

  .input-group {
    flex-direction: column;
  }

  #add-task-btn {
    width: 100%;
  }

  .task-summary {
    gap: 8px;
    margin-bottom: 28px;
  }

  .summary-item {
    padding: 15px 6px;
  }

  .summary-item span {
    font-size: 1.5rem;
  }

  .summary-item p {
    font-size: 0.7rem;
  }

  .task-list-header {
    align-items: flex-start;
  }

  .task-list-header h2 {
    font-size: 1.1rem;
  }

  .filter-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .task-item {
    padding: 12px;
    gap: 10px;
  }
}

/* =========================
   14. REDUCED MOTION
========================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
