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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f4f5f7;
  color: #1f2933;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px 16px;
}

/* ---------- App shell ---------- */
.app {
  width: 100%;
  max-width: 480px;
  background-color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.app__header {
  text-align: center;
  position: relative;
}

/* ---------- Language toggle ---------- */
.lang-toggle {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.lang-toggle:hover {
  border-color: #2f6f4f;
}

.lang-toggle:focus-visible {
  outline: 2px solid #2f6f4f;
  outline-offset: 2px;
}

.lang-toggle__divider {
  opacity: 0.4;
}

.lang-toggle__option {
  opacity: 0.5;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.lang-toggle__option.is-active {
  opacity: 1;
  color: #2f6f4f;
}

.app__title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #2f6f4f;
}

.app__subtitle {
  margin-top: 4px;
  font-size: 0.9rem;
  color: #6b7280;
}

/* ---------- Task form ---------- */
.task-form {
  display: flex;
  gap: 8px;
}

.task-form__input {
  flex: 1;
  padding: 12px 14px;
  font-size: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease;
}

.task-form__input:focus {
  border-color: #2f6f4f;
}

.task-form__button {
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background-color: #2f6f4f;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  white-space: nowrap;
}

.task-form__button:hover {
  background-color: #275c41;
}

.task-form__button:active {
  transform: scale(0.97);
}

/* ---------- Stats ---------- */
.stats {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.stats__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px;
  background-color: #f4f5f7;
  border-radius: 10px;
}

.stats__value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #2f6f4f;
  transition: color 0.15s ease;
}

.stats__label {
  margin-top: 2px;
  font-size: 0.75rem;
  color: #6b7280;
}

/* ---------- Controls (search + filters) ---------- */
.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.controls__search {
  padding: 10px 14px;
  font-size: 0.95rem;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease;
}

.controls__search:focus {
  border-color: #2f6f4f;
}

.controls__filters {
  display: flex;
  gap: 8px;
}

.filter-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
  background-color: #f4f5f7;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.filter-btn:hover {
  background-color: #e6f0ea;
  color: #2f6f4f;
}

.filter-btn.is-active {
  background-color: #2f6f4f;
  border-color: #2f6f4f;
  color: #ffffff;
}

.filter-btn:active {
  transform: scale(0.97);
}

/* ---------- Task list ---------- */
.task-list-section {
  display: flex;
  flex-direction: column;
}

.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@keyframes task-item-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 0.95rem;
  color: #1f2933;
  animation: task-item-enter 0.2s ease;
}

.task-item__toggle {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: #2f6f4f;
  cursor: pointer;
}

.task-item__text {
  flex: 1;
  word-break: break-word;
  transition: color 0.15s ease;
}

.task-item__delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 1rem;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.task-item__delete:hover {
  color: #dc2626;
  background-color: #fee2e2;
}

.task-item__delete:active,
.task-item__edit:active,
.task-item__save:active {
  transform: scale(0.95);
}

.task-item__edit {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.task-item__edit:hover {
  color: #2f6f4f;
  background-color: #e6f0ea;
}

.task-item__edit-input {
  flex: 1;
  padding: 8px 10px;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid #2f6f4f;
  border-radius: 8px;
  outline: none;
}

.task-item__save {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  background-color: #2f6f4f;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.task-item__save:hover {
  background-color: #275c41;
}

.task-item--completed .task-item__text {
  text-decoration: line-through;
  color: #9ca3af;
}

.empty-state {
  text-align: center;
  color: #9ca3af;
  font-size: 0.95rem;
  padding: 32px 0;
  animation: task-item-enter 0.2s ease;
}

.hidden {
  display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 400px) {
  .task-form {
    flex-direction: column;
  }

  .task-form__button {
    width: 100%;
  }
}

@media (min-width: 640px) {
  .app {
    padding: 32px;
  }

  .app__title {
    font-size: 2rem;
  }
}
