/* Reset léger */
* {
  box-sizing: border-box;
}

/* Fond dynamique global */
body {
  font-family: 'Inter', 'Arial', sans-serif;
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #0f172a;
  background: linear-gradient(120deg, #0ea5e9, #6366f1, #22c55e);
  background-size: 300% 300%;
  animation: gradientFlow 7s ease infinite;
  overflow: hidden;
}

/* Bulles lumineuses en fond */
body::before,
body::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
  z-index: 0;
  animation: float 20s linear infinite;
}

body::before {
  background: #38bdf8;
  top: -100px;
  left: -120px;
}

body::after {
  background: #a78bfa;
  bottom: -120px;
  right: -120px;
  animation-delay: -10s;
}

/* Conteneur principal */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 28px;
  border-radius: 18px;
  text-align: center;

  /* effet verre */
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Titre */
.app-container h1 {
  font-size: 2rem;
  margin-bottom: 1.2rem;
  font-weight: 700;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Formulaire */
#todo-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

#todo-input {
  flex: 1;
  padding: 12px 14px;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  outline: none;
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#todo-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

button {
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

/* Liste */
#todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#todo-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

#todo-list li:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

#todo-list li.completed {
  text-decoration: line-through;
  color: #64748b;
  background: rgba(0, 0, 0, 0.05);
}

/* Bouton supprimer */
.delete-btn {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: #ef4444;
  transition: transform 0.15s ease, color 0.15s ease;
}

.delete-btn:hover {
  color: #dc2626;
  transform: scale(1.15) rotate(6deg);
}

/* Checkbox */
.task-toggle {
  margin-right: 10px;
  transform: scale(1.2);
  accent-color: #6366f1;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 480px) {
  .app-container {
    margin: 16px;
    padding: 22px;
  }

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

  button {
    width: 100%;
  }
}

/* Animations */
@keyframes gradientFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes float {
  0% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(40px) translateX(20px); }
  100% { transform: translateY(0) translateX(0); }
}

/* Bouton de thème */
#theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#theme-toggle:hover {
  transform: scale(1.1) rotate(8deg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

/* Thème alternatif */
body.alt-theme {
  background: linear-gradient(120deg, #116572, #1e293b, #0e5a66);
  background-size: 300% 300%;
  animation: gradientFlow 7s ease infinite;
}

body.alt-theme .app-container {
  background: rgba(15, 23, 42, 0.7);
  color: #e5e7eb;
}

body.alt-theme h1 {
  background: linear-gradient(90deg, #22d3ee, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.alt-theme button {
  background: linear-gradient(135deg, #22d3ee, #0ea5e9);
  color: #020617;
}

body.alt-theme #todo-input {
  background: rgba(2, 6, 23, 0.7);
  color: #e5e7eb;
  border-color: rgba(255, 255, 255, 0.15);
}

body.alt-theme #todo-list li {
  background: rgba(2, 6, 23, 0.6);
  color: #e5e7eb;
}

body.alt-theme #theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  background: rgba(32, 223, 248, 0.8);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 20px rgba(0, 225, 255, 0.425);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}