:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --background: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  --radius: 12px;
}

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

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

/* Header */
.header {
  background: var(--primary);
  color: #ffffff;
  padding: 2rem 0;
  margin-bottom: 2rem;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.brand h1 {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.brand p {
  opacity: 0.9;
}

.stats {
  display: flex;
  gap: 1rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  min-width: 80px;
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 1.4rem;
  font-weight: bold;
}

.stat-label {
  font-size: 0.85rem;
}

/* Form */
.task-form-section,
.controls-section,
.tasks-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.task-form-section {
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.task-form-section h2,
.tasks-section h2 {
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.4rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
}

button {
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.1rem;
  font-weight: bold;
  transition: transform 0.2s, background 0.2s;
}

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

#submit-button {
  background: var(--primary);
  color: #ffffff;
}

#submit-button:hover {
  background: var(--primary-dark);
}

#cancel-edit,
#clear-completed {
  background: #e2e8f0;
  color: var(--text);
}

/* Controls */
.controls-section {
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}

.search-group {
  flex: 1;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.9rem;
  font-weight: bold;
}

.filter-group select {
  width: auto;
}

/* Tasks */
.tasks-section {
  padding: 2rem;
  min-height: 250px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin-bottom: 0;
}

.task-list {
  display: grid;
  gap: 1rem;
}

.task-card {
  border: 1px solid var(--border);
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  padding: 1rem;
  background: var(--surface);
}

.task-card.priority-high {
  border-left-color: var(--danger);
}

.task-card.priority-medium {
  border-left-color: var(--warning);
}

.task-card.priority-low {
  border-left-color: var(--success);
}

.task-card.completed {
  opacity: 0.7;
}

.task-card.completed .task-title {
  text-decoration: line-through;
}

.task-card-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.task-title {
  font-size: 1.1rem;
}

.task-description {
  color: var(--muted);
  margin: 0.5rem 0;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.task-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.complete-button {
  background: var(--success);
  color: #ffffff;
}

.edit-button {
  background: var(--warning);
  color: #ffffff;
}

.delete-button {
  background: var(--danger);
  color: #ffffff;
}

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

.empty-state h3 {
  color: var(--text);
  margin-bottom: 0.5rem;
}

.footer {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  margin-top: 2rem;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Mobile */
@media (max-width: 768px) {
  .header .container,
  .controls-section {
    flex-direction: column;
    align-items: stretch;
  }

  .stats {
    justify-content: space-between;
  }

  .stat-card {
    flex: 1;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .filter-group {
    flex-wrap: wrap;
  }

  .filter-group select {
    flex: 1;
    min-width: 120px;
  }

  .tasks-section,
  .task-form-section {
    padding: 1.25rem;
  }

  .task-card-header {
    flex-direction: column;
  }
}
