/* ========================================
   TODO LISTS SECTION
======================================== */

/* === SECTION TODO LISTS - DESIGN MODERNE INSPIRÉ DE SURAHMEMORIZATION === */

#todoLists {
  margin-left: var(--sidebar-width);
  background: var(--gradient-light);
  min-height: 100vh;
  padding: 20px;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header moderne avec gradient (comme dashboard) */
.todo-header {
  background: var(--gradient-primary);
  padding: 1.5rem;
  margin: -20px -20px 30px -20px;
  color: white;
  border-radius: 0;
  position: relative;
  overflow: hidden;
}

.todo-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.todo-header h1 {
  margin: 0 !important;
  font-size: 28px !important;
  font-weight: 800 !important;
  color: white !important;
  text-align: center !important;
  position: relative;
  z-index: 2;
  letter-spacing: -0.02em;
  font-family: var(--main-font);
}

/* Container principal sobre */
#todo-app-container {
  max-width: 1100px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(39, 76, 119, 0.08);
  position: relative;
  border: 1px solid rgba(39, 76, 119, 0.1);
}

/* Navigation sobre (cachée par défaut - style minimaliste) */
.todo-app-nav {
  display: none; /* Navigation cachée pour un design plus sobre */
}

/* Sections sobre */
.todo-app-section {
  padding: 30px;
  background: transparent;
  margin: 0;
}

.todo-title {
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 24px;
  font-size: 20px;
  font-weight: 600;
  text-align: left;
  padding-left: 20px;
  position: relative;
}

.todo-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  background: var(--gradient-primary);
  border-radius: 2px;
}

/* Card sobre et moderne */
.todo-card {
  background: white;
  border: 1px solid rgba(39, 76, 119, 0.12);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 1px 3px rgba(39, 76, 119, 0.08);
  margin-bottom: 20px;
  transition: all 0.2s ease;
}

.todo-card:hover {
  box-shadow: 0 4px 12px rgba(39, 76, 119, 0.12);
  border-color: rgba(39, 76, 119, 0.2);
}

.todo-card-header {
  background: var(--gradient-primary);
  padding: 18px 24px;
  color: white;
  border-bottom: none;
  position: relative;
}

/* Effet décoratif comme le header principal */
.todo-card-header::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -5%;
  width: 150px;
  height: 150px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.todo-card-title {
  color: white;
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--main-font);
  letter-spacing: -0.01em;
}

.todo-card-content {
  padding: 20px;
  background: #fafbfc;
}

/* Header avec actions */
.todo-card-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.tasks-counter {
  font-size: 14px;
  margin-left: 0.5rem;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
}

.todo-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Input group moderne */
.todo-input-group {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: stretch;
}

.todo-input {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid rgba(39, 76, 119, 0.2);
  border-radius: 8px;
  background: white;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-size: 14px;
  font-family: var(--main-font);
  height: 48px;
}

.todo-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(39, 76, 119, 0.1);
}

.todo-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0 32px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  font-family: var(--main-font);
  white-space: nowrap;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.todo-btn:hover {
  background: var(--secondary-color);
  box-shadow: 0 2px 8px rgba(39, 76, 119, 0.2);
}

.todo-btn:active {
  transform: scale(0.98);
}

/* Liste des tâches sobre */
.todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.todo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: white;
  border: 1px solid rgba(39, 76, 119, 0.1);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.todo-item:hover {
  background: #f8f9fa;
  border-color: rgba(39, 76, 119, 0.2);
  box-shadow: 0 2px 4px rgba(39, 76, 119, 0.08);
}

/* Structure de la tâche - Alignement vertical parfait */
.task-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-height: 40px; /* Hauteur minimale pour alignement */
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px; /* Même hauteur que task-content */
}

.todo-item label.task-name {
  display: flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
  font-weight: 600;
  color: var(--primary-color);
  line-height: 1.4;
  padding: 4px 0; /* Padding vertical pour meilleur alignement */
}

.todo-item.completed label.task-name {
  text-decoration: line-through;
  color: #8b8c89;
  opacity: 0.7;
}

.todo-checkbox {
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
  border-radius: 4px;
  border: 2px solid #274c77;
  background: rgba(255, 255, 255, 0.9);
  transition: background 0.3s ease, border-color 0.3s ease;
  flex-shrink: 0; /* Empêche la réduction */
}

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

.todo-delete-btn,
.todo-rename-btn {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(39, 76, 119, 0.2);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0; /* Empêche la réduction */
}

.todo-delete-btn {
  color: #ff4444;
}

.todo-delete-btn:hover {
  background: rgba(255, 68, 68, 0.1);
  border-color: #ff4444;
  transform: scale(1.05);
}

.todo-rename-btn {
  color: var(--primary-color);
  font-size: 14px;
}

.todo-rename-btn:hover {
  background: rgba(39, 76, 119, 0.1);
  border-color: var(--primary-color);
  transform: scale(1.05);
}

/* Actions de sélection */
/* Container pour alignement horizontal des actions de sélection */
.todo-card .todo-header-actions {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
}

.select-all-container {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 20px;
  transition: background 0.3s ease;
  flex: 0 0 auto; /* Empêche l'étirement */
}

.select-all-container:hover {
  background: rgba(255, 255, 255, 0.2);
}

.select-all-label {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap; /* Empêche la coupure du texte */
}

.todo-delete-selected-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(220, 53, 69, 0.9);
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  opacity: 1;
  transition: all 0.2s ease;
  flex: 0 0 auto;
  white-space: nowrap;
  font-weight: 500;
  font-size: 14px;
}

.todo-delete-selected-btn svg {
  stroke: white !important;
}

.delete-counter {
  color: white !important;
  font-weight: 700;
  font-size: 15px;
  font-family: var(--main-font);
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 12px;
  min-width: 32px;
  text-align: center;
  display: inline-block;
}

.todo-delete-selected-btn:not([disabled]):hover {
  background: rgba(220, 53, 69, 1);
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.todo-delete-selected-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

/* === Responsive Design === */
@media (max-width: 1024px) {
  #todoLists {
    margin-left: auto;
    margin-right: auto;
    width: 90vw;
  }

  .todo-card {
    max-width: 90vw;
  }
}

@media (min-width: 640px) {
  #todoLists {
    padding: 2rem;
  }

  h1 {
    font-size: var(--h1-size);
  }

  .todo-card-title {
    font-size: 1.5rem;
  }

  .todo-card-content {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  /* TodoLists Mobile - Design optimisé pour 480px */
  #todoLists {
    padding: 8px;
    background: var(--gradient-light);
    min-height: 100vh;
    width: 97vw;
  }

  /* Header mobile */
  .todo-header {
    margin-bottom: 12px;
    padding: 12px 0;
  }

  .todo-header h1 {
    font-size: 20px;
    color: var(--primary-color);
    margin-bottom: 8px;
  }

  /* Container mobile */
  #todo-app-container {
    padding: 12px;
    border-radius: 12px;
    margin: 0;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
  }

  /* Navigation mobile */
  .todo-app-nav {
    padding: 8px;
    margin-bottom: 12px;
    border-radius: 8px;
  }

  .todo-app-nav-button {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
    margin-right: 6px;
  }

  /* Section mobile */
  .todo-app-section {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 8px;
  }

  /* Titre mobile */
  .todo-title {
    font-size: 16px;
    margin-bottom: 12px;
    padding: 8px 0;
  }

  .todo-title::before {
    font-size: 14px;
    margin-right: 6px;
  }

  /* Card mobile - Centrée */
  .todo-card {
    margin: 0 auto 12px auto; /* Centrage horizontal */
    border-radius: 8px;
    max-width: 100%; /* Assure que la carte ne dépasse pas */
    width: 100%; /* Prend toute la largeur disponible */
  }

  .todo-card-header {
    padding: 12px;
    border-radius: 8px 8px 0 0;
  }

  .todo-card-title {
    font-size: 16px;
    color: white;
    font-weight: 600;
  }

  .todo-card-title::before {
    font-size: 14px;
    margin-right: 6px;
  }

  .todo-card-content {
    padding: 12px;
  }

  /* Input et bouton mobile */
  .todo-input-group {
    gap: 8px;
    margin-bottom: 12px;
    flex-direction: column;
  }

  .todo-input {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 8px;
  }

  .todo-btn {
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 8px;
    width: 100%;
  }

  /* Liste des tâches mobile */
  .todo-list {
    max-height: calc(100vh - 400px);
    overflow-y: auto;
  }

  .todo-item {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Structure de la tâche mobile - Alignement vertical parfait */
  .task-content {
    gap: 10px;
    align-items: center;
    display: flex;
    min-height: 36px; /* Hauteur réduite pour mobile */
  }

  .todo-item label.task-name {
    font-size: 14px;
    margin: 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 2px 0;
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .todo-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    flex-shrink: 0;
  }

  /* Actions des tâches mobile - émojis plus petits */
  .task-actions {
    gap: 6px;
    display: flex;
    align-items: center;
    min-height: 36px; /* Même hauteur que task-content */
  }

  .todo-delete-btn,
  .todo-rename-btn {
    padding: 4px;
    border-radius: 4px;
    font-size: 12px;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Empêche la réduction */
  }

  /* Actions de sélection mobile - alignement horizontal maintenu */
  .todo-selection-actions {
    gap: 8px;
    margin-bottom: 12px;
    flex-direction: row; /* Force l'alignement horizontal même sur mobile */
    justify-content: space-between;
  }

  .select-all-container {
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    flex: 0 1 auto; /* Permet une légère flexibilité */
  }

  .select-all-label {
    font-size: 13px;
  }

  .todo-delete-selected-btn {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 6px;
    flex: 0 1 auto; /* Permet une légère flexibilité */
  }

  /* Counter mobile */
  .tasks-counter {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
  }

  /* Header actions mobile - MAINTIENT L'ALIGNEMENT HORIZONTAL */
  .todo-card .todo-header-actions {
    gap: 8px !important;
    flex-direction: row !important; /* Force l'alignement horizontal même sur mobile */
    justify-content: space-between !important;
    align-items: center !important;
    display: flex !important;
    flex-wrap: nowrap !important; /* Empêche le retour à la ligne */
  }

  /* Forcer les éléments enfants à rester sur la même ligne */
  .todo-card .todo-header-actions .select-all-container,
  .todo-card .todo-header-actions .todo-delete-selected-btn {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    min-width: auto !important;
  }

  .todo-card-header-content {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
}

