:root {
  --primary-color: #4caf50;
  --secondary-color: #2196f3;
  --background-light: #f7f9fc;
  --background-dark: #121212;
  --text-light: #222;
  --text-dark: #eee;
  --border-radius: 8px;
  --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--background-light);
  color: var(--text-light);
  font-family: var(--font-family);
  margin: 0;
  padding: 1rem;
  transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
  background-color: var(--background-dark);
  color: var(--text-dark);
}

.container {
  max-width: 600px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  margin-bottom: 1rem;
}

.add-habit-section {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.add-habit-section input[type="text"] {
  flex-grow: 1;
  padding: 10px;
  font-size: 1rem;
  border: 2px solid var(--primary-color);
  border-radius: var(--border-radius);
  transition: border-color 0.3s;
}

.add-habit-section input[type="text"]:focus {
  outline: none;
  border-color: var(--secondary-color);
}

.add-habit-section button {
  background-color: var(--primary-color);
  border: none;
  color: white;
  padding: 10px 14px;
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
}

.add-habit-section button:hover {
  background-color: var(--secondary-color);
}

.add-habit-section label {
  align-self: center;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--primary-color);
}

.habits-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.habit-item {
  background-color: white;
  padding: 1rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 5px rgb(0 0 0 / 0.1);
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s, color 0.3s;
}

body.dark-mode .habit-item {
  background-color: #1f1f1f;
  box-shadow: 0 2px 5px rgb(255 255 255 / 0.1);
}

.habit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.habit-header h3 {
  margin: 0;
  font-weight: 700;
  font-size: 1.1rem;
  user-select: none;
}

.habit-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.habit-controls button {
  background-color: var(--primary-color);
  border: none;
  color: white;
  padding: 5px 10px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.3s;
}

.habit-controls button:hover {
  background-color: var(--secondary-color);
}

.habit-checkin {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.habit-checkin label {
  user-select: none;
  font-weight: 600;
}

.streak {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--secondary-color);
}

.completed {
  text-decoration: line-through;
  opacity: 0.6;
}

@media (max-width: 480px) {
  .add-habit-section {
    flex-direction: column;
  }

  .add-habit-section button {
    width: 100%;
  }
}
