/* ===== VARIABLES CSS (identiques au portfolio) ===== */
:root {
  --primary: #f5b731;
  --primary-dark: #d9a02a;
  --primary-light: #ffd700;

  --bg-primary: #0c0c0c;
  --bg-secondary: #1a1a1a;
  --bg-card: #1e1e1e;
  --bg-input: #252525;

  --text-primary: #e8e8e8;
  --text-secondary: #a0a0a0;
  --text-muted: #6b6b6b;

  --success: #10b981;
  --danger: #ef4444;

  --border: rgba(255, 255, 255, 0.1);
  --shadow: rgba(0, 0, 0, 0.3);

  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Thème clair */
body.light-theme {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f0f0f0;

  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted: #8a8a8a;

  --border: rgba(0, 0, 0, 0.1);
  --shadow: rgba(0, 0, 0, 0.1);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ===== PARTICULES DE FOND (identique portfolio) ===== */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--primary);
  border-radius: 50%;
  animation: float-particle 20s infinite ease-in-out;
}

@keyframes float-particle {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.3; }
  25% { transform: translate(30px, -40px) scale(1.2); opacity: 0.6; }
  50% { transform: translate(-40px, 30px) scale(0.8); opacity: 0.4; }
  75% { transform: translate(40px, 40px) scale(1.1); opacity: 0.5; }
}

/* ===== CONTAINER ===== */
.container {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
.app-header {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
}

.header-content {
  margin-bottom: 1rem;
}

.app-title {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 900;
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
  0%, 100% { filter: hue-rotate(0deg); }
  50% { filter: hue-rotate(10deg); }
}

.app-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 300;
}

/* Theme toggle */
.theme-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 48px;
  height: 48px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.theme-toggle:hover {
  border-color: var(--primary);
  transform: rotate(20deg);
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.sun-icon {
  display: none;
}

.moon-icon {
  display: block;
}

body.light-theme .sun-icon {
  display: block;
}

body.light-theme .moon-icon {
  display: none;
}

/* ===== TODO APP ===== */
.todo-app {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 10px 40px var(--shadow);
  border: 1px solid var(--border);
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ===== FORM AJOUT ===== */
.add-todo-form {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.todo-input {
  flex: 1;
  padding: 1rem 1.5rem;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 50px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: var(--transition);
}

.todo-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(245, 183, 49, 0.1);
}

.todo-input::placeholder {
  color: var(--text-muted);
}

.btn-add {
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--bg-primary);
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(245, 183, 49, 0.3);
}

.btn-add:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 183, 49, 0.4);
}

.btn-add:active {
  transform: translateY(0);
}

.btn-add svg {
  width: 20px;
  height: 20px;
}

/* ===== FILTRES ===== */
.filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.7rem 1.5rem;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 2px solid var(--border);
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  color: var(--bg-primary);
  border-color: var(--primary);
}

.count {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

.filter-btn.active .count {
  background: rgba(0, 0, 0, 0.2);
}

/* ===== LISTE DE TÂCHES ===== */
.todo-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  max-height: 500px;
  padding-right: 0.5rem;
}

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

.todo-list::-webkit-scrollbar-track {
  background: var(--bg-input);
  border-radius: 10px;
}

.todo-list::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

.todo-item {
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
  animation: slideIn 0.3s ease;
}

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

.todo-item:hover {
  border-color: var(--primary);
  transform: translateX(5px);
}

.todo-item.completed {
  opacity: 0.6;
}

.todo-item.completed .todo-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Checkbox custom */
.todo-checkbox {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  position: relative;
  background: transparent;
}

.todo-checkbox:hover {
  border-color: var(--primary);
}

.todo-checkbox.checked {
  background: var(--success);
  border-color: var(--success);
}

.todo-checkbox.checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 16px;
  font-weight: bold;
}

.todo-text {
  flex: 1;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.5;
  word-break: break-word;
}

.todo-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.btn-delete {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--danger);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-delete:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
  transform: rotate(90deg);
}

.btn-delete svg {
  width: 18px;
  height: 18px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  display: none;
}

.empty-state.show {
  display: block;
}

.empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.empty-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ===== FOOTER ===== */
.todo-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border);
}

.stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-item {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.stat-item strong {
  color: var(--primary);
  font-weight: 700;
  font-size: 1.1rem;
}

.btn-clear {
  padding: 0.6rem 1.2rem;
  background: transparent;
  color: var(--danger);
  border: 2px solid var(--danger);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-clear:hover {
  background: var(--danger);
  color: white;
}

.btn-clear svg {
  width: 16px;
  height: 16px;
}

/* ===== BOUTON RETOUR ===== */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding: 1rem 2rem;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
  align-self: center;
}

.btn-back:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateX(-5px);
}

.btn-back svg {
  width: 20px;
  height: 20px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .container {
    padding: 1.5rem 1rem;
  }

  .app-header {
    margin-bottom: 2rem;
  }

  .app-title {
    font-size: 2rem;
  }

  .theme-toggle {
    position: static;
    margin: 1rem auto 0;
  }

  .todo-app {
    padding: 1.5rem;
  }

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

  .btn-add {
    justify-content: center;
  }

  .filters {
    flex-direction: column;
  }

  .filter-btn {
    justify-content: center;
  }

  .stats {
    flex-direction: column;
    text-align: center;
  }

  .btn-clear {
    width: 100%;
    justify-content: center;
  }

  .todo-item {
    flex-wrap: wrap;
  }

  .todo-time {
    width: 100%;
    text-align: right;
    margin-top: 0.5rem;
  }
}
