/* ---------------------------------------------------------------------------
   Composition, depot et etat d'un dossier d'autorisation.

   Cette feuille est chargee par l'espace exploitant ET par l'espace
   d'administration : les deux affichent le meme dossier, avec le meme partial
   (resources/views/partials/dossier-etat.blade.php). Elle ne depend donc
   d'aucune des deux autres feuilles et porte ses propres variables, calees sur
   le vert de la plateforme (logo adopte le 2026-09-23).
   --------------------------------------------------------------------------- */
.anssn-pieces,
.anssn-depot,
.dossier-etat {
  --piece-accent: #236f53;
  --piece-accent-fond: #e9f1ee;
  --piece-texte: #36423a;
  --piece-titre: #1e2a23;
  --piece-doux: #697568;
  --piece-filet: #eef0f2;
  --piece-succes: #12805a;
  --piece-succes-fond: #e8f6ef;
  --piece-attente: #a5661a;
  --piece-reclamee: #b4341f;
  --piece-reclamee-fond: #fdeeeb;
}

/* ---- Intitule de sous-ensemble ---- */
.anssn-pieces__groupe {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--piece-titre);
  margin: 26px 0 4px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--piece-accent-fond);
}

.anssn-pieces__groupe:first-child {
  margin-top: 0;
}

/* ---- Liste des pieces ---- */
.anssn-pieces__liste {
  list-style: none;
  margin: 0;
  padding: 0;
}

.anssn-pieces__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--piece-filet);
}

.anssn-pieces__item:last-child {
  border-bottom: 0;
}

.anssn-pieces__num {
  flex: 0 0 auto;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 7px;
  background: var(--piece-accent-fond);
  color: var(--piece-accent);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.anssn-pieces__texte {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--piece-texte);
}

/* ---- Etat d'une piece : fournie ou manquante ---- */
.anssn-pieces__item.est-fournie .anssn-pieces__num {
  background: var(--piece-succes-fond);
  color: var(--piece-succes);
}

.anssn-pieces__item.est-manquante .anssn-pieces__num {
  background: #f4f5f7;
  color: #98a397;
}

.dossier-etat__fichier {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  padding: 5px 11px;
  border: 1px solid var(--piece-filet);
  border-radius: 8px;
  background: #fff;
  color: var(--piece-accent);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  max-width: 100%;
}

.dossier-etat__fichier + .dossier-etat__fichier {
  margin-left: 6px;
}

.dossier-etat__fichier:hover,
.dossier-etat__fichier:focus-visible {
  border-color: var(--piece-accent);
  background: var(--piece-accent-fond);
  color: var(--piece-accent);
}

.dossier-etat__taille {
  color: var(--piece-doux);
  font-weight: 400;
}

.dossier-etat__manquant {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--piece-attente);
}

/* ---- Jauge de completude ---- */
.dossier-etat__jauge {
  margin-bottom: 22px;
}

.dossier-etat__barre {
  height: 7px;
  border-radius: 4px;
  background: var(--piece-filet);
  overflow: hidden;
}

.dossier-etat__barre span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--piece-succes);
  transition: width .3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .dossier-etat__barre span { transition: none; }
}

.dossier-etat__resume {
  margin: 9px 0 0;
  font-size: 13px;
  color: var(--piece-doux);
}

.dossier-etat__resume strong {
  color: var(--piece-titre);
  font-variant-numeric: tabular-nums;
}

.dossier-etat__alerte { color: var(--piece-attente); font-weight: 600; }
.dossier-etat__complet { color: var(--piece-succes); font-weight: 600; }

.dossier-etat__vide {
  font-size: 13.5px;
  color: var(--piece-doux);
  margin: 0;
}

/* ---- Depot : un champ de fichier par piece attendue ---- */
.anssn-depot__consigne {
  font-size: 13px;
  line-height: 1.6;
  color: var(--piece-doux);
  background: var(--piece-accent-fond);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 0 0 18px;
}

.anssn-depot__consigne strong { color: var(--piece-titre); }

.anssn-depot__ligne {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--piece-filet);
}

.anssn-depot__ligne:last-child { border-bottom: 0; }

.anssn-depot__corps {
  flex: 1;
  min-width: 0;
}

.anssn-depot__libelle {
  display: block;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--piece-texte);
  margin-bottom: 7px;
  font-weight: 400;
}

.anssn-depot__ligne.est-fournie .anssn-pieces__num {
  background: var(--piece-succes-fond);
  color: var(--piece-succes);
}

.anssn-depot__etat {
  font-size: 12.5px;
  color: var(--piece-succes);
  margin: 0 0 7px;
}

.anssn-depot__remplacer {
  color: var(--piece-doux);
}

.anssn-depot__corps input[type="file"] {
  display: block;
  width: 100%;
  font-size: 12.5px;
  color: var(--piece-doux);
}

.anssn-depot__aide {
  font-size: 12.5px;
  color: var(--piece-doux);
  margin: 6px 0 0;
}

/* ---- Piece reclamee par le service ----
   Une piece peut etre reclamee alors qu'un fichier a deja ete depose : le
   justificatif fourni ne convient pas. L'etat « fournie » ne suffit donc pas a
   dire que la ligne est reglee, d'ou ce marquage distinct, qui l'emporte
   visuellement sur les deux autres. */
.anssn-pieces__item.est-reclamee .anssn-pieces__num {
  background: var(--piece-reclamee-fond);
  color: var(--piece-reclamee);
}

.dossier-etat__reclamee {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--piece-reclamee);
}

.dossier-etat__reclamee i {
  margin-right: 5px;
}

/* ---------------------------------------------------------------------------
   Pieces reclamees a l'exploitant, et suivi du dossier (espace exploitant).
   --------------------------------------------------------------------------- */
.anssn-reclamations {
  border: 1px solid #f3d9cf;
  background: #fdf7f5;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 22px;
}

.anssn-reclamations__titre {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: #b4341f;
  margin: 0 0 12px;
}

.anssn-reclamations__titre span {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: #8a6a60;
  white-space: nowrap;
}

.anssn-reclamation {
  padding: 10px 0;
  border-top: 1px solid #f3e3dd;
}

.anssn-reclamation:first-of-type {
  border-top: 0;
}

.anssn-reclamation label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: #3d2d28;
  margin-bottom: 6px;
}

.anssn-reclamation__motif {
  display: block;
  font-size: 12.5px;
  font-weight: 400;
  color: #8a6a60;
  margin-top: 2px;
}

.anssn-reclamation input[type="file"] {
  width: 100%;
  font-size: 12.5px;
}

.anssn-reclamation.est-fournie p {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: #697568;
  margin: 0;
}

.anssn-reclamation.est-fournie i {
  color: var(--piece-succes);
}

.anssn-reclamation__depot {
  font-size: 12px;
  color: #98a397;
}

/* ---- Frise de suivi ---- */
.anssn-suivi {
  list-style: none;
  margin: 0;
  padding: 0;
}

.anssn-suivi li {
  display: flex;
  gap: 13px;
  padding: 11px 0;
  border-bottom: 1px solid var(--piece-filet);
}

.anssn-suivi li:last-child {
  border-bottom: 0;
}

.anssn-suivi__puce {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--piece-accent-fond);
  color: var(--piece-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.anssn-suivi__texte {
  display: block;
  font-size: 13.5px;
  color: var(--piece-texte);
  line-height: 1.5;
}

.anssn-suivi__meta {
  display: block;
  font-size: 12px;
  color: var(--piece-doux);
}

.anssn-suivi__detail {
  display: block;
  font-size: 12.5px;
  color: var(--piece-doux);
  margin-top: 4px;
  white-space: pre-line;
}

/* ---- Pièce déposée : ouvrir d'un côté, enregistrer de l'autre ----
   Les deux commandes forment un seul objet visuel, collé, pour qu'on lise
   « ce fichier » et non deux liens distincts. */
.dossier-etat__piece {
  display: inline-flex;
  align-items: stretch;
  margin-top: 5px;
  margin-right: 6px;
  max-width: 100%;
}

.dossier-etat__piece .dossier-etat__fichier {
  margin-top: 0;
  margin-left: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.dossier-etat__telecharger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--piece-filet);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: #fff;
  color: var(--piece-doux);
  font-size: 12.5px;
  text-decoration: none;
}

.dossier-etat__telecharger:hover,
.dossier-etat__telecharger:focus-visible {
  border-color: var(--piece-accent);
  background: var(--piece-accent-fond);
  color: var(--piece-accent);
}

/* Le survol de l'un éclaire la bordure mitoyenne de l'autre : sans cela, le
   filet entre les deux reste gris et casse le bloc en deux. */
.dossier-etat__piece:hover .dossier-etat__fichier,
.dossier-etat__piece:hover .dossier-etat__telecharger {
  border-color: var(--piece-accent);
}

/* ---- Visionneuse de pièce ----
   La pièce s'ouvre dans la page : l'instructeur la lit sans quitter le
   dossier, et sans dépendre du réglage PDF de son navigateur (voir
   partials/piece-visionneuse.blade.php). */
.piece-vue {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.piece-vue[hidden] {
  display: none;
}

.piece-vue__voile {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
}

.piece-vue__carte {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1100px, 100%);
  height: min(90vh, 100%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
  overflow: hidden;
}

.piece-vue__entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--piece-filet);
}

.piece-vue__titre {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--piece-titre);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.piece-vue__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.piece-vue__action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--piece-filet);
  border-radius: 8px;
  background: #fff;
  color: var(--piece-accent);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.piece-vue__action:hover,
.piece-vue__action:focus-visible {
  border-color: var(--piece-accent);
  background: var(--piece-accent-fond);
  color: var(--piece-accent);
}

.piece-vue__fermer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--piece-doux);
  cursor: pointer;
}

.piece-vue__fermer:hover {
  background: #f4f5f7;
  color: var(--piece-titre);
}

/* Fond gris derrière le document : une page blanche sur fond blanc ne se
   distingue pas de la carte qui la porte. */
.piece-vue__corps {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: #f4f5f7;
  overflow: auto;
}

.piece-vue__corps iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.piece-vue__corps img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.piece-vue__repli {
  margin: 0;
  padding: 9px 18px;
  border-top: 1px solid var(--piece-filet);
  font-size: 12.5px;
  color: var(--piece-doux);
  text-align: center;
}

.piece-vue__repli a {
  color: var(--piece-accent);
  font-weight: 600;
}

/* La page ne défile plus derrière la visionneuse ouverte. */
body.piece-vue-ouverte {
  overflow: hidden;
}

@media (max-width: 767px) {
  .piece-vue {
    padding: 0;
  }

  .piece-vue__carte {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .piece-vue__entete {
    flex-wrap: wrap;
  }

  .piece-vue__action {
    font-size: 12px;
    padding: 5px 10px;
  }
}
