.todo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
  transition: all 0.3s ease;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.page-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin: 0;
  transition: color 0.3s ease;
}

.todo-stats {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.3s ease;
}

.add-todo-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease, border-color 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.add-todo-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.add-todo-btn:active {
  transform: translateY(0);
}

.add-todo-btn.secondary {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.add-todo-btn.secondary:hover {
  background: var(--accent-light);
  color: var(--accent);
  transform: translateY(-2px);
}

.todo-filters {
  display: flex;
  gap: 12px;
  margin: 0 0 24px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  position: relative;
}

.filter-indicator {
  position: absolute;
  height: calc(100% - 12px);
  background: var(--accent);
  border-radius: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
  top: 6px;
}

.filter-btn {
  border: none;
  background: transparent;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.3s ease;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.filter-btn:hover {
  color: var(--text-secondary);
}

.filter-btn.active {
  color: #fff;
}

.todo-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.todo-list {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 300px;
}

.todo-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: start;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease, opacity 0.35s ease;
  position: relative;
  overflow: hidden;
}

.todo-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.todo-item.priority-high::before {
  opacity: 1;
  background: var(--danger);
}

.todo-item.priority-medium::before {
  opacity: 1;
  background: var(--warning);
}

.todo-item.priority-low::before {
  opacity: 1;
  background: var(--success);
}

.todo-item:hover {
  background: var(--card);
  transform: translateX(4px);
  box-shadow: var(--shadow);
}

.todo-item.completed {
  opacity: 0.6;
  transition: opacity 0.35s ease;
}

.todo-item.completed .todo-content {
  text-decoration: line-through;
  color: var(--text-muted);
  transition: text-decoration 0.35s ease, color 0.35s ease;
}

.todo-checkbox {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--accent);
  border-radius: 6px;
  transition: var(--transition);
}

.todo-checkbox:checked {
  animation: checkBounce 0.3s ease-out;
}

.todo-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  transition: text-decoration 0.35s ease, color 0.35s ease;
}

.todo-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.4;
  transition: color 0.35s ease;
  word-wrap: break-word;
}

.todo-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  font-weight: 500;
  transition: color 0.35s ease;
  word-wrap: break-word;
}

.todo-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.todo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.todo-badge.priority-high {
  background: var(--danger-light);
  color: var(--danger);
}

.todo-badge.priority-medium {
  background: var(--warning-light);
  color: var(--warning);
}

.todo-badge.priority-low {
  background: var(--success-light);
  color: var(--success);
}

.todo-badge.type-assignment {
  background: var(--accent-light);
  color: var(--accent);
}

.todo-badge.type-custom {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.todo-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  background: var(--card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.todo-due {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.3s ease;
}

.todo-due.overdue {
  color: var(--danger);
  font-weight: 700;
}

.todo-due.today {
  color: var(--warning);
  font-weight: 700;
}

.todo-actions {
  display: flex;
  gap: 6px;
  align-items: start;
}

.todo-action-btn {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
  padding: 0;
}

.todo-action-btn svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.todo-action-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
  transform: scale(1.05);
}

.todo-action-btn:hover svg {
  color: var(--accent);
}

.todo-action-btn.delete:hover {
  border-color: var(--danger);
}

.todo-action-btn.delete:hover svg {
  color: var(--danger);
}

.todo-empty {
  padding: 64px 24px;
  text-align: center;
  color: var(--text-muted);
}

.todo-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.todo-empty-text {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.todo-empty-hint {
  font-size: 14px;
  opacity: 0.8;
}

/* Modal Styles */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.modal-backdrop.hidden {
  display: none;
}

.todo-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  transition: color 0.3s ease;
}

.modal-body {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  transition: color 0.3s ease;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  background: var(--bg-secondary);
  color: var(--text);
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.2s ease;
  font-weight: 500;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: var(--card);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
}

/* Animation for adding/removing items */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.todo-item.removing {
  animation: smoothFadeSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes smoothFadeSlide {
  0% {
    opacity: 1;
    max-height: 500px;
    margin-bottom: 12px;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    transform: scale(0.95);
  }
}

.todo-item.checking {
  animation: fadeToCompleted 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeToCompleted {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

.todo-item.unchecking {
  animation: fadeToActive 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeToActive {
  0% {
    opacity: 0.6;
  }
  100% {
    opacity: 1;
  }
}

.todo-item.appearing {
  animation: expandAndFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes expandAndFadeIn {
  0% {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  60% {
    opacity: 0;
  }
  100% {
    opacity: 1;
    max-height: 500px;
    margin-bottom: 12px;
    padding-top: 16px;
    padding-bottom: 16px;
  }
}

.todo-item.adding {
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsive */
@media (max-width: 768px) {
  .page-title {
    font-size: 24px;
  }

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

  .header-actions {
    width: 100%;
    flex-direction: column;
  }

  .add-todo-btn {
    width: 100%;
    justify-content: center;
  }

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

  .todo-item {
    grid-template-columns: auto 1fr;
    gap: 12px;
  }

  .todo-actions {
    grid-column: 2;
    justify-content: flex-end;
    margin-top: 8px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}

/* Assignment Picker Modal */
.assignment-modal {
  max-width: 700px;
}

.assignment-status {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 16px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.assignment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}

.assignment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.assignment-item:hover {
  background: var(--card-hover);
  border-color: var(--accent);
  transform: translateX(4px);
}

.assignment-item.already-added {
  opacity: 0.5;
  cursor: not-allowed;
}

.assignment-item.already-added:hover {
  transform: none;
  border-color: var(--border);
}

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

.assignment-item.already-added .assignment-checkbox {
  cursor: not-allowed;
}

.assignment-content {
  flex: 1;
  min-width: 0;
}

.assignment-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  transition: color 0.3s ease;
}

.assignment-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
  transition: color 0.3s ease;
}

.assignment-due {
  display: flex;
  align-items: center;
  gap: 4px;
}

.assignment-due.overdue {
  color: var(--danger);
  font-weight: 600;
}

.assignment-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.assignment-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.assignment-empty-text {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.assignment-empty-hint {
  font-size: 14px;
  opacity: 0.8;
}

@media (max-width: 480px) {
  .page-title {
    font-size: 20px;
  }

  .todo-filters {
    gap: 6px;
  }

  .filter-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .todo-list {
    padding: 12px;
  }

  .todo-item {
    padding: 12px;
  }
}