/* =============================================================================
   Active le layout « sidebar » avec body.layout-centered (template Orus actuel).
   Toujours chargé après realm.css ; les règles ne s’appliquent que si
   html[data-orus-sidebar="1"] (script dans template.ftl lit --orus-load-sidebar
   sur :root depuis realm.css).
   ============================================================================= */

html[data-orus-sidebar="1"] body.layout-centered {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 0;
  box-sizing: border-box;
}

html[data-orus-sidebar="1"] body.layout-centered .orus-sidebar-image {
  display: block;
  /* Occupe l’espace restant après le panneau fixe (évite 50/50 si le panneau garde flex:1 du mode carte). */
  flex: 1 1 auto;
  min-width: 0;
  background-image: var(--c-bg-image);
  background-size: cover;
  background-position: center;
  position: relative;
  min-height: 300px;
}

html[data-orus-sidebar="1"] body.layout-centered .orus-sidebar-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--c-sidebar-overlay);
}

html[data-orus-sidebar="1"] body.layout-centered .orus-panel {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  max-width: min(100%, var(--sidebar-w));
  min-height: 100vh;
  margin: 0;
  background: var(--c-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 44px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Pas de seconde « carte » : le panneau droit porte déjà --c-card (évite blanc sur blanc + ombre découpée). */
html[data-orus-sidebar="1"] body.layout-centered .orus-card {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow: visible;
  max-height: none;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

html[data-orus-sidebar="1"] body.layout-centered .orus-card-scroll {
  flex: 0 0 auto;
  overflow: visible;
  min-height: auto;
  padding: 0;
}

@media (max-width: 768px) {
  html[data-orus-sidebar="1"] body.layout-centered .orus-sidebar-image {
    display: none;
  }

  html[data-orus-sidebar="1"] body.layout-centered .orus-panel {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    padding: 32px 24px;
  }

  html[data-orus-sidebar="1"] body.layout-centered .orus-card {
    max-width: 100%;
    border-radius: 0;
    max-height: none;
  }
}

/* login.css (≤480px) remet un radius sur .orus-card ; on reste plat en mode sidebar. */
@media (max-width: 480px) {
  html[data-orus-sidebar="1"] body.layout-centered .orus-card {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    max-height: none;
  }
}
