/* =============================================================================
   « Mes sites web » : cartes de projet et fiche du projet (pages/dashboard.html).
   Une carte par projet, de la demande jusqu'au site en ligne ; la fiche réunit
   le suivi, les réponses au questionnaire, les documents et la surveillance.
   Couleurs : variables du thème (css/style.css), sombre et clair.
   ============================================================================= */

/* Variables propres à ce fichier (aussi utilisées par les documents dans
   l'administration, hors de .projets). */
:root {
  --pj-avertissement: #F59E0B;
  --pj-rayon: 16px;
}

/* ── En-tête de la section ─────────────────────────────────────────────── */
.projets-entete {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
/* ── Grille de cartes ──────────────────────────────────────────────────── */
.projets-grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}
@media (max-width: 480px) {
  .projets-grille { grid-template-columns: 1fr; }
}

.projet-carte {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.35rem;
  border-radius: var(--pj-rayon);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
  transition: border-color var(--transition-base), transform var(--transition-base),
              box-shadow var(--transition-base), background var(--transition-base);
}
.projet-carte:hover {
  border-color: var(--glass-border-hover);
  background: var(--glass-bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.projet-carte:focus-visible {
  outline: 2px solid var(--color-cta);
  outline-offset: 3px;
}
.projet-carte.action-requise { border-color: rgba(59, 130, 246, 0.45); }
.projet-carte.archive { opacity: 0.7; }

.projet-carte-haut {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}
.projet-avatar {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff;
  background: linear-gradient(135deg, var(--color-cta), var(--color-accent));
}
.projet-avatar.grand { width: 60px; height: 60px; font-size: 1.55rem; border-radius: 16px; }
.projet-identite { min-width: 0; flex: 1; }
.projet-nom {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.08rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.projet-type {
  margin-top: 0.15rem;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pastille d'état */
.projet-etat {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--glass-bg-hover);
  color: var(--color-text-muted);
  border: 1px solid var(--glass-border);
}
.projet-etat::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.projet-etat.ton-info { color: var(--color-cta-light); background: rgba(59, 130, 246, 0.12); border-color: rgba(59, 130, 246, 0.3); }
.projet-etat.ton-action { color: #fff; background: var(--color-cta); border-color: var(--color-cta); }
.projet-etat.ton-travail { color: var(--color-accent); background: rgba(139, 92, 246, 0.12); border-color: rgba(139, 92, 246, 0.3); }
.projet-etat.ton-succes { color: var(--color-success); background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.3); }
.projet-etat.ton-alerte { color: var(--color-error); background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.3); }
.projet-etat.ton-succes.en-ligne::before { animation: pj-pouls 2s ease-in-out infinite; }
[data-theme="light"] .projet-etat.ton-info { color: var(--color-cta-hover); }
@keyframes pj-pouls {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  50% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
}

/* Mini-progression (carte) */
.projet-progression { display: flex; flex-direction: column; gap: 0.45rem; }
.projet-progression-barre {
  height: 6px;
  border-radius: 3px;
  background: var(--glass-bg-hover);
  overflow: hidden;
}
.projet-progression-barre > span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--color-cta), var(--color-accent));
  transition: width 0.6s ease;
}
.projet-carte.en-ligne .projet-progression-barre > span { background: linear-gradient(90deg, var(--color-success), #34D399); }
.projet-progression-texte {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.projet-carte-bas {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--glass-border);
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: auto;
}
.projet-carte-bas .domaine { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.projet-carte-lien {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
  color: var(--color-cta-light);
}
[data-theme="light"] .projet-carte-lien { color: var(--color-cta); }
.projet-carte:hover .projet-carte-lien svg { transform: translateX(3px); }
.projet-carte-lien svg { width: 15px; height: 15px; transition: transform var(--transition-fast); }

.projet-action-requise {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-cta-light);
  background: rgba(59, 130, 246, 0.1);
}
[data-theme="light"] .projet-action-requise { color: var(--color-cta-hover); }

/* Carte « Nouveau projet » (fin de la grille) */
.projet-nouveau-carte {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  min-height: 190px;
  border-style: dashed;
  border-color: var(--glass-border-hover);
  background: transparent;
  text-decoration: none;
}
.projet-nouveau-carte strong { font-family: var(--font-heading); font-size: 1rem; }
.projet-nouveau-icone {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-cta-light);
  background: rgba(59, 130, 246, 0.12);
  transition: transform var(--transition-base);
}
.projet-nouveau-icone svg { width: 22px; height: 22px; }
.projet-nouveau-carte:hover .projet-nouveau-icone { transform: scale(1.08); }

/* Archives */
.projets-archives { margin-top: 2rem; }
.projets-archives > summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.projets-archives > summary::-webkit-details-marker { display: none; }
.projets-archives > summary::before { content: '▸'; transition: transform var(--transition-fast); }
.projets-archives[open] > summary::before { transform: rotate(90deg); }

/* État vide */
.projets-vide {
  text-align: center;
  padding: 3.5rem 1.5rem;
  border-radius: var(--pj-rayon);
  border: 1px dashed var(--glass-border-hover);
  background: var(--glass-bg);
}
.projets-vide-icone {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.25rem;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--color-cta), var(--color-accent));
}
.projets-vide-icone svg { width: 30px; height: 30px; }
.projets-vide h3 { margin: 0 0 0.5rem; font-family: var(--font-heading); }
.projets-vide p { margin: 0 auto 1.5rem; max-width: 440px; color: var(--color-text-muted); line-height: 1.6; }

/* Squelettes */
.projet-carte.squelette { cursor: default; min-height: 190px; pointer-events: none; }
.projet-carte.squelette:hover { transform: none; box-shadow: none; }

/* ── Fiche du projet ───────────────────────────────────────────────────── */
.projet-retour {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  padding: 0.4rem 0.2rem;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}
.projet-retour:hover { color: var(--color-text); }
.projet-retour svg { width: 16px; height: 16px; }

.projet-hero {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  padding: 1.5rem;
  border-radius: var(--pj-rayon);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(59, 130, 246, 0.14), transparent 55%),
    radial-gradient(120% 140% at 100% 100%, rgba(139, 92, 246, 0.12), transparent 55%),
    var(--glass-bg);
  border: 1px solid var(--glass-border);
}
.projet-hero-texte { flex: 1; min-width: 220px; }
.projet-hero h1 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.projet-hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.projet-hero-meta a { color: var(--color-cta-light); text-decoration: none; }
.projet-hero-meta a:hover { text-decoration: underline; }
.projet-hero-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.projet-hero-actions .auth-btn,
.projet-hero-actions .btn-outline { width: auto; padding: 0.6rem 1.1rem; font-size: 0.88rem; text-decoration: none; }

/* Étapes du parcours */
.projet-etapes {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin: 1.5rem 0 0.5rem;
  padding: 0;
  list-style: none;
  counter-reset: etape;
}
.projet-etape {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.projet-etape::before {
  content: '';
  position: absolute;
  top: 14px;
  left: calc(-50% + 16px);
  right: calc(50% + 16px);
  height: 2px;
  background: var(--glass-border);
}
.projet-etape:first-child::before { display: none; }
.projet-etape.faite::before,
.projet-etape.courante::before { background: var(--color-cta); }
.projet-etape-point {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  background: var(--color-background-lighter);
  border: 2px solid var(--glass-border-hover);
  color: var(--color-text-muted);
}
.projet-etape.faite .projet-etape-point { background: var(--color-cta); border-color: var(--color-cta); color: #fff; }
.projet-etape.courante .projet-etape-point {
  border-color: var(--color-cta);
  color: var(--color-cta-light);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}
.projet-etape.courante { color: var(--color-text); font-weight: 600; }
.projet-etapes.livre .projet-etape .projet-etape-point { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.projet-etapes.livre .projet-etape::before { background: var(--color-success); }
@media (max-width: 600px) {
  .projet-etape-libelle { font-size: 0.68rem; }
  .projet-etape-point { width: 26px; height: 26px; }
  .projet-etape::before { top: 12px; }
}

/* Onglets */
.projet-onglets {
  display: flex;
  gap: 0.25rem;
  margin: 1.5rem 0 1.25rem;
  border-bottom: 1px solid var(--glass-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.projet-onglets::-webkit-scrollbar { display: none; }
.projet-onglet {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition-fast);
}
.projet-onglet svg { width: 17px; height: 17px; }
.projet-onglet:hover { color: var(--color-text); }
.projet-onglet[aria-selected="true"] { color: var(--color-text); font-weight: 600; }
.projet-onglet[aria-selected="true"]::after {
  content: '';
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-cta);
}
.projet-onglet:focus-visible { outline: 2px solid var(--color-cta); outline-offset: -2px; border-radius: 8px; }
.projet-onglet-compte {
  min-width: 20px;
  padding: 0 0.4rem;
  border-radius: var(--radius-full);
  background: var(--glass-bg-hover);
  font-size: 0.72rem;
  line-height: 20px;
  text-align: center;
}
.projet-panneau { animation: pj-apparition 0.25s ease; }
.projet-panneau[hidden] { display: none; }
@keyframes pj-apparition { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .projet-panneau, .projet-carte, .projet-etat::before { animation: none !important; transition: none !important; }
}

/* Cadre de contenu */
.projet-bloc {
  padding: 1.35rem;
  border-radius: var(--pj-rayon);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}
.projet-bloc + .projet-bloc { margin-top: 1rem; }
.projet-bloc-titre {
  margin: 0 0 1rem;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
}
.projet-note { font-size: 0.85rem; color: var(--color-text-muted); line-height: 1.55; }

/* Le suivi réutilise la carte de demande : sans double cadre dans la fiche. */
#requestsContainer .request-card { margin: 0; }

/* ── Questionnaire ─────────────────────────────────────────────────────── */
.reponses-section + .reponses-section { margin-top: 1rem; }
.reponses-liste {
  display: grid;
  grid-template-columns: minmax(180px, 34%) 1fr;
  margin: 0;
}
.reponses-liste dt,
.reponses-liste dd {
  margin: 0;
  padding: 0.75rem 0;
  border-top: 1px solid var(--glass-border);
  font-size: 0.9rem;
}
.reponses-liste dt:first-of-type,
.reponses-liste dt:first-of-type + dd { border-top: none; }
.reponses-liste dt { color: var(--color-text-muted); padding-right: 1.25rem; }
.reponses-liste dd { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.55; }
@media (max-width: 640px) {
  .reponses-liste { grid-template-columns: 1fr; }
  .reponses-liste dt { padding-bottom: 0.1rem; }
  .reponses-liste dd { border-top: none; padding-top: 0; }
}

/* ── Documents ─────────────────────────────────────────────────────────── */
.depot-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: 2rem 1.25rem;
  border-radius: var(--pj-rayon);
  border: 2px dashed var(--glass-border-hover);
  background: var(--glass-bg);
  text-align: center;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.depot-zone.survol { border-color: var(--color-cta); background: rgba(59, 130, 246, 0.08); }
.depot-zone-icone {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-cta-light);
  background: rgba(59, 130, 246, 0.12);
}
.depot-zone-icone svg { width: 24px; height: 24px; }
.depot-zone strong { font-size: 0.98rem; }
.depot-zone .projet-note { margin: 0; }
.depot-controles {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.depot-controles select {
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--glass-border-hover);
  background: var(--color-background-lighter);
  color: var(--color-text);
  font: inherit;
  font-size: 0.88rem;
}
.depot-controles .auth-btn { width: auto; padding: 0.55rem 1.1rem; font-size: 0.88rem; }
.depot-etat { min-height: 1.25rem; font-size: 0.85rem; }
.depot-etat.erreur { color: var(--color-error); }
.depot-etat.ok { color: var(--color-success); }
.depot-progression {
  width: min(320px, 100%);
  height: 4px;
  border-radius: 2px;
  background: var(--glass-bg-hover);
  overflow: hidden;
}
.depot-progression > span {
  display: block;
  height: 100%;
  width: 40%;
  background: var(--color-cta);
  animation: pj-charge 1s ease-in-out infinite;
}
@keyframes pj-charge { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.documents-groupe { margin-top: 1.5rem; }
.documents-groupe-titre {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.documents-grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.9rem;
}
.document-tuile {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.document-tuile:hover { border-color: var(--glass-border-hover); box-shadow: var(--shadow-sm); }
.document-apercu {
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(45deg, var(--glass-bg-hover) 25%, transparent 25%, transparent 75%, var(--glass-bg-hover) 75%),
    linear-gradient(45deg, var(--glass-bg-hover) 25%, transparent 25%, transparent 75%, var(--glass-bg-hover) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  color: var(--color-text-muted);
}
.document-apercu img { width: 100%; height: 100%; object-fit: contain; }
.document-apercu svg { width: 36px; height: 36px; }
.document-extension {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}
.document-categorie {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.9);
  color: #fff;
}
.document-infos { padding: 0.7rem 0.8rem 0.4rem; min-width: 0; }
.document-nom {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.document-meta { margin-top: 0.15rem; font-size: 0.74rem; color: var(--color-text-muted); }
.document-actions {
  display: flex;
  gap: 0.35rem;
  padding: 0.45rem 0.6rem 0.65rem;
}
.document-actions button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.document-actions button:hover { background: var(--glass-bg-hover); border-color: var(--glass-border-hover); }
.document-actions button.danger:hover { color: var(--color-error); border-color: rgba(239, 68, 68, 0.4); }
.document-actions svg { width: 14px; height: 14px; }
.documents-vide { padding: 1.25rem; text-align: center; font-size: 0.88rem; color: var(--color-text-muted); }

/* ── Site en ligne ─────────────────────────────────────────────────────── */
.site-indicateurs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.9rem;
}
.site-indicateur {
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}
.site-indicateur-libelle { font-size: 0.75rem; color: var(--color-text-muted); }
.site-indicateur-valeur { margin-top: 0.3rem; font-family: var(--font-heading); font-size: 1.25rem; font-weight: 700; }
.site-indicateur-valeur.ok { color: var(--color-success); }
.site-indicateur-valeur.moyen { color: var(--pj-avertissement); }
.site-indicateur-valeur.mauvais { color: var(--color-error); }
.site-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.site-actions .auth-btn,
.site-actions .btn-outline { width: auto; padding: 0.55rem 1.1rem; font-size: 0.88rem; text-decoration: none; }
