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

:root {
  --primary: #4c6ef5;
  --primary-light: #748ffc;
  --dark: #212529;
  --light: #f8f9fa;
  --gray: #868e96;
  --danger: #fa5252;
  --success: #40c057;
  --border: #e9ecef;
}

body {
  font-family: "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #edf2ff, #e9ecef);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 25px;
  color: var(--dark);
}

/* App Container */
.app {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: var(--primary);
  color: #fff;
  padding: 25px;
  text-align: center;
}

header h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 5px;
}

header p {
  font-size: 14px;
  opacity: 0.9;
}

/* Todo Input */
.todo-input {
  display: flex;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--light);
}

.todo-input input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  font-size: 1rem;
  transition: 0.2s;
}

.todo-input input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.15);
}

.todo-input button {
  margin-left: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  transition: 0.2s;
}

.todo-input button:hover {
  background: var(--primary-light);
}

/* Filters */
.filters {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  background: #f1f3f5;
}

.filter {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--gray);
  transition: 0.2s;
}

.filter.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 500;
}

/* Todos */
.todos-container {
  padding: 10px 0;
  flex: 1;
  overflow-y: auto;
  max-height: 300px; /* scrolling height */
}

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

.todo-item {
  margin: 8px 15px;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  background: #fff;
  transition: 0.2s;
}

.todo-item:hover {
  background: #f8f9fa;
}

.checkbox-container {
  margin-right: 12px;
  position: relative;
}

.todo-checkbox {
  opacity: 0;
  position: absolute;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid #dee2e6;
  border-radius: 6px;
  display: inline-block;
  cursor: pointer;
  position: relative;
}

.todo-checkbox:checked + .checkmark {
  background: var(--success);
  border-color: var(--success);
}

.todo-checkbox:checked + .checkmark::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.todo-item-text {
  flex: 1;
  font-size: 15px;
}

.todo-item.completed .todo-item-text {
  text-decoration: line-through;
  color: var(--gray);
}

.delete-btn {
  background: none;
  border: none;
  color: var(--gray);
  cursor: pointer;
  font-size: 16px;
  opacity: 0;
  transition: 0.2s;
}

.todo-item:hover .delete-btn {
  opacity: 1;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray);
}

.empty-state i {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: 0.7;
}

.hidden {
  display: none;
}

/* Footer */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  background: #f8f9fa;
}

#items-left {
  color: var(--gray);
}

#clear-completed {
  background: none;
  border: none;
  color: var(--gray);
  cursor: pointer;
  transition: 0.2s;
}

#clear-completed:hover {
  color: var(--danger);
}
