/* === BASE admin.css adapté === */
* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.4;
  background: #f6f7f8;
  color: #222;
}

/* Layout main */
.rt-main {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr;
  gap: 16px;
  height: 100vh;
  padding: 16px;
}
@media (max-width: 1000px) { .rt-main { grid-template-columns: 1fr; height: auto; } }

/* Panel gauche */
.rt-settings {
  background: #fff; border: 1px solid #e6e8ea; border-radius: 8px;
  padding: 16px; overflow-y: auto; display: flex; flex-direction: column; max-height: 100vh;
}

/* Accordion */
.rt-accordion { border: 1px solid #e6e8ea; border-radius: 8px; margin-bottom: 12px; background: #fff; }
.rt-accordion__header { padding: 10px 12px; font-weight: 700; cursor: pointer; user-select: none; }
.rt-accordion__header:focus { outline: 2px solid #005177; outline-offset: 2px; }
.rt-accordion__content { padding: 10px 12px 14px; border-top: 1px solid #e6e8ea; }

/* Listes Google Drive */
#drive-links-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
#drive-links-list li {
  border: 1px solid #cfd6dc; padding: 8px 10px; border-radius: 6px; background: #fafafa;
  display: flex; justify-content: space-between; align-items: center; font-size: 14px;
}
#drive-links-list li button {
  background: transparent; border: none; color: #d9534f; font-weight: 700; cursor: pointer; font-size: 18px; line-height: 1;
}

/* Blocs */
#blocks-list { display: grid; gap: 8px; }
.block-item {
  cursor: pointer; padding: 10px; border-radius: 6px; background: #f7f9fb; border: 1px solid #cfd6dc;
  font-weight: 600; transition: background .2s ease; text-align: center;
}
.block-item:hover, .block-item:focus { background: #eef3f7; outline: none; }
.block-item:focus-visible { outline: 2px solid #005177; outline-offset: 2px; }

/* Actions buttons */
#template-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.rt-btn {
  appearance: none; border: 1px solid #cfd6dc; background: #f7f9fb; color: #222;
  padding: 8px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; transition: background .2s ease;
}
.rt-btn:hover, .rt-btn:focus { background: #eef3f7; outline: none; outline-offset: 2px; }
.rt-btn:focus-visible { outline: 2px solid #005177; outline-offset: 2px; }
.rt-btn--primary { background: #0073aa; border-color: #006695; color: #fff; }
.rt-btn--primary:hover, .rt-btn--primary:focus { background: #005f8a; }
.rt-btn--danger { background: #d9534f; border-color: #b52b27; color: #fff; }
.rt-btn--danger:hover, .rt-btn--danger:focus { background: #b52b27; }
.rt-btn--ghost { background: transparent; color: inherit; }
.rt-btn--icon  { padding: 4px 8px; line-height: 1; }

/* Preview panel */
.rt-preview {
  background: #fff; border: 1px solid #e6e8ea; border-radius: 8px; padding: 16px;
  display: flex; flex-direction: column; height: 100vh; overflow-y: auto;
}
@media (max-width: 1000px) { .rt-preview { height: auto; } }

/* Toolbar responsive */
.rt-preview__toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }

/* Wrapper qui simule le viewport */
.rt-preview__wrapper { width: 1200px; max-width: 100%; margin: 0 auto; display: block; }
.rt-preview--mobile  { width: 390px; }
.rt-preview--tablet  { width: 768px; }
.rt-preview--desktop { width: 1200px; }
.rt-preview--full    { width: 100%; }

.rt-preview__frame {
  border: 1px solid #e6e8ea; border-radius: 8px; background: #fff; padding: 12px;
  min-height: 350px; overflow: auto; white-space: normal; font-size: 14px; color: #222;
}

/* === Blocs redimensionnables === */
.preview-block { padding: 8px; margin: 8px 0; border: 1px dashed transparent; }
.preview-block.dragging { opacity: .75; }
.preview-block:focus-within { outline: 2px solid #005177; outline-offset: 2px; }

.resizable {
  width: fit-content;   /* pour permettre le resize horizontal réel */
  max-width: 100%;
  resize: both;
  overflow: auto;
  min-width: 120px;
  min-height: 48px;
  position: relative;   /* nécessaire pour les actions absolues */
  border: 1px dashed transparent;
}
.resizable::after {
  content: "↘"; position: absolute; right: 4px; bottom: 0; font-size: 16px; line-height: 1;
  opacity: .55; pointer-events: none; text-shadow: 0 0 1px rgba(0,0,0,.25);
}

/* Poignée DnD */
.handle {
  cursor: move; user-select: none; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px; margin-right: 6px;
}

/* Groupe d’alignement + actions grille */
.align-actions { display: inline-flex; gap: 6px; align-items: center; margin: 4px 0 8px; }
.grid-actions  { display: inline-flex; gap: 6px; align-items: center; margin: 4px 6px 8px; }

/* Bouton supprimer discret */
.block-remove {
  position: absolute; top: 4px; right: 4px;
  border: none; background: #fff; border-radius: 6px;
  box-shadow: 0 0 0 1px #e6e8ea;
  font-weight: 700; width: 24px; height: 24px; line-height: 1;
  opacity: .25; cursor: pointer;
}
.preview-block:hover .block-remove,
.block-remove:focus-visible { opacity: .9; outline: 2px solid #005177; outline-offset: 2px; }

/* Médias ne dépassent pas */
.preview-block img,
.preview-block video,
.preview-block canvas,
.preview-block iframe { max-width: 100%; height: auto; }

/* Grilles */
.rt-grid { display: grid; gap: 8px; }
.rt-grid--2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.rt-grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }

/* Listes / inputs */
#templates-list { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow-y: auto; }
#templates-list li {
  padding: 8px 10px; border: 1px solid #cfd6dc; border-radius: 6px; margin-bottom: 6px;
  cursor: pointer; background: #fafafa; font-weight: 600; transition: background .2s ease;
}
#templates-list li:hover, #templates-list li:focus { background: #eef3f7; outline: none; }
.rt-input { width: 100%; padding: 8px 10px; border: 1px solid #cfd6dc; border-radius: 6px; background: #fff; font-size: 14px; }

/* Responsive tweaks */
@media (max-width: 600px) {
  .rt-main { grid-template-columns: 1fr; }
  .rt-settings, .rt-preview { max-height: none; }
}
/* ============================================================================   Correctifs r-theme1 — Prévisualisation plein largeur + Responsivité   ========================================================================== *//* Les blocs remplissent toujours le cadre de preview */#preview-area {  display: block;  width: 100%;  box-sizing: border-box;}#preview-area > .preview-block {  display: block;  width: 100%;  max-width: 100%;  box-sizing: border-box;}#preview-area .block-render {  width: 100%;  max-width: 100%;  box-sizing: border-box;}/* Médias responsives */#preview-area img,#preview-area video,#preview-area canvas {  max-width: 100%;  height: auto;}/* Largeurs des cadres simulés (mobile, tablette, desktop, auto) */.rt-preview__wrapper.rt-preview--mobile  .rt-preview__frame { width: min(100%, 390px);  }.rt-preview__wrapper.rt-preview--tablet  .rt-preview__frame { width: min(100%, 768px);  }.rt-preview__wrapper.rt-preview--desktop .rt-preview__frame { width: min(100%, 1280px); }.rt-preview__wrapper.rt-preview--full    .rt-preview__frame { width: 100%; }/* Sécurité : le cadre reste centré et ne déborde jamais */.rt-preview__frame {  margin: 0 auto;  box-sizing: border-box;  max-width: 100%;}
/* === r-theme: layout deux volets + splitter (pages.html) === */
:root { --rt-left-pane-w: 50%; }

.rt-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.rt-pane-left {
  flex: 0 0 var(--rt-left-pane-w);
  min-width: 280px;
  max-width: 75vw;
  overflow: auto;
  padding: 1rem;
}

.rt-splitter {
  flex: 0 0 6px;
  cursor: col-resize;
  background: #d9d9d9;
}

.rt-splitter:focus {
  outline: 2px solid #4a90e2;
  outline-offset: -2px;
}

.rt-pane-right {
  flex: 1 1 auto;
  overflow: hidden;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.rt-preview__viewport {
  flex: 1;
  border: 1px solid #ccc;
  background: #fff;
}

/* Mode empilé (mobile) */
@media (max-width: 960px) {
  .rt-layout { flex-direction: column; }
  .rt-pane-left { max-width: none; flex: 0 0 auto; }
  .rt-splitter  { height: 6px; width: 100%; cursor: row-resize; }
  .rt-pane-right{ flex: 1 1 auto; }
}
