/* ==========================================================================
   Back-office Ausmeister — habillage (menu, barre du haut, connexion)
   Palette et typographies reprises du site éditorial.
   ========================================================================== */

:root {
  --bo-navy: #1e2d4a;
  --bo-navy-deep: #16233a;
  --bo-navy-soft: #2a3c5e;
  --bo-brass: #a9824f;
  --bo-brass-light: #c29a63;
  --bo-cream: #f7f3ec;
  --bo-border: #e3ddd3;
  --bo-text: #2b2a28;
  --bo-muted: #6c6762;
  --bo-sidebar-width: 248px;
  --bo-display: "Fraunces", Georgia, "Times New Roman", serif;
  --bo-sans: "Hanken Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
}

body.bo {
  margin: 0;
  font-family: var(--bo-sans);
  color: var(--bo-text);
  background: #fbfaf7;
}

body.bo h1, body.bo h2, body.bo h3 {
  font-family: var(--bo-display);
  font-weight: 500;
  color: var(--bo-navy);
}

/* ---- Structure ---------------------------------------------------------- */

.bo-shell {
  display: flex;
  min-height: 100vh;
}

.bo-sidebar {
  flex: 0 0 var(--bo-sidebar-width);
  width: var(--bo-sidebar-width);
  background: var(--bo-navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.bo-content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.bo-main {
  flex: 1 1 auto;
  padding: 28px 32px 40px;
}

/* ---- Marque ------------------------------------------------------------- */

.bo-sidebar a.bo-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.bo-sidebar a.bo-brand:hover { color: #fff; }

.bo-brand img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .15);
}

.bo-brand-name {
  font-family: var(--bo-display);
  font-size: 1.35rem;
  line-height: 1.1;
}

.bo-brand-sub {
  display: block;
  font-family: var(--bo-sans);
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--bo-brass-light);
  margin-top: 3px;
}

/* ---- Recherche ---------------------------------------------------------- */

.bo-search {
  padding: 16px 20px 6px;
}

.bo-search .form-control {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  font-size: .9rem;
}

.bo-search .form-control::placeholder { color: rgba(255, 255, 255, .55); }

.bo-search .form-control:focus {
  background: rgba(255, 255, 255, .12);
  border-color: var(--bo-brass-light);
  box-shadow: 0 0 0 .2rem rgba(169, 130, 79, .25);
  color: #fff;
}

.bo-search .btn {
  background: var(--bo-brass);
  border-color: var(--bo-brass);
  color: #fff;
}

.bo-search .btn:hover { background: var(--bo-brass-light); border-color: var(--bo-brass-light); }

/* ---- Menu --------------------------------------------------------------- */

.bo-nav {
  padding: 8px 12px 24px;
}

.bo-nav-title {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .45);
  padding: 18px 10px 6px;
}

.bo-sidebar .bo-nav a.bo-link {
  display: block;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: 6px;
  border-left: 3px solid transparent;
  color: rgba(255, 255, 255, .82);
  text-decoration: none;
  font-size: .93rem;
  transition: background-color .15s, color .15s;
}

.bo-sidebar .bo-nav a.bo-link:hover {
  background: rgba(255, 255, 255, .07);
  color: #fff;
}

.bo-sidebar .bo-nav a.bo-link.active {
  background: rgba(169, 130, 79, .18);
  border-left-color: var(--bo-brass);
  color: #fff;
  font-weight: 600;
}

/* ---- Barre du haut ------------------------------------------------------ */

.bo-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-height: 60px;
  padding: 0 32px;
  background: #fff;
  border-bottom: 1px solid var(--bo-border);
}

.bo-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .9rem;
}

.bo-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bo-cream);
  border: 1px solid var(--bo-border);
  color: var(--bo-navy);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.bo-topbar a.bo-user-name {
  color: var(--bo-text);
  text-decoration: none;
}

.bo-topbar a.bo-user-name:hover { color: var(--bo-navy); text-decoration: underline; }

.bo-topbar .btn-logout {
  border: 1px solid var(--bo-border);
  background: #fff;
  color: var(--bo-muted);
  font-size: .85rem;
  padding: 5px 12px;
}

.bo-topbar .btn-logout:hover { border-color: var(--bo-navy); color: var(--bo-navy); }

.bo-footer {
  padding: 14px 32px;
  font-size: .8rem;
  color: var(--bo-muted);
  border-top: 1px solid var(--bo-border);
}

.bo-footer a { color: var(--bo-muted); }

/* ---- Écrans d'accès (connexion, mot de passe…) -------------------------- */

body.bo-auth {
  background:
    radial-gradient(circle at 15% 10%, rgba(169, 130, 79, .10), transparent 45%),
    var(--bo-cream);
}

.bo-auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.bo-auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  text-decoration: none;
}

.bo-auth-brand img {
  width: 76px;
  height: 76px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 6px 18px rgba(30, 45, 74, .22);
}

.bo-auth-brand span {
  font-family: var(--bo-display);
  font-size: 1.6rem;
  color: var(--bo-navy);
}

.bo-auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--bo-border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(30, 45, 74, .08);
  padding: 32px 32px 28px;
}

.bo-auth-card h1 {
  font-size: 1.6rem;
  margin: 0 0 4px;
}

.bo-auth-card .bo-auth-lead {
  color: var(--bo-muted);
  font-size: .92rem;
  margin-bottom: 22px;
}

.bo-auth-card .form-floating { margin-bottom: 14px; }

/* Le résumé de validation n'apparaît que s'il contient des erreurs (toutes les pages) */
body.bo .validation-summary-valid { display: none; }
.bo-auth-card .validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }

.bo-auth-card .form-control:focus {
  border-color: var(--bo-brass);
  box-shadow: 0 0 0 .2rem rgba(169, 130, 79, .2);
}

.bo-auth-card .form-check-input:checked {
  background-color: var(--bo-navy);
  border-color: var(--bo-navy);
}

.bo-auth-card .btn-bo {
  background: var(--bo-navy);
  border-color: var(--bo-navy);
  color: #fff;
  font-weight: 600;
  padding: 11px;
}

.bo-auth-card .btn-bo:hover { background: var(--bo-navy-soft); border-color: var(--bo-navy-soft); }

.bo-auth-footer {
  margin-top: 22px;
  font-size: .8rem;
  color: var(--bo-muted);
}

/* ---- Petits écrans : le menu passe au-dessus du contenu ------------------ */

@media (max-width: 767.98px) {
  .bo-shell { flex-direction: column; }

  .bo-sidebar {
    position: static;
    width: 100%;
    flex-basis: auto;
    height: auto;
  }

  .bo-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
  }

  .bo-nav-title { width: 100%; padding-top: 10px; }

  .bo-main { padding: 20px 16px 32px; }

  .bo-topbar { padding: 0 16px; }
}

/* ---- Site éditorial : biens du site ------------------------------------- */

.site-home {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 2fr;
  gap: 20px;
}

.site-slot-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--bo-muted);
  margin-bottom: 8px;
}

.site-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.site-slot { position: relative; }

.site-slot-n {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bo-navy);
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

a.site-card {
  display: block;
  height: 100%;
  background: #fff;
  border: 1px solid var(--bo-border);
  border-radius: 10px;
  overflow: hidden;
  color: var(--bo-text);
  text-decoration: none;
  transition: box-shadow .15s, transform .15s;
}

a.site-card:hover { box-shadow: 0 6px 20px rgba(30, 45, 74, .12); transform: translateY(-1px); color: var(--bo-text); }

.site-card-img {
  aspect-ratio: 4 / 3;
  background: var(--bo-cream) center / cover no-repeat;
}

.site-card-lg .site-card-img { aspect-ratio: 16 / 11; }

.site-card-body { padding: 10px 12px 12px; }

.site-card-badge {
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--bo-brass);
  font-weight: 600;
}

.site-card-title { font-family: var(--bo-display); font-size: 1rem; line-height: 1.25; color: var(--bo-navy); }

.site-card-lg .site-card-title { font-size: 1.25rem; }

.site-card-meta { font-size: .8rem; color: var(--bo-muted); margin-top: 2px; }

.site-card-price { font-weight: 600; margin-top: 6px; }

.site-slot-empty {
  height: 100%;
  min-height: 150px;
  border: 2px dashed var(--bo-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--bo-muted);
  font-size: .85rem;
  padding: 16px;
}

.site-slot-empty.site-card-lg { min-height: 300px; }

.site-thumb {
  width: 72px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bo-cream);
}

.site-thumb-empty { display: flex; align-items: center; justify-content: center; color: var(--bo-muted); }

.demo-list { display: grid; gap: 8px; max-height: 520px; overflow-y: auto; }

.demo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px;
  border: 1px solid var(--bo-border);
  border-radius: 8px;
}

.demo-item img { width: 64px; height: 48px; border-radius: 6px; object-fit: cover; flex: 0 0 auto; background: var(--bo-cream); }

.demo-item-body { flex: 1 1 auto; min-width: 0; }

.photo-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.photo-choice {
  border: 2px solid var(--bo-border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  opacity: .6;
  transition: opacity .15s, border-color .15s;
}

.photo-choice.is-selected { opacity: 1; border-color: var(--bo-brass); }

.photo-choice-img { display: block; position: relative; cursor: pointer; margin: 0; }

.photo-choice-img img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--bo-cream); }

.photo-main-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--bo-navy);
  color: #fff;
  font-size: .7rem;
  padding: 2px 8px;
  border-radius: 999px;
}

.photo-choice-tools { padding: 8px 10px; display: grid; gap: 4px; font-size: .85rem; }

.site-placement { position: sticky; top: 16px; }

@media (max-width: 991.98px) {
  .site-home { grid-template-columns: 1fr; }
  .site-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 575.98px) {
  .site-grid { grid-template-columns: 1fr; }
}

/* ---- Site éditorial : aperçu des actualités ------------------------------ */

.article-preview { font-size: .95rem; line-height: 1.6; max-width: 72ch; }
.article-preview h4 { font-family: var(--bo-display); color: var(--bo-navy); font-size: 1.2rem; margin: 1.2em 0 .4em; }
.article-preview h4:first-child { margin-top: 0; }
.article-preview ul { padding-left: 1.2rem; }
.article-quote { border-left: 3px solid var(--bo-brass); padding: .2em 0 .2em 1em; margin: 1em 0; font-style: italic; color: var(--bo-muted); }

/* ---- En-têtes de tableau triables ---------------------------------------- */

a.th-tri { color: inherit; text-decoration: none; white-space: nowrap; }
a.th-tri:hover { color: var(--bo-navy); text-decoration: underline; }
th:has(> a.th-tri[aria-sort="ascending"]), th:has(> a.th-tri[aria-sort="descending"]) { color: var(--bo-navy); }

.article-image img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; border: 1px solid var(--bo-border); display: block; }
.article-image-empty { aspect-ratio: 16 / 10; border: 2px dashed var(--bo-border); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--bo-muted); font-size: .85rem; }

/* ---- Éditeur visuel des actualités (js/article-editor.js) ---------------- */
.article-editor { border: 1px solid var(--bs-border-color); border-radius: .375rem; background: #fff; }
.article-editor:focus-within { border-color: var(--bo-brass); box-shadow: 0 0 0 .2rem rgba(169, 130, 79, .18); }
.article-editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: .45rem .5rem; border-bottom: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg, #f8f9fa); border-radius: .375rem .375rem 0 0; position: sticky; top: 0; z-index: 2; }
.article-editor-toolbar .btn.active { background: var(--bo-navy); border-color: var(--bo-navy); color: #fff; }
.article-editor-toolbar .sep { width: 1px; align-self: stretch; background: var(--bs-border-color); margin: 0 .15rem; }
.article-editor-area { min-height: 320px; max-width: none; padding: 1rem 1.1rem; outline: none; }
.article-editor-area h2 { font-family: var(--bo-display); color: var(--bo-navy); font-size: 1.25rem; margin: 1.2em 0 .4em; }
.article-editor-area > :first-child { margin-top: 0; }
.article-editor-area p { margin: 0 0 .8em; }
.article-editor-area ul { padding-left: 1.3rem; margin: 0 0 .8em; }
.article-editor-area blockquote { border-left: 3px solid var(--bo-brass); padding: .2em 0 .2em 1em; margin: 1em 0; font-style: italic; color: var(--bo-muted); }
.article-editor textarea { border: 0; border-radius: 0 0 .375rem .375rem; min-height: 320px; }
