/* ============================================================
   ORGIRO — style_todo.css
   Styles spécifiques à la page To-do list (Kanban)
   ============================================================ */

/* ---------- Layout principal ---------- */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.todo-main {
  width: 100%;
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  box-sizing: border-box;
  flex: 1 0 auto;
}



/* ---------- Header de page ---------- */


main h1 {
  text-align: center;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--bleu-principal), var(--violet-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 2rem;
}



.todo-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}



/* ---------- Stats ---------- */
.todo-stats {
  font-size: 0.9rem;
  color: var(--texte-secondaire);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}

.stat-sep {
  opacity: 0.4;
}

/* ---------- Board Kanban ---------- */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.2rem;
  align-items: start;
  width: 100%;
}

/* ---------- Colonnes ---------- */
.kanban-col {
  background: var(--fond-cartes);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
  display: flex;
  flex-direction: column;
  min-height: 300px;
  transition: box-shadow 0.2s ease;
  margin-bottom: 3rem;
}

.kanban-col.drag-over {
  box-shadow: 0 0 0 2px var(--bleu-principal), 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* ---------- Headers colonnes ---------- */
.kanban-col-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1rem 0.75rem;
  border-radius: 14px 14px 0 0;
  border-bottom: 2px solid transparent;
}

.kanban-col-icon {
  font-size: 1.1rem;
  background-color: transparent;
}

.kanban-col-titre {
  font-weight: 700;
  font-size: 0.95rem;
  flex: 1;
}

.kanban-col-count {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
}

/* Couleurs par statut */
.kanban-header-afaire {
  color: #1e3a8a;
  background: rgba(0, 68, 255, 0.137);
  border-bottom-color: rgba(30, 58, 138, 0.2);
}

.kanban-header-encours {
  color: #92400e;
  background: rgba(245, 158, 11, 0.08);
  border-bottom-color: rgba(245, 158, 11, 0.3);
}

.kanban-header-enattente {
  color: #6b21a8;
  background: rgba(109, 40, 217, 0.07);
  border-bottom-color: rgba(109, 40, 217, 0.25);
}

.kanban-header-terminee {
  color: #14532d;
  background: rgba(22, 163, 74, 0.07);
  border-bottom-color: rgba(22, 163, 74, 0.25);
}

/* ---------- Corps colonne ---------- */
.kanban-col-body {
  padding: 0.8rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.col-empty {
  display: none;
  text-align: center;
  color: var(--texte-secondaire);
  font-size: 0.85rem;
  padding: 1.5rem 0.5rem;
  opacity: 0.6;
  font-style: italic;
}

/* ---------- Cartes ---------- */
.kanban-carte {
  background: var(--fond-clair, #ffffff);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  cursor: grab;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  border: 1.5px solid transparent;
}

.kanban-carte:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
  border-color: rgba(109, 40, 217, 0.15);
}

.kanban-carte.dragging {
  opacity: 0.45;
  cursor: grabbing;
  transform: scale(0.98);
}

/* Header carte */
.carte-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.carte-titre {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--texte-principal);
  line-height: 1.3;
  flex: 1;
}

.carte-actions {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}

.carte-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: background 0.15s ease, transform 0.2s ease;
}

.carte-btn:hover {
  transform: scale(1.2);
}

.carte-btn img.emoji-img {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.etape-status-icon {
  width: 16px;
  height: 16px;
  margin-right: 0.45rem;
}

/* Description */
.carte-desc {
  font-size: 0.82rem;
  color: var(--texte-secondaire);
  margin-bottom: 0.5rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

/* Footer carte */
.carte-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  gap: 0.4rem;
}

.carte-etapes {
  list-style: none;
  padding: 0.35rem 0 0 0;
  margin: 0 0 0.4rem 0;
  font-size: 0.82rem;
  color: var(--texte-secondaire);
}

.carte-etapes .etape-mini {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  padding: 0.15rem 0;
}

.carte-etapes .etape-mini-action,
.carte-etapes .etape-mini-text {
  cursor: pointer;
}

.carte-etapes .etape-mini-action {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.carte-etapes .etape-mini-text {
  flex: 1;
}

.carte-etapes .etape-mini.faite {
  text-decoration: line-through;
  color: var(--texte-secondaire);
  opacity: 0.76;
}

.carte-etapes .etape-mini.faite img {
  opacity: 0.75;
}

.carte-etapes .etape-plus {
  font-style: italic;
  opacity: 0.8;
}

.carte-date-row {
  margin-bottom: 0.45rem;
}

.carte-date {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--texte-secondaire);
  background: rgba(109, 40, 217, 0.07);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
}

.carte-date img.emoji-img {
  width: 16px;
  height: 16px;
}

.date-depasee {
  background: rgba(229, 62, 62, 0.1);
  color: #c53030;
}

/* Boutons navigation (←→) */
.carte-nav {
  display: none;
  gap: 0.3rem;
  margin-left: auto;
}

.carte-nav-btn {
  display: none;
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--texte-secondaire);
  transition: background 0.15s ease, color 0.15s ease;
}

.carte-nav-btn:hover {
  background: var(--bleu-principal);
  color: white;
  border-color: var(--bleu-principal);
}

/* ---------- Bouton ajouter inline ---------- */
.btn-ajouter-inline {
  background: linear-gradient(135deg, var(--bleu-principal), var(--violet-accent));
  border: none;
  width: 100%;
  padding: 0.6rem 1rem;
  text-align: left;
  font-size: 0.85rem;
  color: #ffffff;
  cursor: pointer;
  border-radius: 0 0 14px 14px;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-ajouter-inline:hover {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.75), rgba(109, 40, 217, 0.75)) !important;
  color: #ffffff;
}

/* ---------- Modales ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.modal-hidden {
  display: none;
}

.modal-contenu {
  background: var(--fond-cartes, #fff);
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
  width: min(540px, calc(100% - 2rem));
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.modal-contenu-small {
  max-width: 360px;
}

#modal-tache .modal-header,
#modal-confirm .modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.2rem 0.8rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  background: transparent !important;
  color: inherit !important;
}

#modal-tache .modal-header h2,
#modal-confirm .modal-header h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--bleu-principal);
  margin: 0;
  flex: 1;
}

#modal-tache .modal-close,
#modal-confirm .modal-close {
  background: none !important;
  border: none !important;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--texte-secondaire) !important;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

#modal-tache .modal-close:hover,
#modal-confirm .modal-close:hover {
  color: var(--texte-principal) !important;
}

.modal-body {
  padding: 1rem 1.2rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
}

.modal-row {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.modal-field {
  flex: 1 1 48%;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.modal-field input,
.modal-field select {
  width: 100%;
}

.modal-body label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--texte-principal);
  margin-top: 0.3rem;
}

.modal-body input[type="text"],
.modal-body input[type="date"],
.modal-body textarea,
.modal-body select {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--fond-clair, #f9f9fc);
  color: var(--texte-principal);
  box-sizing: border-box;
  transition: border-color 0.15s ease;
  font-family: inherit;
}

.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
  outline: none;
  border-color: var(--violet-accent);
}

.modal-body textarea {
  resize: none;
  min-height: 70px;
  overflow: hidden;
}

  .input-error {
    border-color: #e53e3e !important;
    animation: shake 0.3s ease;
  }

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}


.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  padding: 1rem 1.5rem 1.2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}

/* Bouton danger */
.btn-danger {
  background: linear-gradient(135deg, #e53e3e, #c53030) !important;
}



/* Visual feedback for drag-over on cards */
.kanban-carte.drag-over {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  transform: translateY(-3px);
}

/* Make add-step input and button clearer */
.etapes-ajout input {
  flex: 1;
  min-width: 0;
}

.btn-etape-ajouter {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

/* ---------- Section étapes ---------- */
.etapes-section {
  margin-top: 0.4rem;
}

.etapes-liste {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.etape-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: var(--fond-clair, #f9f9fc);
  border: 1px solid rgba(0, 0, 0, 0.07);
  transition: background 0.15s ease;
}

.etape-item.drag-over {
  background: rgba(109, 40, 217, 0.1);
  border-color: rgba(109, 40, 217, 0.35);
}

.etape-item.dragging {
  opacity: 0.5;
}

.etape-item.etape-faite .etape-texte {
  text-decoration: line-through;
  color: var(--texte-secondaire);
  opacity: 0.65;
}

/* Bouton cocher */
.etape-check {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 1rem;
}

.etape-cercle {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(109, 40, 217, 0.4);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.etape-check:hover .etape-cercle {
  border-color: var(--violet-accent);
  background: rgba(109, 40, 217, 0.08);
}

/* Texte de l'étape — normal ou input d'édition */
.etape-texte {
  flex: 1;
  font-size: 0.88rem;
  color: var(--texte-principal);
  line-height: 1.35;
}

.etape-input-edit {
  flex: 1;
  font-size: 0.88rem;
  color: var(--texte-principal);
  font-family: inherit;
  border: 1.5px solid var(--violet-accent);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  background: var(--fond-clair, #f9f9fc);
  outline: none;
}

/* Boutons modifier / supprimer */
.etape-actions {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.etape-item:hover .etape-actions {
  opacity: 1;
}

.etape-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #ccc;
  font-size: 0.9rem;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease;
}

.etape-btn-edit:hover {
  transform: scale(1.1);
}

.etape-btn-suppr:hover {
  transform: scale(1.1);
}

.etape-btn-valider {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.etape-btn-valider:hover {
  transform: scale(1.1);
}

/* Ligne d'ajout d'étape */
.etapes-ajout {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.etapes-ajout input {
  flex: 1;
  padding: 0.45rem 0.7rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.88rem;
  background: var(--fond-clair, #f9f9fc);
  color: var(--texte-principal);
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.etapes-ajout input:focus {
  outline: none;
  border-color: var(--violet-accent);
}

.btn-etape-ajouter {
  flex-shrink: 0;
  min-width: 90px;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--bleu-principal), var(--violet-accent));
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease, transform 0.15s ease;
  line-height: 1.1;
  white-space: nowrap;
}

.btn-etape-ajouter:hover {
  opacity: 0.88;
  transform: scale(1.05);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }

  .todo-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .todo-titre {
    font-size: 1.4rem;
  }
}

/* Modal full-screen on small devices for easier editing */
@media (max-width: 700px) {
  .modal-contenu {
    width: min(95vw, 520px);
    max-width: 520px;
    max-height: 90vh;
    border-radius: 14px;
    margin: 1rem;
  }

  .modal-body {
    padding: 0.95rem 1rem;
  }

  .modal-footer {
    position: sticky;
    bottom: 0;
    background: rgba(255, 255, 255, 0.96);
    padding-bottom: 1rem;
  }

  .kanban-carte {
    padding: 0.6rem;
  }

  .carte-titre {
    font-size: 0.95rem;
  }
}


/* ---------- Modales : même style que le reste du site ---------- */
.modal-overlay { background: rgba(0, 0, 0, 0.55); }

.modal-contenu {
  background: var(--fond-clair);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

/* Barre de défilement fine dans les modales todo */
.modal-contenu .modal-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(109, 40, 217, 0.45) transparent;
}
.modal-contenu .modal-body::-webkit-scrollbar {
  display: block;
  width: 8px;
}
.modal-contenu .modal-body::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px 0;
}
.modal-contenu .modal-body::-webkit-scrollbar-thumb {
  background: rgba(109, 40, 217, 0.45);
  border-radius: 999px;
}

body.dark-theme .modal-contenu .modal-body {
  scrollbar-color: rgba(167, 139, 250, 0.5) transparent;
}
body.dark-theme .modal-contenu .modal-body::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.5);
}

/* Liste déroulante et date : pleine largeur de leur colonne */
.modal-field .cs-wrap,
.modal-field .cs-wrap:not(.cs-bloc) .cs-trigger {
  display: flex;
  width: 100%;
}

/* ---------- Thème sombre ---------- */
body.dark-theme #modal-tache .modal-header h2 { color: #c4b5fd; }

body.dark-theme #modal-tache .modal-header,
body.dark-theme .modal-footer { border-color: #3a3a5e; }

body.dark-theme .modal-body input[type="text"],
body.dark-theme .modal-body textarea,
body.dark-theme .etapes-ajout input,
body.dark-theme .etape-input-edit {
  background: #2a2a3e;
  border-color: #3a3a5e;
  color: var(--texte-principal);
}

body.dark-theme .modal-body input:focus,
body.dark-theme .modal-body textarea:focus,
body.dark-theme .etapes-ajout input:focus { border-color: #a78bfa; }

body.dark-theme .etape-item {
  background: #2a2a3e;
  border-color: #3a3a5e;
}

body.dark-theme .etape-cercle { border-color: rgba(167, 139, 250, 0.6); }

body.dark-theme .btn-outline {
  color: #c4b5fd;
  border-color: #a78bfa;
}
body.dark-theme .btn-outline:hover {
  background: var(--violet-accent);
  border-color: var(--violet-accent);
  color: #fff;
}

@media (max-width: 700px) {
  body.dark-theme .modal-footer { background: var(--fond-clair); }
}

/* ---------- Kanban : thème sombre (mêmes couleurs, en version claire) ---------- */
body.dark-theme main h1 {
  background-image: linear-gradient(135deg, #93b4ff, #c4b5fd);
}

body.dark-theme .kanban-col {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

body.dark-theme .kanban-header-afaire {
  color: #93b4ff;
  background: rgba(59, 110, 255, 0.18);
  border-bottom-color: rgba(147, 180, 255, 0.3);
}

body.dark-theme .kanban-header-encours {
  color: #fdba74;
  background: rgba(245, 158, 11, 0.16);
  border-bottom-color: rgba(252, 211, 77, 0.3);
}

body.dark-theme .kanban-header-enattente {
  color: #c4b5fd;
  background: rgba(167, 139, 250, 0.16);
  border-bottom-color: rgba(196, 181, 253, 0.3);
}

body.dark-theme .kanban-header-terminee {
  color: #86efac;
  background: rgba(34, 197, 94, 0.14);
  border-bottom-color: rgba(134, 239, 172, 0.3);
}

body.dark-theme .kanban-col-count { background: rgba(255, 255, 255, 0.12); }

body.dark-theme .kanban-carte {
  background: #23233a;
  border-color: #2f2f4d;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

body.dark-theme .kanban-carte:hover {
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

body.dark-theme .carte-date {
  background: rgba(167, 139, 250, 0.16);
  color: #c4b5fd;
}

body.dark-theme .date-depasee {
  background: rgba(248, 113, 113, 0.16);
  color: #fca5a5;
}

body.dark-theme .carte-nav-btn { border-color: #3a3a5e; }

/* Les longs mots se coupent au lieu de déborder de la carte */
.kanban-col,
.kanban-carte,
.carte-header { min-width: 0; }

.carte-titre,
.carte-desc,
.carte-etapes .etape-mini-text {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.carte-actions { flex-shrink: 0; }