/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

#todo-container {
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 500px;
  padding: 40px;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  color: #333;
  text-align: center;
  margin-bottom: 30px;
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  padding-bottom: 15px;
}

h1::before {
  content: "📝";
  display: block;
  font-size: 3rem;
  margin-bottom: 10px;
  background: none;
  -webkit-text-fill-color: initial;
}

h1::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
}

.todo-form {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.todo-input {
  flex: 1;
  padding: 16px 20px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: #f8f9fa;
}

.todo-input:focus {
  outline: none;
  border-color: #667eea;
  background: white;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  transform: translateY(-2px);
}

.todo-input::placeholder {
  color: #999;
}

.todo-form input[type="submit"] {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 16px 30px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.todo-form input[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.todo-form input[type="submit"]:active {
  transform: translateY(0);
}

.todos-list {
  list-style: none;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 5px;
}

.todos-list::-webkit-scrollbar {
  width: 8px;
}

.todos-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.todos-list::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
}

.todo {
  background: white;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  animation: slideIn 0.4s ease-out;
  animation-fill-mode: both;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.todo:hover {
  transform: translateX(5px);
  border-color: #e0e0e0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.todo:nth-child(1) {
  animation-delay: 0.1s;
}
.todo:nth-child(2) {
  animation-delay: 0.2s;
}
.todo:nth-child(3) {
  animation-delay: 0.3s;
}
.todo:nth-child(4) {
  animation-delay: 0.4s;
}
.todo:nth-child(5) {
  animation-delay: 0.5s;
}

.todo-text {
  flex: 1;
  font-size: 1.1rem;
  color: #333;
  padding-right: 15px;
  transition: all 0.3s ease;
}

.todo-actions {
  display: flex;
  gap: 10px;
}

.todo-actions button {
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  color: white;
}

.todo-edit {
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
}

.todo-edit::before {
  content: "✏️";
}

.todo-edit:hover {
  transform: scale(1.1);
  box-shadow: 0 5px 15px rgba(34, 197, 94, 0.3);
}

.todo-delete {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

.todo-delete::before {
  content: "🗑️";
}

.todo-delete:hover {
  transform: scale(1.1);
  box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
}

.todo-edit span,
.todo-delete span {
  display: none;
}

.todo-edit-input {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid #667eea;
  border-radius: 12px;
  font-size: 1rem;
  background: #f8f9fa;
  animation: pulse 1.5s infinite;
  margin-bottom: 15px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
  }
}

.todo-edit-input:focus {
  outline: none;
  background: white;
}

.todos-list:empty::after {
  content: "📋 No todos yet. Add one above!";
  display: block;
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 1.1rem;
  animation: fadeIn 0.5s ease-out;
}

/* Responsive Design */
@media (max-width: 600px) {
  #todo-container {
    padding: 25px;
    margin: 10px;
  }

  h1 {
    font-size: 2rem;
  }

  h1::before {
    font-size: 2.5rem;
  }

  .todo-form {
    flex-direction: column;
  }

  .todo-form input[type="submit"] {
    width: 100%;
  }

  .todo {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .todo-actions {
    align-self: flex-end;
  }
}

/* Checkmark Animation */
.todo.completed .todo-text {
  text-decoration: line-through;
  color: #999;
  opacity: 0.7;
}

.todo.completed::before {
  content: "✅";
  margin-right: 10px;
  font-size: 1.2rem;
}
