/* ── Projets personnels ─────────────────────────────────────────────────────── */

.projects-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 1rem 1rem 5rem;
}

.projects-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.projects-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
}

.projects-back {
  color: var(--color-primary, #6c63ff);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

.projects-header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Boutons ── */
.btn-proj {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px;
}
.btn-proj-primary { background: #6c63ff; color: #fff; }
.btn-proj-primary:hover { background: #574fd6; }
.btn-proj-secondary { background: #f1f3f5; color: #333; }
.btn-proj-secondary:hover { background: #dee2e6; }
.btn-proj-danger { background: #ff4757; color: #fff; }
.btn-proj-danger:hover { background: #e0002f; }
.btn-proj-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; min-height: 36px; }
.btn-proj-xs { padding: 0.2rem 0.5rem; font-size: 0.78rem; min-height: 28px; }
.btn-proj-icon-danger { background: none; border: none; color: #ff4757; cursor: pointer; font-size: 1.1rem; padding: 0.2rem 0.5rem; }

/* ── Filtres ── */
.projects-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.projects-filters select {
  padding: 0.45rem 0.75rem;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
  min-height: 44px;
}

/* ── Section ── */
.projects-section {
  margin-bottom: 2rem;
}
.projects-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.75rem;
}
.projects-empty {
  color: #888;
  font-style: italic;
  font-size: 0.9rem;
}
.projects-empty a { color: #6c63ff; }

/* ── Grille de cartes ── */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 480px) {
  .projects-grid { grid-template-columns: 1fr; }
}

.project-card {
  display: block;
  text-decoration: none;
  background: #fff;
  border: 1.5px solid #e9ecef;
  border-radius: 12px;
  padding: 0.85rem;
  color: inherit;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.project-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); border-color: #adb5bd; }
.project-card.status-done { opacity: 0.65; }
.project-card.status-on_hold { border-style: dashed; }

.project-card-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.project-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}
.project-card-desc {
  font-size: 0.82rem;
  color: #666;
  margin-bottom: 0.4rem;
}
.project-card-owner {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.3rem;
}

/* ── Badges ── */
.project-cat-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid;
}
.project-status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.project-status-todo { background: #e9ecef; color: #495057; }
.project-status-in_progress { background: #fff3cd; color: #856404; }
.project-status-done { background: #d1e7dd; color: #0a3622; }
.project-status-on_hold { background: #f8d7da; color: #842029; }
.project-shared-badge { font-size: 0.75rem; color: #888; }

/* ── Barre de progression ── */
.project-progress {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.project-progress-bar {
  flex: 1;
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}
.project-progress-bar-lg {
  height: 10px;
  border-radius: 5px;
  flex: 1;
}
.project-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6c63ff, #a29bfe);
  border-radius: inherit;
  transition: width 0.3s;
}
.project-progress-label { font-size: 0.75rem; color: #888; white-space: nowrap; }
.project-progress-label-lg { font-size: 0.85rem; color: #555; }

/* ── Modèles chips ── */
.projects-templates-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.proj-template-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border: 1.5px solid #dee2e6;
  border-radius: 20px;
  font-size: 0.85rem;
  text-decoration: none;
  color: #333;
  background: #f8f9fa;
  transition: border-color 0.15s, background 0.15s;
}
.proj-template-chip:hover, .proj-template-chip.selected {
  border-color: #6c63ff;
  background: #f0eeff;
  color: #6c63ff;
}
.proj-template-chip-count { font-size: 0.75rem; color: #888; }

/* ── Formulaire projet ── */
.project-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.proj-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.proj-form-row label {
  font-weight: 600;
  font-size: 0.9rem;
}
.proj-form-row input[type=text],
.proj-form-row input[type=date],
.proj-form-row select,
.proj-form-row textarea {
  padding: 0.6rem 0.75rem;
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}
.proj-form-row-check { flex-direction: row; align-items: center; }
.proj-check-label { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.proj-form-hint { font-size: 0.82rem; color: #888; font-style: italic; margin: 0 0 0.5rem; }
.proj-form-section { border-top: 1px solid #e9ecef; padding-top: 1rem; }
.proj-form-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; padding-top: 0.5rem; }

/* Lignes de sous-tâches création */
.subtasks-create-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.subtask-create-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.subtask-create-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  font-size: 1rem;
}
.subtask-create-date {
  width: 130px;
  padding: 0.5rem 0.5rem;
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  font-size: 0.85rem;
}
.subtask-create-remove {
  background: none;
  border: none;
  color: #adb5bd;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
}
.subtask-create-remove:hover { color: #ff4757; }

@media (max-width: 480px) {
  .subtask-create-date { width: 110px; font-size: 0.8rem; }
}

/* ── Page détail projet ── */
.project-detail-header {
  background: #fff;
  border: 1.5px solid #e9ecef;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.project-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.project-detail-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
}
.project-detail-desc {
  color: #555;
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
}
.project-detail-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

/* Changement de statut */
.project-status-form { margin-top: 0.75rem; }
.project-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.status-pill {
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  border: 1.5px solid transparent;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: #f1f3f5;
  color: #495057;
}
.status-pill-todo.active { background: #e9ecef; border-color: #495057; }
.status-pill-in_progress.active { background: #fff3cd; border-color: #856404; color: #856404; }
.status-pill-done.active { background: #d1e7dd; border-color: #0a3622; color: #0a3622; }
.status-pill-on_hold.active { background: #f8d7da; border-color: #842029; color: #842029; }

/* ── Liste des sous-tâches ── */
.subtask-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.subtask-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #fff;
  border: 1.5px solid #e9ecef;
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  min-height: 44px;
}
.subtask-item.subtask-done {
  opacity: 0.55;
  background: #f8f9fa;
}
.subtask-toggle-form { flex-shrink: 0; }
.subtask-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #adb5bd;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #fff;
  padding: 0;
  flex-shrink: 0;
}
.subtask-checkbox.checked { background: #6c63ff; border-color: #6c63ff; }
.subtask-content { flex: 1; min-width: 0; }
.subtask-title { display: block; font-size: 0.92rem; }
.subtask-done .subtask-title { text-decoration: line-through; }
.subtask-date { font-size: 0.78rem; color: #888; display: block; }
.subtask-date-late { color: #e53e3e; font-weight: 600; }
.subtask-delete-form { flex-shrink: 0; }
.subtask-delete-btn { background: none; border: none; color: #adb5bd; font-size: 1.2rem; cursor: pointer; padding: 0.2rem; line-height: 1; }
.subtask-delete-btn:hover { color: #ff4757; }

/* Ajouter sous-tâche */
.subtask-add-details { margin-top: 0.5rem; }
.subtask-add-summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: #6c63ff;
  font-weight: 600;
  padding: 0.4rem 0;
  list-style: none;
}
.subtask-add-summary::-webkit-details-marker { display: none; }
.subtask-add-form { margin-top: 0.5rem; }
.subtask-add-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.subtask-add-input {
  flex: 1;
  min-width: 140px;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  font-size: 1rem;
}
.subtask-add-date {
  width: 130px;
  padding: 0.5rem 0.5rem;
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* Notes */
.project-notes-section { margin-top: 1.5rem; }
.project-notes-content {
  background: #fffbea;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #555;
}

/* ── Modèles (liste) ── */
.proj-template-card {
  background: #fff;
  border: 1.5px solid #e9ecef;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}
.proj-template-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.proj-template-card-name { font-weight: 700; font-size: 1rem; }
.proj-template-card-desc { font-size: 0.85rem; color: #666; margin: 0 0 0.5rem; }
.proj-template-card-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.proj-template-subtask-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: #555;
}
.proj-template-subtask-list li { padding: 0.1rem 0; }

/* Catégories */
.proj-categories-details { margin-bottom: 1rem; }
.proj-categories-summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.5rem 0;
  list-style: none;
}
.proj-categories-summary::-webkit-details-marker { display: none; }
.proj-categories-body { padding: 0.75rem 0; display: flex; flex-direction: column; gap: 0.5rem; }
.proj-cat-row { display: flex; align-items: center; gap: 0.5rem; }
.proj-cat-form { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; margin-top: 0.5rem; }
.proj-cat-input { padding: 0.45rem 0.75rem; border: 1.5px solid #dee2e6; border-radius: 8px; font-size: 0.9rem; flex: 1; min-width: 100px; }
.proj-cat-icon-input { width: 50px; padding: 0.45rem; border: 1.5px solid #dee2e6; border-radius: 8px; font-size: 0.9rem; text-align: center; }
.proj-cat-color-input { width: 44px; height: 44px; padding: 0; border: 1.5px solid #dee2e6; border-radius: 8px; cursor: pointer; }
.proj-cat-edit-details { display: inline-flex; }
.proj-cat-edit-details summary { list-style: none; cursor: pointer; }
.proj-cat-edit-details summary::-webkit-details-marker { display: none; }
.proj-cat-edit-form { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; margin-top: 0.4rem; padding: 0.5rem; background: #f8f9fa; border-radius: 8px; }

/* Boutons déplacement sous-tâches */
.subtask-order-btns { display: flex; flex-direction: column; gap: 1px; flex-shrink: 0; }
.subtask-move-form { margin: 0; }
.subtask-move-btn { background: none; border: 1px solid #dee2e6; border-radius: 4px; color: #636e72; font-size: 0.75rem; cursor: pointer; padding: 0 0.3rem; line-height: 1.4; min-height: 18px; }
.subtask-move-btn:hover { background: #f1f3f5; color: #2c3e50; }

/* Confirmation suppression */
.proj-confirm-delete { padding: 2rem 0; font-size: 1rem; }
.proj-confirm-delete p { margin-bottom: 1.25rem; }
.proj-confirm-delete form { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ── Image de couverture sur les cartes ── */
.project-card.has-cover { padding: 0; overflow: hidden; }
.project-card.has-cover .project-card-top,
.project-card.has-cover .project-card-title,
.project-card.has-cover .project-card-desc,
.project-card.has-cover .project-card-owner,
.project-card.has-cover .project-progress,
.project-card.has-cover .project-shared-badge {
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}
.project-card.has-cover .project-card-top { padding-top: 0.65rem; }
.project-card.has-cover .project-shared-badge { padding-bottom: 0.65rem; display: block; }
.project-card.has-cover .project-progress { padding-bottom: 0.65rem; }
.project-card-cover {
  width: 100%;
  height: 120px;
  overflow: hidden;
  background: #e9ecef;
}
.project-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Galerie d'images (page détail) ── */
.project-images-section {
  margin-bottom: 1.5rem;
}
.project-images-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.project-image-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #e9ecef;
}
.project-image-thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}
.project-image-caption {
  font-size: 0.72rem;
  color: #666;
  padding: 0.2rem 0.4rem;
  background: rgba(255,255,255,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-image-delete-form { position: absolute; top: 4px; right: 4px; margin: 0; }
.project-image-delete-btn {
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-image-add-details { margin-top: 0.5rem; }
.project-image-add-summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: #6c63ff;
  list-style: none;
  padding: 0.4rem 0;
}
.project-image-add-summary::-webkit-details-marker { display: none; }
.project-image-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 8px;
  margin-top: 0.5rem;
}
.project-image-file-input { font-size: 0.85rem; flex: 1; min-width: 150px; }
.project-image-caption-input {
  padding: 0.4rem 0.75rem;
  border: 1.5px solid #dee2e6;
  border-radius: 8px;
  font-size: 0.85rem;
  flex: 1;
  min-width: 120px;
}

/* ── Drag-and-drop sous-tâches ── */
.subtask-drag-handle {
  cursor: grab;
  color: #adb5bd;
  font-size: 1.1rem;
  padding: 0 0.4rem 0 0;
  flex-shrink: 0;
  user-select: none;
  touch-action: none;
}
.subtask-drag-handle:active { cursor: grabbing; }
.subtask-item.sortable-ghost { opacity: 0.4; background: #f0eeff; }
