/* style.css */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
}

body {
  background-color: #f4f4f4;
  padding: 40px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

.container {
  background-color: #fff;
  padding: 30px;
  border-radius: 10px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

h1 {
  text-align: center;
  margin-bottom: 20px;
  color: #333;
}

form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

form input[type="text"],
form input[type="date"],
#filter-input {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

form button {
  padding: 10px;
  background-color: #28a745;
  color: white;
  border: none;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

form button:hover {
  background-color: #218838;
}

#filter-input {
  margin: 20px 0;
}

#todo-list {
  list-style: none;
}

#todo-list li {
  background-color: #f9f9f9;
  border-left: 5px solid #28a745;
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

.task-text {
  flex: 1 1 40%;
  font-weight: bold;
}

.task-date,
.task-status {
  font-size: 0.9em;
  color: #555;
  margin-left: 10px;
}

/* Completed = green */
.task-status.completed {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/* Ongoing = yellow */
.task-status.ongoing {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

.toggle-btn,
.delete-btn {
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
  transition: background-color 0.3s ease;
}

.toggle-btn {
  background-color: #007bff;
  color: white;
}

.toggle-btn:hover {
  background-color: #0069d9;
}

/* Delete button */
.delete-btn {
  background-color: #dc3545;
  color: white;
}

.delete-btn:hover {
  background-color: #c82333;
}

/* Optional: make mobile-friendly */
@media (max-width: 500px) {
  #todo-list li {
    flex-direction: column;
    align-items: flex-start;
  }

  .task-text, .task-date, .task-status {
    margin: 2px 0;
  }

  .toggle-btn, .delete-btn {
    width: 100%;
  }
}

/* Sort Controls Styling */
#sort-controls {
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.95em;
}

#sort-controls label {
  font-weight: bold;
  color: #333;
}

#sort-controls select {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: white;
  font-size: 0.9em;
  cursor: pointer;
}

/* Responsive adjustments */
@media (max-width: 500px) {
  #sort-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  #sort-controls select {
    width: 100%;
  }
}

#todo-form textarea {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  resize: vertical;
  min-height: 60px;
  font-family: Arial, sans-serif;
  font-size: 0.95em;
}

.task-desc {
  flex-basis: 100%;
  font-size: 0.9em;
  color: #444;
  margin-top: 4px;
  white-space: pre-wrap;        /* Preserves line breaks */
  word-wrap: break-word;        /* Forces wrap on long words */
  overflow-wrap: anywhere;      /* Wraps even unbreakable content */
}

.edit-btn {
  background-color: #007bff; /* Bootstrap primary blue */
  color: white;
  border: none;
  padding: 5px 10px;
  margin-left: 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s ease-in-out;
}

.edit-btn:hover {
  background-color: #0056b3;
}

/* Dark mode toggle label styling */
.dark-mode-toggle {
  display: inline-flex;
  align-items: center;
  font-size: 0.95em;
  gap: 5px;
  margin-bottom: 10px;
}

/* Dark mode styles */
body.dark-mode {
  background-color: #1e1e1e;
  color: #f1f1f1;
}

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
  background-color: #2a2a2a;
  color: #f1f1f1;
  border: 1px solid #444;
}

body.dark-mode button {
  filter: brightness(1.1);
}

body.dark-mode .task-status.completed {
  color: #90ee90;
}

body.dark-mode .task-status.ongoing {
  color: #ffdd57;
}
