/* =========================================================
   RESET
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #f9fafb;
  color: #111827;
}

/* =========================================================
   VISIBILITÉ LOCAL / WEB
   ========================================================= */
.local-only { display: none !important; }
body[data-local="true"] .local-only { display: block !important; }

/* =========================================================
   LAYOUT GLOBAL
   ========================================================= */
.app {
  display: flex;
  height: 100vh;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar {
  width: 260px;
  border-right: 1px solid #e5e7eb;
  background: #ffffff;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #6b7280;
  background: #fafafa;
}

.sidebar-title {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
  padding: 4px 6px;
}

.sidebar-new-btn {
  display: flex;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  font-size: 14px;
  cursor: pointer;
}
.sidebar-new-btn:hover { background: #e5e7eb; }

/* =========================================================
   TREE VIEW
   ========================================================= */
.tree-item {
  display: flex;
  align-items: center;
  padding: 6px 6px;
  border-radius: 8px;
  cursor: pointer;
  gap: 4px;
  transition: background 0.15s;
}

.tree-item:hover {
  background: #f3f4f6;
}

.tree-item.active {
  background: #e5e7eb;
}

.tree-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-toggle {
  width: 16px;
  opacity: 0.75;
  transition: transform 0.2s, opacity 0.2s;
}
.tree-toggle:hover {
  opacity: 1;
}

/* =========================================================
   MAIN
   ========================================================= */
.main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: #f9fafb;
}

/* Placeholder */
.placeholder {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #6b7280;
}
.placeholder-icon {
  font-size: 28px;
}

/* =========================================================
   EDITOR
   ========================================================= */
.editor {
  min-height: 260px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 14px;
  font-size: 15px;
  background: #ffffff;
  line-height: 1.6;
}

.editor-readonly {
  pointer-events: none;
  background: #ffffff;
}

.editor-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.editor-toolbar button {
  padding: 4px 8px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
}
.editor-toolbar button:hover {
  background: #e5e7eb;
}

/* =========================================================
   GALLERY
   ========================================================= */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.gallery-item {
  position: relative;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.img-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  padding: 3px 7px;
  border-radius: 999px;
  cursor: pointer;
}

/* =========================================================
   LIGHTBOX
   ========================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: none;
  z-index: 9990;
}

.lightbox.show { display: block; }

.lightbox-img {
  max-width: 90%;
  max-height: 90%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#lightboxClose,
#lightboxPrev,
#lightboxNext {
  position: fixed;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 38px;
  z-index: 3;
}

#lightboxClose { top: 20px; right: 25px; }
#lightboxPrev { top: 50%; left: 25px; transform: translateY(-50%); }
#lightboxNext { top: 50%; right: 25px; transform: translateY(-50%); }

/* =========================================================
   CONTEXT MENU
   ========================================================= */
.context-menu {
  position: fixed;
  background: #fff;
  border-radius: 12px;
  padding: 6px 0;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 40px rgba(15,23,42,0.18);
  display: none;
  min-width: 200px;
  z-index: 10000;
}
.ctx-item {
  padding: 8px 12px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
}
.ctx-item:hover { background: #f3f4f6; }
.ctx-danger { color: #b91c1c; }
.ctx-danger:hover { background: #fee2e2; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    overflow-x: auto;
    display: flex;
    flex-direction: row;
  }
  .main { padding: 14px; }
}

/* --- Bandeau image pleine largeur --- */
#siteBanner {
    width: 100%;
    height: 250px;
    overflow: hidden;       /* Cache ce qui dépasse */
}

#siteBanner img {
    width: 100%;            /* Occupe toute la largeur */
    height: 100%;           /* Occupe toute la hauteur */
    object-fit: cover;      /* Remplissage + recadrage intelligent */
    object-position: center;/* Centrée */
    display: block;
}

