/* ═══════════════════════════════════════════════════
   FICHES PDF — m2-drome.fr
   Styles appliqués WEB + PRINT (aperçu fidèle)
   Règles print-only dans le bloc @media print
═══════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────
   BARRE D'ACTION (web uniquement, masquée à l'impression)
───────────────────────────────────────────────── */
.action-bar {
  background: #1C1C1E;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.action-bar span { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 0.85rem; opacity: 0.7; }
.btn-print {
  background: #F97316;
  color: #fff;
  border: none;
  padding: 9px 20px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
}
.btn-print:hover { background: #EA6A0A; }
.btn-close { color: rgba(255,255,255,0.5); font-family: 'Plus Jakarta Sans', sans-serif; font-size: 0.85rem; text-decoration: none; }

/* ─────────────────────────────────────────────────
   CONTENEUR PAGE A4
───────────────────────────────────────────────── */
body.fiche-body {
  background: #E5E7EB;
  font-family: 'Plus Jakarta Sans', Arial, sans-serif;
  font-size: 10pt;
  color: #1C1C1E;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.fiche-page {
  background: #fff;
  width: 210mm;
  min-height: 297mm;
  margin: 24px auto;
  padding: 14mm;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', Arial, sans-serif;
}
.fiche-page + .fiche-page { margin-top: 12px; }

/* ─────────────────────────────────────────────────
   EN-TÊTE DE FICHE
───────────────────────────────────────────────── */
.fiche-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 3px solid #1C1C1E;
  padding-bottom: 8mm;
  margin-bottom: 7mm;
}
.fiche-header-left h1,
.fiche-header-left .fiche-titre-suite {
  font-size: 22pt;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0 0 2mm;
  line-height: 1;
  color: #1C1C1E;
}
.fiche-header-left .fiche-soustitre {
  font-size: 9pt;
  color: #6B7280;
  margin: 0;
}
.fiche-header-right { text-align: right; }

.fiche-logo {
  font-size: 15pt;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}
.fiche-logo .logo-m2    { color: #F97316; }
.fiche-logo .logo-drome { color: #1C1C1E; }
.fiche-logo .logo-tld   { color: #9CA3AF; font-size: 10pt; font-weight: 500; }
.fiche-date {
  display: block;
  font-size: 7.5pt;
  color: #9CA3AF;
  margin-top: 3mm;
}

/* ─────────────────────────────────────────────────
   STATS CLÉS
───────────────────────────────────────────────── */
.fiche-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4mm;
  margin-bottom: 7mm;
}
.fiche-stat {
  background: #F5F7FA;
  border-radius: 3mm;
  padding: 4mm;
  border-top: 3pt solid #F97316;
  box-sizing: border-box;
}
.fiche-stat-label {
  font-size: 6.5pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6B7280;
  margin-bottom: 2mm;
}
.fiche-stat-valeur {
  font-size: 15pt;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #1C1C1E;
  margin-bottom: 1.5mm;
}
.fiche-stat-valeur .unite {
  font-size: 8pt;
  font-weight: 500;
  color: #6B7280;
}
.fiche-stat-evol {
  font-size: 7.5pt;
  font-weight: 700;
}
.fiche-stat-evol.hausse { color: #16A34A; }
.fiche-stat-evol.baisse { color: #DC2626; }
.fiche-stat-evol.neutre { color: #6B7280; }

/* ─────────────────────────────────────────────────
   SECTIONS
───────────────────────────────────────────────── */
.fiche-section { margin-bottom: 6mm; }

.fiche-section-titre {
  font-size: 7.5pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6B7280;
  border-bottom: 1pt solid #E5E7EB;
  padding-bottom: 1.5mm;
  margin-bottom: 3mm;
}

/* ─────────────────────────────────────────────────
   TABLEAUX
───────────────────────────────────────────────── */
.fiche-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8.5pt;
}
.fiche-table th {
  background: #1C1C1E;
  color: #fff;
  padding: 2.5mm 3mm;
  text-align: left;
  font-size: 7pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.fiche-table td {
  padding: 2.5mm 3mm;
  border-bottom: 0.5pt solid #E5E7EB;
  color: #1C1C1E;
  font-size: 8.5pt;
}
.fiche-table tr:last-child td { border-bottom: none; }
.fiche-table tr:nth-child(even) td { background: #F9FAFB; }
.fiche-table td.accent { font-weight: 700; color: #F97316; }
.fiche-table td.hausse { color: #16A34A; font-weight: 700; }
.fiche-table td.baisse { color: #DC2626; font-weight: 700; }

/* ─────────────────────────────────────────────────
   GRILLES
───────────────────────────────────────────────── */
.fiche-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5mm;
}
.fiche-cols-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4mm;
}

/* ─────────────────────────────────────────────────
   ANALYSE TEXTUELLE
───────────────────────────────────────────────── */
.fiche-analyse {
  background: #F5F7FA;
  border-left: 3pt solid #F97316;
  border-radius: 0 2mm 2mm 0;
  padding: 3.5mm 4mm;
  font-size: 8.5pt;
  line-height: 1.6;
}
.fiche-analyse strong {
  display: block;
  font-size: 7pt;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6B7280;
  margin-bottom: 1.5mm;
}

/* ─────────────────────────────────────────────────
   BARRES DE PROGRESSION
───────────────────────────────────────────────── */
.fiche-barre-wrapper { margin: 2mm 0; }
.fiche-barre-label {
  display: flex;
  justify-content: space-between;
  font-size: 7.5pt;
  margin-bottom: 1mm;
  color: #374151;
}
.fiche-barre-bg {
  background: #E5E7EB;
  border-radius: 1mm;
  height: 4mm;
  overflow: hidden;
}
.fiche-barre-fill {
  background: linear-gradient(to right, #FB923C, #F97316);
  height: 100%;
  border-radius: 1mm;
}

/* ─────────────────────────────────────────────────
   PASTILLE LIQUIDITÉ
───────────────────────────────────────────────── */
.fiche-liquidite {
  display: inline-flex;
  align-items: center;
  gap: 2mm;
  font-size: 7.5pt;
  font-weight: 600;
  padding: 1.5mm 3mm;
  border-radius: 10mm;
}
.fiche-liquidite.active  { background: #DCFCE7; color: #16A34A; }
.fiche-liquidite.moderee { background: #FEF9C3; color: #CA8A04; }
.fiche-liquidite.faible  { background: #FEE2E2; color: #DC2626; }
.fiche-liquidite::before { content: '●'; font-size: 6pt; margin-right: 1mm; }

/* ─────────────────────────────────────────────────
   FOOTER DE FICHE
───────────────────────────────────────────────── */
.fiche-footer {
  margin-top: 6mm;
  padding-top: 2.5mm;
  border-top: 0.5pt solid #E5E7EB;
  display: flex;
  justify-content: space-between;
  font-size: 6.5pt;
  color: #9CA3AF;
}

/* ─────────────────────────────────────────────────
   BOUTONS EXPORT (sur les pages web)
───────────────────────────────────────────────── */
.btns-export {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 32px 0 0;
}
.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
}
.btn-export-synthese {
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--accent);
}
.btn-export-synthese:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-export-complete {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-export-complete:hover { background: var(--primary); color: #fff; }

/* ─────────────────────────────────────────────────
   RESPONSIVE APERÇU WEB
───────────────────────────────────────────────── */
@media (max-width: 800px) {
  .fiche-page {
    width: 100%;
    margin: 0;
    box-shadow: none;
    padding: 20px;
    min-height: auto;
  }
  .fiche-stats       { grid-template-columns: 1fr 1fr; }
  .fiche-cols        { grid-template-columns: 1fr; }
  .fiche-cols-3      { grid-template-columns: 1fr 1fr; }
  .fiche-table       { font-size: 7.5pt; }
  .fiche-table th,
  .fiche-table td    { padding: 2mm; }
}
@media (max-width: 500px) {
  .fiche-stats       { grid-template-columns: 1fr; }
  .fiche-cols-3      { grid-template-columns: 1fr; }
  .fiche-header      { flex-direction: column; gap: 4mm; }
  .fiche-header-right{ text-align: left; }
}

/* ─────────────────────────────────────────────────
   RÈGLES PRINT UNIQUEMENT
───────────────────────────────────────────────── */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  @page {
    size: A4 portrait;
    margin: 0;
  }

  body.fiche-body { background: #fff; }

  .action-bar { display: none !important; }

  .fiche-page {
    width: 100%;
    margin: 0;
    padding: 14mm;
    box-shadow: none;
    min-height: 297mm;
  }
  .fiche-page + .fiche-page { page-break-before: always; break-before: page; }

  .no-break    { page-break-inside: avoid; break-inside: avoid; }
  .page-break-before { page-break-before: always; break-before: page; }

  .fiche-footer {
    position: fixed;
    bottom: 10mm;
    left: 14mm;
    right: 14mm;
    margin-top: 0;
  }
}
