/*
 * EARONTECH — REPÈRES DE MAINTENANCE
 * Écrans : Modales de préparation des synthèses : champs, actions et aperçu PDF.
 * Chargement : private/view.php, public/project-synthesis-editor-modal.js.
 * Les couleurs et tailles paramétrables utilisent les variables --app-* / --product-*.
 * Les blocs @media adaptent la même interface à la largeur de l’écran.
 * Conserver l’ordre des règles : les ajustements spécialisés suivent le socle commun.
 */

/* La page complète conserve son défilement normal hors de la modale. */
/* Les actions restent dans la colonne de saisie, au-dessus des champs défilants. */
body.platform-appearance .synthesis-editor-controls {
  position:sticky;
  top:0;
  z-index:3;
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:8px 0 10px;
  margin:0 0 10px;
  background:#fff;
  border-bottom:1px solid var(--app-primary-border,#bdd6e9);
  box-shadow:0 4px 5px -5px #14233860
}

body.platform-appearance .synthesis-editor-controls>form {
  margin:0;
  padding:0
}

body.platform-appearance .synthesis-editor-controls :is(.synthesis-editor-actions,.brief-actions,.selection-summary-actions) {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:6px;
  margin:0
}

body.platform-appearance .synthesis-editor-controls label:not(.field) {
  display:inline-flex;
  align-items:center;
  gap:5px;
  margin:4px 8px 4px 0
}

body.platform-appearance .synthesis-editor-controls input[type=checkbox] {
  flex:none;
  margin:0
}

body.platform-appearance .synthesis-editor-controls p {
  margin:3px 0;
  font-size:.85em
}

body.platform-appearance .synthesis-editor-controls p:empty {
  display:none
}

body.platform-appearance .synthesis-editor-controls [data-pdf-password-fields]:not([hidden]) {
  display:flex;
  flex-wrap:wrap;
  align-items:flex-end;
  gap:5px 8px
}

body.platform-appearance .synthesis-editor-controls [data-pdf-password-fields]>.field {
  flex:1 1 180px;
  margin:0
}

body.platform-appearance .synthesis-editor-controls [data-pdf-password-fields]>small {
  flex-basis:100%;
  font-size:.8em;
  line-height:1.25
}

body.platform-appearance .synthesis-editor-controls [data-pdf-password-status]:empty {
  display:none
}

/* Autonome : la page projet n'utilise pas toujours les styles des dossiers en modale. */
dialog.production-dossier-modal.study-synthesis-editor-modal {
  width:70vw;
  max-width:70vw;
  height:80vh;
  max-height:80vh;
  padding:12px;
  box-sizing:border-box;
  border:1px solid var(--app-primary-border,#bdd6e9);
  border-radius:10px;
  background:#fff;
  overflow:hidden
}

dialog.study-synthesis-editor-modal[open] {
  display:flex;
  flex-direction:column;
  gap:8px
}

.study-synthesis-editor-modal::backdrop {
  background:#14233870
}

.study-synthesis-editor-modal>header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex:none
}

.study-synthesis-editor-modal>header h2 {
  margin:0;
  font-size:calc(17px * var(--app-font-scale,1));
  color:var(--app-primary-color,#227e9d)
}

.study-synthesis-editor-modal>p {
  margin:0;
  flex:none;
  font-size:calc(12px * var(--app-font-scale,1))
}

.study-synthesis-editor-modal>p:empty {
  display:none
}

.study-synthesis-editor-modal>iframe {
  display:block;
  width:100%;
  height:100%;
  flex:1 1 0;
  min-width:0;
  min-height:0;
  box-sizing:border-box;
  border:0;
  padding:0;
  background:#fff
}

.study-synthesis-editor-modal>iframe[hidden] {
  display:none
}

/* Deux zones indépendantes : la saisie ne déplace jamais l'aperçu. */
@media(max-width:650px) {
}

/* Faisabilité, réajustement, prototypage et bilan global : mêmes zones de lecture. */
body.platform-appearance dialog:is([data-fw-document],[data-ra-document],[data-proto-document],[data-global-summary]) {
  height:80vh;
  max-height:80vh;
  box-sizing:border-box;
  overflow:hidden
}

body.platform-appearance dialog:is([data-fw-document],[data-ra-document],[data-proto-document],[data-global-summary])[open] {
  display:flex;
  flex-direction:column;
  gap:10px
}

body.platform-appearance dialog:is([data-fw-document],[data-ra-document],[data-proto-document],[data-global-summary])>header, body.platform-appearance dialog:is([data-fw-document],[data-ra-document],[data-proto-document],[data-global-summary])>p {
  flex:none;
  margin:0
}

body.platform-appearance dialog:is([data-fw-document],[data-ra-document],[data-proto-document],[data-global-summary])>:is(.fw-document-layout,.ra-document-layout,.proto-columns,.global-summary-columns) {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  grid-template-rows:minmax(0,1fr);
  gap:18px;
  align-items:stretch;
  flex:1;
  min-height:0;
  height:auto;
  overflow:hidden
}

body.platform-appearance dialog:is([data-fw-document],[data-ra-document],[data-proto-document],[data-global-summary])>:is(.fw-document-layout,.ra-document-layout,.proto-columns,.global-summary-columns)>section {
  min-width:0;
  min-height:0
}

body.platform-appearance dialog:is([data-fw-document],[data-ra-document],[data-proto-document],[data-global-summary])>:is(.fw-document-layout,.ra-document-layout,.proto-columns,.global-summary-columns)>section:first-child {
  overflow:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  padding-right:8px
}

body.platform-appearance dialog:is([data-fw-document],[data-ra-document],[data-proto-document],[data-global-summary])>:is(.fw-document-layout,.ra-document-layout,.proto-columns,.global-summary-columns)>section:last-child {
  display:flex;
  flex-direction:column;
  overflow:hidden
}

body.platform-appearance dialog:is([data-fw-document],[data-ra-document],[data-proto-document],[data-global-summary]) [data-document-preview] {
  display:flex;
  flex-direction:column;
  flex:1;
  min-height:0;
  height:auto;
  overflow:hidden
}

body.platform-appearance dialog:is([data-fw-document],[data-ra-document],[data-proto-document],[data-global-summary]) .pdf-controls {
  flex:none
}

body.platform-appearance dialog:is([data-fw-document],[data-ra-document],[data-proto-document],[data-global-summary]) .pdf-page-layout {
  height:auto;
  max-height:none;
  min-height:0;
  flex:1
}

body.platform-appearance dialog:is([data-fw-document],[data-ra-document],[data-proto-document],[data-global-summary]) .pdf-sheet {
  max-height:none
}

/* Préparation des solutions retenues, intégrée dans la même modale que le cadrage. */
.production-dossier-embedded .selection-synthesis-editor-page {
  display:flex;
  flex-direction:column;
  flex:1;
  min-height:0;
  overflow:hidden;
  width:100%
}

.production-dossier-embedded .selection-synthesis-editor-page>h1, .production-dossier-embedded .selection-synthesis-editor-page>p {
  flex:none
}

.production-dossier-embedded .selection-synthesis-editor-page>.selection-live-layout {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  grid-template-rows:minmax(0,1fr);
  gap:18px;
  align-items:stretch;
  flex:1;
  min-height:0;
  overflow:hidden
}

.production-dossier-embedded .selection-live-layout>.selection-page-document[open] {
  position:static;
  width:100%;
  max-width:none;
  height:auto;
  max-height:none;
  min-width:0;
  min-height:0;
  margin:0;
  padding:8px;
  overflow:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable
}

.production-dossier-embedded .selection-live-layout>.selection-live-viewer {
  position:static;
  height:auto;
  min-height:0;
  margin:0
}

.production-dossier-embedded .selection-live-viewer .pdf-page-layout {
  height:auto;
  max-height:none;
  flex:1;
  min-height:0
}

@media(max-width:650px) {
  body.platform-appearance dialog:is([data-fw-document],[data-ra-document],[data-proto-document],[data-global-summary])>:is(.fw-document-layout,.ra-document-layout,.proto-columns,.global-summary-columns),  .production-dossier-embedded .selection-synthesis-editor-page>.selection-live-layout {
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:minmax(0,1fr) minmax(0,1fr);
    gap:10px
  }

}
