/* ─── RESET & VARIABLES ────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --blue-primary: #1a56db;
  --blue-dark:    #1040b0;
  --white:        #ffffff;
  --text-main:    #111827;
  --text-muted:   #6b7280;
  --text-light:   #9ca3af;
  --border:       #e5e7eb;
  --body-bg:      #eef2fb;
  --card-bg:      #f9fafb;
  --priority-high:   #ef4444;
  --priority-low:    #22c55e;
  --radius:    12px;
  --radius-sm:  8px;
  --shadow:      0 1px 4px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
}

/* -- BASE -- */
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--body-bg);
  color: var(--text-main);
  min-height: 100vh;
  padding: 36px 20px 60px;
}

/* -- CONTAINER -- */
.container {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* -- HEADER -- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  box-shadow: var(--shadow-card);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--blue-primary);
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.logo-icon svg {
  width: 18px;
  height: 18px;
}

h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue-primary);
  letter-spacing: -0.3px;
  text-align: left;
}

/* -- SEARCH -- */
.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--body-bg);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 8px 16px;
  flex: 1;
  max-width: 340px;
}

.search-wrap svg {
  width: 15px;
  height: 15px;
  color: var(--text-light);
  flex-shrink: 0;
}

#searchInput {
  border: none;
  background: transparent;
  outline: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  color: var(--text-main);
  width: 100%;
  padding: 0;
  margin: 0;
}

#searchInput::placeholder {
  color: var(--text-light);
}

/* -- FORM SECTION -- */
.form-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* -- INPUTS -- */
input,
select {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus {
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

input::placeholder {
  color: var(--text-light);
}

#taskInput {
  width: 240px;
}

#dateInput {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  width: 150px;
}

#priorityInput {
  width: 110px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* -- BUTTONS -- */
button {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

#addBtn {
  padding: 10px 22px;
  background: var(--blue-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(26, 86, 219, 0.25);
  white-space: nowrap;
}

#addBtn:hover {
  background: var(--blue-dark);
  box-shadow: 0 4px 12px rgba(26, 86, 219, 0.35);
}

#addBtn:active {
  transform: scale(0.98);
}

/* -- TASKS HEADER -- */
.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tasks-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
}

#clearCompletedBtn {
  font-size: 13px;
  font-weight: 500;
  color: var(--blue-primary);
  background: none;
  padding: 4px 0;
  box-shadow: none;
}

#clearCompletedBtn:hover {
  opacity: 0.7;
}

/* -- TODO CONTAINER -- */
#todoContainer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* -- TODO ITEM -- */
.todo-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s, transform 0.15s;
}

.todo-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.todo-item.completed {
  opacity: 0.65;
  text-decoration: none; /* reset — handled per element below */
}

/* Checkbox — if JS renders a checkbox element */
.todo-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  accent-color: var(--blue-primary);
  cursor: pointer;
  border-radius: 6px;
  border: 2px solid var(--border);
  padding: 0;
  margin: 0;
  box-shadow: none;
}

.todo-item input[type="checkbox"]:focus {
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
  border-color: var(--blue-primary);
}

/* Task info wrapper — wrap name + meta in a div with class "task-info" if JS does */
.task-info {
  flex: 1;
  min-width: 0;
}

.task-name {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.task-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
}

.task-date {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
}

/* Priority badge */
.priority-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 50px;
  text-transform: uppercase;
}

.priority-badge.high,
.priority-badge.High {
  color: var(--priority-high);
  background: #fef2f2;
}

.priority-badge.low,
.priority-badge.Low {
  color: var(--priority-low);
  background: #f0fdf4;
}

.todo-item.completed .priority-badge {
  opacity: 0.5;
}

/* Item action buttons (delete, edit etc.) */
.todo-item button {
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  background: transparent;
  color: var(--text-light);
  box-shadow: none;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  margin-right: 0;
}

.todo-item:hover button {
  opacity: 1;
}

.todo-item button:hover {
  background: #fef2f2;
  color: var(--priority-high);
}