/* ==========================================================================
   Parcinfo - feuille de style centrale (un seul endroit pour tout changement
   d'interface). Les couleurs viennent de config/theme.php, injectees en
   variables CSS par resources/views/partials/theme-vars.blade.php.
   ========================================================================== */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --police-titre: "Fraunces", Georgia, "Times New Roman", serif;
  --police-texte: "Figtree", "Segoe UI", system-ui, sans-serif;
  --rayon: 12px;
  --rayon-petit: 8px;
  --ombre: 0 1px 2px rgba(23, 32, 28, 0.06), 0 8px 24px rgba(23, 32, 28, 0.06);
  --duree: 180ms;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--police-texte);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--encre);
  background: var(--fond);
}

h1, h2, h3 {
  font-family: var(--police-titre);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

h1 { font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem); }
h2 { font-size: 1.375rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand); text-underline-offset: 3px; }

/* Accessibilite : lien d'evitement et focus toujours visibles */
.lien-evitement {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--encre);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: var(--rayon-petit);
  z-index: 10;
  transition: top var(--duree);
}
.lien-evitement:focus { top: 1rem; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Boutons et champs (cibles tactiles de 44 px minimum) ---------- */

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0 1.25rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--rayon-petit);
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--duree), transform var(--duree);
}
.bouton:hover { background: var(--brand-hover); }
.bouton:active { transform: translateY(1px); }
.bouton[aria-busy="true"] { opacity: 0.75; cursor: progress; }
.bouton--plein { width: 100%; }
.bouton--discret {
  color: var(--encre);
  background: transparent;
  border-color: var(--bordure);
  min-height: 44px;
}
.bouton--discret:hover { background: var(--brand-soft); border-color: var(--brand); }

.champ { margin-bottom: 1.25rem; }
.champ label { display: block; font-weight: 600; margin-bottom: 0.375rem; }
.champ .aide { display: block; font-size: 0.875rem; color: var(--encre-douce); margin-top: 0.375rem; }

.saisie {
  display: flex;
  align-items: stretch;
}
.saisie input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 0.875rem;
  font: inherit;
  color: var(--encre);
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-petit);
  transition: border-color var(--duree), box-shadow var(--duree);
}
.saisie input:hover { border-color: var(--encre-douce); }
.saisie input:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft), 0 0 0 4px var(--accent);
}
.saisie input[aria-invalid="true"] { border-color: var(--danger); }
.saisie--avec-bouton input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.saisie__bouton {
  min-width: 48px;
  min-height: 48px;
  padding: 0 0.875rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--encre);
  background: var(--brand-soft);
  border: 1px solid var(--bordure);
  border-left: 0;
  border-radius: 0 var(--rayon-petit) var(--rayon-petit) 0;
  cursor: pointer;
}
.saisie__bouton:hover { border-color: var(--brand); }

.erreur {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-top: 0.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.9375rem;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--rayon-petit);
}
.erreur svg { flex: none; margin-top: 2px; }

/* ---------- Page de connexion ---------- */

.connexion {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1fr);
}

.connexion__marque {
  position: relative;
  display: none;
  padding: 3rem;
  color: #fff;
  background-color: var(--brand);
  background-image:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.14) 0 2px, transparent 3px),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.10) 0 2px, transparent 3px);
  background-size: 28px 28px, 44px 44px;
  overflow: hidden;
}
.connexion__marque::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -120px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  border: 56px solid rgba(255, 255, 255, 0.07);
}
.connexion__marque-contenu {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100%;
  flex-direction: column;
  justify-content: space-between;
}
.connexion__marque .titre-marque {
  max-width: 14ch;
  margin: 0 0 1rem;
  font-family: var(--police-titre);
  font-size: clamp(2rem, 1.2rem + 2vw, 3rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: #fff;
}
.connexion__marque p { max-width: 36ch; font-size: 1.125rem; opacity: 0.92; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--police-titre);
  font-size: 1.375rem;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}
.logo__pastille {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--brand);
  background: #fff;
}
.logo--sombre .logo__pastille { color: #fff; background: var(--brand); }

.connexion__formulaire {
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 2rem 1.25rem 3rem;
}
.connexion__carte {
  width: 100%;
  max-width: 420px;
}
.connexion__carte .logo { margin-bottom: 2rem; }
.connexion__sous-titre { color: var(--encre-douce); margin-bottom: 1.75rem; }
.etiquette-console {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
}

@media (min-width: 62rem) {
  .connexion { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
  .connexion__marque { display: block; }
  .connexion__formulaire { padding: 3rem; }
  .connexion__carte .logo--mobile { display: none; }
}

/* ---------- Gabarit applicatif ---------- */

.entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--bordure);
}
.entete__droite { display: flex; align-items: center; gap: 0.875rem; font-size: 0.9375rem; }
.entete__droite .nom { color: var(--encre-douce); }

.page {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}
.page__titre { margin-bottom: 1.5rem; }
.page__titre p { color: var(--encre-douce); margin: 0; }

.carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
}
.carte--vide { padding: 2.5rem 1.5rem; text-align: center; }
.carte--vide code {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.375rem 0.625rem;
  font-size: 0.875rem;
  background: var(--fond);
  border-radius: 6px;
}

.tableau-conteneur { overflow-x: auto; }
table.tableau { width: 100%; border-collapse: collapse; min-width: 36rem; }
.tableau th,
.tableau td { padding: 0.875rem 1rem; text-align: left; border-bottom: 1px solid var(--bordure); }
.tableau th { font-size: 0.8125rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--encre-douce); }
.tableau tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: 999px;
}
.badge--actif { color: var(--brand); background: var(--brand-soft); }
.badge--suspendu { color: var(--danger); background: var(--danger-soft); }

/* ---------- Pages d'erreur ---------- */

.erreur-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 2rem 1.25rem;
  text-align: center;
}
.erreur-page__code {
  font-family: var(--police-titre);
  font-size: clamp(4rem, 3rem + 6vw, 7rem);
  line-height: 1;
  color: var(--brand);
}

/* ---------- Mouvement : discret, et coupe si l'utilisateur le demande ---------- */

@media (prefers-reduced-motion: no-preference) {
  .connexion__carte,
  .page { animation: apparition 320ms ease-out both; }
}
@keyframes apparition {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
