/* Body styles */
body {
  font-family: "Work Sans", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(100deg, #575656, #062e3f);
  background-repeat: no-repeat;
  background-size: cover;
}

/* Theme switcher container */
.theme-switcher {
  position: absolute;
  top: 40px;
  right: 40px;
}

/* Theme switcher button */
.theme-switcher__button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #d1dae3;
  margin-left: 10px;
  cursor: pointer;
  transition: 0.3s;
}

/* light theme button */
.theme-switcher__button--light {
  background: linear-gradient(100deg, #d4f1ff, #ffffff);
}

/* dark theme button */
.theme-switcher__button--dark {
  background: linear-gradient(100deg, #575656, #062e3f);
}

/* Container for main content */
.container {
  text-align: center;
  width: 100%;
  max-width: 800px;
  padding: 1rem;
}

/* Title styling */
.title {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid rgba(0, 0, 0, 0.75);
  color: rgb(255, 223, 219);
  font-size: 6rem;
  font-weight: 550;
  margin-bottom: 2rem;
  text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.563);
  animation: animated-text 1.5s steps(11, end) 0.5s 1 normal both,
    animated-cursor 750ms steps(11, end) infinite;
}

/* Keyframes for text animation */
@keyframes animated-text {
  from {
    width: 0%;
  }
  to {
    width: 480px;
  }
}

/* Keyframes for cursor animation */
@keyframes animated-cursor {
  from {
    border-right-color: rgba(0, 0, 0, 0.75);
  }
  to {
    border-right-color: transparent;
  }
}

/* Todo form container */
.todo-form {
  display: flex;
  justify-content: center;
}

/* Input field for adding new tasks */
.todo-form__input {
  padding: 1rem;
  font-size: 1.2rem;
  border: none;
  outline: none;
  border-top-left-radius: 15px;
  border-bottom-left-radius: 15px;
  width: 100%;
  background-color: #2c2b2be7;
  color: #fce4ec;
  max-width: 600px;
}

/* Button to submit the form */
.todo-form__button {
  padding: 1.2rem 1.5rem;
  font-size: 1.1rem;
  border: none;
  border-top-right-radius: 15px;
  border-bottom-right-radius: 15px;
  cursor: pointer;
  background-color: #fce4ec;
  color: #1b1c1e;
  font-weight: bold;
}

/* Date and time display */
.datetime {
  margin-bottom: 2rem;
  opacity: 0.8;
  color: rgb(255, 223, 219);
}

/* Todo list */
.todo-list {
  list-style: none;
  padding: 0;
}

/* Todo item */
.todo {
  background-color: rgba(255, 255, 255, 0.1);
  margin: 1rem auto;
  padding: 1rem 1.5rem;
  border-radius: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 600px;
  font-size: 1.2rem;
  color: #fff;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

/* Todo item text */
.todo__item {
  flex: 1;
  text-align: left;
  padding: 0 1rem;
}

.todo__date {
  font-size: 12px;
  color: gray;
}

/* Button for editing and deleting tasks */
.todo__check-btn,
.todo__delete-btn,
.todo__edit-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
}

.todo__edit-input {
  padding: 6px 10px;
  font-size: 1rem;
  border: none;
  background-color: #2c2d2e;
  color: #fce4ec;
  border-radius: 8px;
  outline: none;
  flex: 1;
  margin-right: 8px;
  font-family: inherit;
  transition: border 0.2s ease-in-out;
}

.todo__save-btn {
  background-color: #fce4ec;
  color: #2c2d2e;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s ease;
  margin: 0 8px;
}

.todo__date {
  display: inline-block;
  margin: 0 10px;
  font-size: 0.85rem;
  color: #777;
}

.error-popup {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(140deg, #fce4ec, #ffecec);
  color: #1b1c1e;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 16px;
  font-family: "Comic Sans MS", "DynaPuff", cursive;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  display: none;
  z-index: 999;
  animation: slideDown 0.5s ease forwards;
}

.error-popup.show {
  display: block;
}

.done .todo__item {
  text-decoration: line-through;
  color: gray;
  opacity: 0.6;
  transition: all 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.filter-buttons {
  margin: 1rem 0 2rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  border: none;
  background-color: #fce4ec;
  color: #1b1c1e;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  background-color: #ffccd5;
  transform: translateY(-2px);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #06222e;
  border-radius: 20px;
  padding: 2rem;
  max-width: 250px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  color: #d1dae3;
  font-family: "Work Sans", sans-serif;
}

.modal-content p {
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  line-height: 1.4;
}

.modal-content button {
  padding: 1rem 1.2rem;
  font-size: 1rem;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  font-weight: bold;
  margin: 0.5rem;
  transition: background-color 0.3s, color 0.3s;
}

#confirm-delete {
  background-color: #fce4ec;
  color: #1b1c1e;
}

#cancel-delete {
  background-color: #2c2b2be7;
  color: #fce4ec;
}

#confirm-delete:hover {
  background-color: #e8b7c4;
}

#cancel-delete:hover {
  background-color: #403f3f;
}

/* Light Theme for body */
body.light-theme {
  background: linear-gradient(100deg, #d4f1ff, #ffffff);
}

body.light-theme .todo {
  background-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .todo__item {
  color: #1b1c1e;
}

body.light-theme .todo-form__input {
  background-color: #fff;
  color: #1b1c1e;
}

body.light-theme .todo-form__button {
  background-color: #ffcccb;
  color: #1b1c1e;
}

body.light-theme .datetime {
  color: rgb(30, 30, 30);
}

body.light-theme .title {
  color: rgb(30, 30, 30);
}

body.light-theme i {
  color: #ec9e9d;
}

body.light-theme .todo__edit-input {
  color: #1b1c1e;
  background-color: #fff;
}

body.light-theme .todo__save-btn {
  background-color: #ffcccb;
  color: #1b1c1e;
}

body.light-theme .error-popup {
  background: linear-gradient(135deg, #feb6b5, #ffcccb);
  color: #3a3a3a;
}

body.light-theme .filter-btn {
  background-color: #ffcccb;
  color: #1b1c1e;
}

body.light-theme .filter-btn:hover {
  background-color: #ffa6a6;
}

body.light-theme .modal-content {
  background: #daf2fe;
  color: #ffc3c2;
}

@media screen and (max-width: 1024px) {
  .title {
    font-size: 4.5rem;
    animation: none;
    white-space: normal;
    border: none;
  }

  .todo-form {
    flex-direction: column;
    align-items: center;
  }

  .todo-form__input,
  .todo-form__button {
    width: 100%;
    max-width: 90%;
    border-radius: 12px;
  }

  .todo-form__button {
    margin-top: 10px;
  }

  .todo {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1rem;
    font-size: 1rem;
  }

  .todo__item {
    padding: 0;
    text-align: left;
    width: 100%;
  }

  .todo__edit-input {
    width: 100%;
    margin: 0;
    margin-top: 8px;
  }

  .todo__save-btn {
    width: 100%;
    margin-top: 6px;
  }

  .theme-switcher {
    top: 20px;
    right: 20px;
  }

  .title {
    font-size: 3.5rem;
  }

  .container {
    padding: 1rem 0.5rem;
  }

  .datetime {
    font-size: 1rem;
  }
}

@media screen and (max-width: 600px) {
  .title {
    font-size: 2.5rem;
    animation: none;
    white-space: normal;
    border: none;
    line-height: 1.2;
  }

  .theme-switcher {
    top: 10px;
    right: 10px;
  }

  .todo-form__input,
  .todo-form__button {
    font-size: 1rem;
    padding: 0.8rem;
  }

  .todo-form__button {
    font-weight: normal;
  }

  .todo {
    font-size: 0.95rem;
  }

  .error-popup {
    font-size: 14px;
    padding: 10px 16px;
  }
}
