:root {
  --bg: #f4f4f4;
  --text: #222;
  --card: #fff;
  --primary: #4caf50;
  --low: #4caf50;
  --medium: #ffc107;
  --high: #f44336;
}

[data-theme="dark"] {
  --bg: #1e1e1e;
  --text: #f0f0f0;
  --card: #2a2a2a;
  --primary: #66bb6a;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: 0.3s;
}

.container {
  max-width: 600px;
  margin: 2rem auto;
  padding: 1rem;
  background: var(--card);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#search-input {
  padding: 8px;
  border-radius: 5px;
  border: 1px solid #ccc;
}

#theme-toggle {
  background: none;
  border: none;
  font-size: 1.3em;
  cursor: pointer;
}

form, .sort-controls {
  margin-top: 1rem;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

form input, form select, form button,
.sort-controls select {
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
}

form button {
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
}

#task-list {
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
}

.task-item {
  background: var(--card);
  border: 1px solid #ccc;
  padding: 10px;
  margin-bottom: 10px;
  border-left: 5px solid var(--primary);
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

.task-item.low { border-left-color: var(--low); }
.task-item.medium { border-left-color: var(--medium); }
.task-item.high { border-left-color: var(--high); }

.task-meta {
  font-size: 0.8em;
  color: gray;
  margin-top: 4px;
}

.task-category {
  background: var(--primary);
  color: white;
  padding: 2px 6px;
  border-radius: 12px;
  margin-right: 5px;
}

.task-actions button {
  background: none;
  border: none;
  font-size: 1.1em;
  cursor: pointer;
  margin-left: 8px;
}

.task-item.completed span {
  text-decoration: line-through;
  opacity: 0.6;
}

#empty-message {
  text-align: center;
  color: #888;
  margin-top: 20px;
  font-style: italic;
}

.hidden {
  display: none;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right:0;
  bottom:0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--card);
  padding: 20px;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

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