/* === PDF.CSS — Styles pour le rendu PDF A4 (html2pdf.js) === */

/* Div temporaire de rendu PDF : visible pour html2canvas mais caché derrière un overlay */
#pdf-render-temp {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  z-index: -1 !important;
  background: #fff !important;
}

/* ================================================================
 * MODELO LEGAL (ml-*) — Styles pour les documents juridiques
 * Utilisés par mandat.js, avenant.js, delegation.js, lia.js, acceptation.js
 * ================================================================ */
.ml-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 2px solid #1a2a5e;
  margin-bottom: 14px;
  font-size: 8.5pt;
  color: #1a2a5e;
  font-weight: 600;
}
.ml-title {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-size: 16pt;
  font-weight: 700;
  color: #1a2a5e;
  text-align: center;
  margin: 20px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ml-section {
  font-size: 11pt;
  font-weight: 700;
  color: #1a2a5e;
  margin: 16px 0 8px;
  padding: 5px 10px;
  background: #e8edf8;
  border-left: 4px solid #1a2a5e;
  border-radius: 0 4px 4px 0;
}
.ml-subsection {
  font-size: 10pt;
  font-weight: 600;
  color: #2c3e8c;
  margin: 10px 0 6px;
  padding-left: 10px;
  border-left: 3px solid #c9a84c;
}
.ml-text {
  font-size: 10pt;
  line-height: 1.6;
  color: #1a1a1a;
  margin: 6px 0;
  text-align: justify;
}
.ml-legal {
  font-size: 9pt;
  line-height: 1.55;
  color: #333;
  margin: 6px 0;
  text-align: justify;
}

/* Signatures */
.ml-sig-row {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  margin-top: 30px;
}
.ml-sig-block {
  flex: 1;
  text-align: center;
  padding: 15px 10px;
  border: 1px dashed #ccc;
  border-radius: 8px;
  min-height: 100px;
}
.ml-sig-label {
  font-size: 8.5pt;
  color: #868e96;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.ml-sig-name {
  font-size: 10pt;
  font-weight: 600;
  color: #1a2a5e;
  margin-bottom: 20px;
}
.ml-sig-zone {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ml-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid #dee2e6;
  margin-top: 14px;
  font-size: 8pt;
  color: #868e96;
}

/* Container PDF dans le modal aperçu */
.pdf-preview-container {
  width: 210mm;
  margin: 0 auto;
  font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
  color: #1a1a1a;
  font-size: 10.5pt;
  line-height: 1.55;
}

/* Page A4 */
.pdf-page {
  width: 210mm;
  min-height: 297mm;
  padding: 18mm 22mm 25mm;
  position: relative;
  page-break-after: always;
  background: #fff;
}
.pdf-page:last-child { page-break-after: auto; }

/* Page de couverture */
.pdf-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 297mm;
  padding: 40mm 22mm;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.pdf-cover::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue-accent), var(--gold));
}
.pdf-cover::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 8px;
  background: linear-gradient(90deg, var(--gold), var(--blue-accent), var(--blue-dark));
}

/* Logo couverture */
.pdf-cover-logo {
  width: 88px;
  height: 88px;
  border: 3px solid var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
  background: #fff;
  box-shadow: 0 4px 20px rgba(26,42,94,0.15);
}
.pdf-cover-logo .logo-text {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 10.5pt;
  color: var(--blue-dark);
  line-height: 1.15;
}

.pdf-cover-agency {
  font-family: 'Playfair Display', serif;
  font-size: 17pt;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 4px;
}
.pdf-cover-info {
  font-size: 8.5pt;
  color: #868e96;
  margin-bottom: 36px;
  line-height: 1.6;
}

.pdf-cover-line {
  width: 65px;
  height: 3px;
  background: var(--gold);
  margin: 0 auto 22px;
}

.pdf-cover-title {
  font-family: 'Playfair Display', serif;
  font-size: 22pt;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.pdf-cover-subtitle {
  font-size: 11.5pt;
  color: #868e96;
}

.pdf-cover-ref {
  margin-top: 36px;
  padding: 12px 32px;
  border: 2px solid var(--blue-dark);
  border-radius: 6px;
  display: inline-block;
}
.pdf-cover-ref span {
  font-family: 'Playfair Display', serif;
  font-size: 12pt;
  font-weight: 600;
  color: var(--blue-dark);
}

.pdf-cover-reg {
  margin-top: 14px;
  font-size: 8.5pt;
  color: #868e96;
  font-style: italic;
}

/* En-tête de page */
.pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 9px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--blue-dark);
}
.pdf-header-left {
  font-family: 'Playfair Display', serif;
  font-size: 8.5pt;
  color: var(--blue-dark);
  font-weight: 600;
}
.pdf-header-right {
  font-size: 7.5pt;
  color: #868e96;
}

/* Titres sections */
.pdf-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 14pt;
  font-weight: 700;
  color: var(--blue-dark);
  margin: 18px 0 12px;
  padding-bottom: 5px;
  border-bottom: 2.5px solid var(--blue-accent);
  display: inline-block;
}
.pdf-section-title::after {
  content: '';
  display: block;
  width: 32px;
  height: 2.5px;
  background: var(--gold);
  margin-top: 3px;
}

.pdf-subsection {
  font-family: 'Playfair Display', serif;
  font-size: 11pt;
  font-weight: 600;
  color: var(--blue-dark);
  margin: 14px 0 7px;
  padding: 6px 11px;
  background: var(--blue-light);
  border-left: 4px solid var(--blue-accent);
  border-radius: 0 4px 4px 0;
}

/* Blocs de texte */
.pdf-party-block {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 9px 0;
  font-size: 9.2pt;
  line-height: 1.6;
}
.pdf-party-block strong { color: var(--blue-dark); }

.pdf-text {
  text-align: justify;
  margin-bottom: 7px;
  font-size: 9.8pt;
}

/* Tableau PDF */
.pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin: 9px 0;
}
.pdf-table th {
  background: var(--blue-dark);
  color: #fff;
  padding: 7px 11px;
  text-align: left;
  font-size: 8pt;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pdf-table td {
  padding: 7px 11px;
  border-bottom: 1px solid #e9ecef;
  font-size: 9.2pt;
}
.pdf-table tr:nth-child(even) td { background: #f8f9fa; }

/* Highlights */
.pdf-highlights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin: 9px 0;
}
.pdf-highlight-card {
  border: 1.5px solid #e9ecef;
  border-radius: 6px;
  padding: 11px 14px;
  text-align: center;
}
.pdf-highlight-label {
  font-size: 7.5pt;
  color: #868e96;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.pdf-highlight-value {
  font-family: 'Playfair Display', serif;
  font-size: 15pt;
  font-weight: 700;
  color: var(--blue-dark);
}
.pdf-highlight-unit {
  font-size: 8.5pt;
  color: #868e96;
}

/* Signatures */
.pdf-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  margin-top: 30px;
}
.pdf-sig-block {
  text-align: center;
  padding: 16px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
}
.pdf-sig-consent {
  margin-bottom: 8px;
  padding: 6px;
  background: var(--blue-light);
  border-radius: 4px;
  font-size: 7.5pt;
  color: #868e96;
}
.pdf-sig-label {
  font-weight: 700;
  font-size: 9.5pt;
  color: var(--blue-dark);
  margin-bottom: 2px;
}
.pdf-sig-name {
  font-size: 8pt;
  color: #868e96;
  margin-bottom: 9px;
}
.pdf-sig-image {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pdf-sig-image img {
  max-height: 60px;
  max-width: 160px;
}
.pdf-sig-date {
  margin-top: 7px;
  font-size: 8pt;
  color: #495057;
  border-top: 1px solid #e9ecef;
  padding-top: 5px;
}

/* Pied de page */
.pdf-footer {
  position: absolute;
  bottom: 15mm;
  left: 22mm;
  right: 22mm;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 7px;
  border-top: 1px solid #e9ecef;
  font-size: 7.5pt;
  color: #868e96;
}

/* Annexe note */
.pdf-annexe-note {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--gold-light);
  border-left: 4px solid var(--gold);
  border-radius: 0 6px 6px 0;
  font-size: 8.8pt;
}
.pdf-annexe-note strong { color: var(--blue-dark); }

/* Dans le modal, réduire le scale pour que ça rentre */
.modal-body .pdf-preview-container {
  transform: scale(0.75);
  transform-origin: top center;
  width: 210mm;
}

/* Mobile: scale down further so A4 fits phone screens */
@media (max-width: 768px) {
  .modal-body .pdf-preview-container {
    transform: scale(0.5);
    transform-origin: top left;
    width: 210mm;
    margin-bottom: -40%;
  }
}
@media (max-width: 480px) {
  .modal-body .pdf-preview-container {
    transform: scale(0.38);
    transform-origin: top left;
    width: 210mm;
    margin-bottom: -55%;
  }
}
