/* ========== Page Builder Pro — shell, chrome, panels, overlays ========== */

.eb-builder-shell {
  --eb-panel-bg: #ffffff;
  --eb-panel-border: #e2e8f0;
  --eb-surface: #f1f5f9;
  --eb-accent: #6366f1;
  --eb-accent-hover: #4f46e5;
  --eb-accent-soft: #eef2ff;
  --eb-teal: #0d9488;
  --eb-text: #0f172a;
  --eb-muted: #64748b;
  --eb-radius: 12px;
  --eb-radius-sm: 8px;
  --eb-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .04);
  --eb-workspace-h: calc(100vh - 10.5rem);

  display: flex;
  flex-direction: column;
  gap: .55rem;
  min-height: var(--eb-workspace-h);
}

/* ---- Top bar ---- */
.eb-pro-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .55rem .85rem;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-radius: var(--eb-radius);
  color: #f8fafc;
  box-shadow: var(--eb-shadow);
  position: sticky;
  top: 0;
  z-index: 30;
}

.eb-pro-topbar__start,
.eb-pro-topbar__center,
.eb-pro-topbar__end {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.eb-pro-topbar__start { flex: 1 1 200px; min-width: 0; }
.eb-pro-topbar__center { flex: 0 1 auto; justify-content: center; }
.eb-pro-topbar__end { flex: 1 1 280px; justify-content: flex-end; }

.eb-pro-topbar__title {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  min-width: 0;
}

.eb-pro-topbar__title strong {
  font-size: .92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.eb-pro-topbar__meta {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  color: #94a3b8;
}

.eb-pro-topbar__meta.is-dirty { color: #fbbf24; }
.eb-pro-topbar__meta.is-saved { color: #6ee7b7; }

.eb-pro-dot {
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: currentColor;
}

.eb-pro-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid #334155;
  border-radius: var(--eb-radius-sm);
  background: #1e293b;
  color: #e2e8f0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background .15s, border-color .15s;
}

.eb-pro-iconbtn:hover:not(:disabled) { background: #334155; border-color: #475569; }
.eb-pro-iconbtn:disabled { opacity: .4; cursor: not-allowed; }

.eb-pro-group {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem;
  background: rgba(255, 255, 255, .06);
  border-radius: var(--eb-radius-sm);
  border: 1px solid rgba(255, 255, 255, .08);
}

.eb-pro-chip,
.eb-pro-chipbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  border: 1px solid #334155;
  border-radius: 999px;
  background: #1e293b;
  color: #e2e8f0;
  font-size: .74rem;
  font-weight: 600;
  padding: .3rem .65rem;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}

.eb-pro-chipbtn:hover:not(:disabled),
.eb-pro-chipbtn--link:hover {
  background: #334155;
  border-color: #475569;
  color: #fff;
}

.eb-pro-chipbtn:disabled { opacity: .4; cursor: not-allowed; }
.eb-pro-chipbtn.is-active { background: #334155; border-color: #6366f1; color: #fff; }
.eb-pro-chipbtn--danger { border-color: #7f1d1d; color: #fca5a5; }
.eb-pro-chipbtn--danger:hover { background: #7f1d1d; color: #fff; }

.eb-pro-chip.is-warn { background: #78350f; border-color: #92400e; color: #fde68a; }
.eb-pro-chip.is-danger { background: #7f1d1d; border-color: #991b1b; color: #fecaca; }
.eb-pro-chip.is-muted { background: transparent; border-color: #475569; color: #94a3b8; }

.eb-pro-publish {
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  padding: .45rem 1rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(99, 102, 241, .35);
  transition: transform .12s, box-shadow .12s;
}

.eb-pro-publish:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(99, 102, 241, .45); }

.eb-pro-zoom__val {
  font-size: .72rem;
  font-weight: 700;
  min-width: 2.5rem;
  text-align: center;
  color: #cbd5e1;
}

.eb-device-switch--pro {
  display: inline-flex;
  gap: .15rem;
  background: rgba(0, 0, 0, .25);
  border-radius: var(--eb-radius-sm);
  padding: .15rem;
}

.eb-device-switch--pro button {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: .72rem;
  font-weight: 600;
  padding: .35rem .55rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
}

.eb-device-switch--pro button.is-active {
  background: #334155;
  color: #f8fafc;
}

.eb-device-switch--insp {
  display: flex;
  gap: .2rem;
  margin-bottom: .65rem;
}

.eb-device-switch--insp button {
  flex: 1;
  border: 1px solid var(--eb-panel-border);
  background: var(--eb-surface);
  color: var(--eb-muted);
  font-size: .72rem;
  font-weight: 600;
  padding: .35rem;
  border-radius: 6px;
  cursor: pointer;
}

.eb-device-switch--insp button.is-active {
  background: var(--eb-accent-soft);
  border-color: #c7d2fe;
  color: var(--eb-accent);
}

/* ---- Alerts + editor bar ---- */
.eb-builder-alerts {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.eb-builder-alerts .msg-ok,
.eb-builder-alerts .msg-err {
  margin: 0;
  border-radius: var(--eb-radius-sm);
  font-size: .82rem;
  padding: .45rem .75rem;
}

.eb-builder-shell .builder-editor-bar {
  margin-bottom: 0;
  padding: .5rem .75rem;
  border-radius: var(--eb-radius-sm);
  background: var(--eb-panel-bg);
  border: 1px solid var(--eb-panel-border);
  box-shadow: none;
}

.eb-editor-more summary {
  cursor: pointer;
  font-size: .78rem;
  font-weight: 600;
  color: var(--eb-muted);
  list-style: none;
}

.eb-editor-more__menu {
  display: flex;
  gap: .35rem;
  margin-top: .35rem;
}

.eb-tool-sep {
  display: inline-block;
  width: 1px;
  height: 1.25rem;
  background: var(--eb-panel-border);
  margin: 0 .15rem;
}

/* ---- Workspace (3-panel) ---- */
.eb-workspace--pro {
  display: grid;
  grid-template-columns: minmax(260px, 290px) minmax(0, 1fr) minmax(250px, 290px);
  gap: .6rem;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.eb-workspace--pro .eb-panel {
  display: flex;
  flex-direction: column;
  background: var(--eb-panel-bg);
  border: 1px solid var(--eb-panel-border);
  border-radius: var(--eb-radius);
  box-shadow: var(--eb-shadow);
  padding: 0;
  overflow: hidden;
  max-height: var(--eb-workspace-h);
  min-height: 420px;
}

.eb-panel__head {
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  padding: .65rem .85rem;
  border-bottom: 1px solid var(--eb-panel-border);
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}

.eb-panel__head h3 {
  margin: 0;
  font-size: .88rem;
  font-weight: 700;
  color: var(--eb-text);
}

.eb-panel__hint {
  font-size: .68rem;
  color: var(--eb-muted);
  white-space: nowrap;
}

.eb-panel--inspector {
  grid-column: 1;
  grid-row: 1;
}

.eb-panel--canvas {
  grid-column: 2;
  grid-row: 1;
  padding: .65rem;
  min-width: 0;
}

.eb-panel--drawer {
  grid-column: 3;
  grid-row: 1;
}

.eb-panel__scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.eb-panel__scroll > * { flex: 1; min-height: 0; }


.eb-panel--canvas .eb-canvas-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.eb-panel--canvas .eb-canvas {
  flex: 1;
  min-height: 320px;
  overflow: auto;
}

/* ---- Drawer ---- */
.eb-drawer {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.eb-drawer__tabs {
  display: flex;
  flex-shrink: 0;
  gap: 0;
  border-bottom: 1px solid var(--eb-panel-border);
  background: var(--eb-surface);
  padding: .35rem .5rem 0;
}

.eb-drawer__tabs button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--eb-muted);
  font-size: .78rem;
  font-weight: 600;
  padding: .55rem .5rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}

.eb-drawer__tabs button.is-active {
  color: var(--eb-accent);
  border-bottom-color: var(--eb-accent);
  background: var(--eb-panel-bg);
}

.eb-drawer__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: .65rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.eb-drawer__footer-btn {
  width: 100%;
  margin-top: auto;
  border: 1px dashed #c7d2fe;
  background: var(--eb-accent-soft);
  color: var(--eb-accent);
  font-size: .75rem;
  font-weight: 600;
  padding: .5rem;
  border-radius: var(--eb-radius-sm);
  cursor: pointer;
}

.eb-drawer__footer-btn:hover { background: #e0e7ff; }

/* ---- Canvas toolbar ---- */
.eb-canvas-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
  padding-bottom: .45rem;
  border-bottom: 1px solid var(--eb-panel-border);
  margin-bottom: .45rem;
}

.eb-canvas-tools {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  background: var(--eb-surface);
  border: 1px solid var(--eb-panel-border);
  border-radius: var(--eb-radius-sm);
  padding: .2rem;
}

.eb-tool {
  border: none;
  background: transparent;
  color: var(--eb-muted);
  font-size: .72rem;
  font-weight: 600;
  padding: .3rem .5rem;
  border-radius: 6px;
  cursor: pointer;
}

.eb-tool.is-active,
.eb-tool:hover {
  background: var(--eb-panel-bg);
  color: var(--eb-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}

.eb-breadcrumb {
  display: flex;
  align-items: center;
  gap: .15rem;
  flex-wrap: wrap;
  min-width: 0;
}

.eb-breadcrumb__item {
  border: none;
  background: transparent;
  font-size: .72rem;
  color: var(--eb-muted);
  padding: .2rem .35rem;
  border-radius: 4px;
  cursor: pointer;
}

.eb-breadcrumb__item.is-active { color: var(--eb-teal); font-weight: 700; }
.eb-breadcrumb__item.is-muted { cursor: default; }
.eb-breadcrumb__sep { color: #cbd5e1; font-size: .7rem; }

.eb-canvas-toolbar__right {
  display: flex;
  align-items: center;
  gap: .35rem;
}

/* Canvas grid overlay */
.eb-canvas.is-grid-on {
  background-color: #f8fafc;
  background-image:
    linear-gradient(rgba(99, 102, 241, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, .08) 1px, transparent 1px);
  background-size: 20px 20px;
}

.eb-canvas.is-tool-pan { cursor: grab; }
.eb-canvas.is-tool-pan:active { cursor: grabbing; }

.eb-canvas-grid {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 1;
}

.eb-resize-layer,
.eb-snap-guides {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 15;
}

.eb-resize-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--eb-accent);
  border: 1px solid #fff;
  border-radius: 2px;
  z-index: 16;
}

.eb-snap-guide {
  position: absolute;
  background: #f472b6;
  z-index: 14;
}

.eb-snap-guide--h { height: 1px; left: 0; right: 0; }
.eb-snap-guide--v { width: 1px; top: 0; bottom: 0; }

.eb-rte-toolbar {
  display: flex;
  gap: .15rem;
  background: #1e293b;
  border-radius: 6px;
  padding: .25rem;
  box-shadow: var(--eb-shadow);
}

.eb-insert-zone {
  border: 2px dashed var(--eb-accent);
  background: var(--eb-accent-soft);
  border-radius: var(--eb-radius-sm);
  min-height: 2rem;
}

.eb-quickbar__btn--ai {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 4px;
}

/* ---- Navigator pro ---- */
.eb-nav--pro { font-size: .78rem; }

.eb-nav--pro .eb-nav__row {
  display: flex;
  align-items: center;
  gap: .15rem;
  padding: .15rem .2rem;
  border-radius: 6px;
  transition: background .12s;
}

.eb-nav--pro .eb-nav__row.is-active,
.eb-nav--pro .eb-nav__row:hover { background: #f1f5f9; }

.eb-nav__indent {
  width: calc(.75rem * var(--eb-nav-depth, 0));
  flex-shrink: 0;
  display: inline-block;
}

.eb-nav__glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.2rem;
  font-size: .62rem;
  font-weight: 800;
  color: var(--eb-teal);
  background: #ecfdf5;
  border-radius: 4px;
  margin-inline-end: .25rem;
}

.eb-nav__badge {
  font-size: .58rem;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border-radius: 3px;
  padding: 0 .25rem;
  margin-inline-start: .2rem;
}

.eb-nav__row.is-locked { opacity: .55; }
.eb-nav__row.is-drop-before { box-shadow: inset 0 2px 0 var(--eb-accent); }
.eb-nav__row.is-drop-after { box-shadow: inset 0 -2px 0 var(--eb-accent); }
.eb-nav__row.is-drop-inside { background: var(--eb-accent-soft); }
.eb-nav__row.is-drop-invalid { box-shadow: inset 0 0 0 2px #ef4444; }

/* ---- Palette extras ---- */
.eb-palette__link {
  font-size: .72rem;
  color: var(--eb-accent);
  text-decoration: none;
  font-weight: 600;
}

.eb-palette__count,
.eb-palette__kind {
  font-size: .65rem;
  font-weight: 700;
  color: var(--eb-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin: .5rem 0 .25rem;
}

.eb-palette__elements-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .35rem;
}

/* ---- Inspector pro ---- */
.eb-inspector-pro {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: .65rem .85rem;
  background: var(--eb-panel-bg);
}

.eb-inspector__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--eb-muted);
  gap: .5rem;
}

.eb-inspector__empty-ico {
  font-size: 2rem;
  color: #cbd5e1;
  line-height: 1;
}

.eb-inspector__type {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .65rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--eb-panel-border);
}

.eb-inspector__type-name {
  font-size: .88rem;
  font-weight: 700;
  color: var(--eb-text);
}

.eb-inspector__type-key {
  font-size: .68rem;
  font-weight: 600;
  color: var(--eb-teal);
  background: #ecfdf5;
  padding: .15rem .45rem;
  border-radius: 999px;
}

.eb-inspector-pro .eb-inspector__tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--eb-panel-bg);
  margin: -.65rem -.85rem .75rem;
  padding: .65rem .85rem .35rem;
  border-bottom: 1px solid var(--eb-panel-border);
}

.eb-inspector-pro .eb-inspector__tabs button {
  flex: 1;
  border: none;
  background: var(--eb-surface);
  color: var(--eb-muted);
  font-size: .74rem;
  font-weight: 600;
  padding: .45rem .5rem;
  border-radius: var(--eb-radius-sm);
  cursor: pointer;
}

.eb-inspector-pro .eb-inspector__tabs button.is-active {
  background: var(--eb-accent);
  color: #fff;
}

.eb-prop-host { display: flex; flex-direction: column; gap: .5rem; }

.eb-prop-group {
  border: 1px solid var(--eb-panel-border);
  border-radius: var(--eb-radius-sm);
  overflow: hidden;
  background: #fafbfc;
}

.eb-prop-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .45rem .65rem;
  font-size: .74rem;
  font-weight: 700;
  color: var(--eb-text);
  cursor: pointer;
  background: #fff;
  border-bottom: 1px solid transparent;
}

.eb-style-group--open .eb-prop-group__head,
.eb-prop-group.is-open .eb-prop-group__head {
  border-bottom-color: var(--eb-panel-border);
}

.eb-prop-group__body {
  padding: .55rem .65rem .65rem;
  display: grid;
  gap: .5rem;
}

.eb-prop-field {
  display: grid;
  gap: .25rem;
}

.eb-prop-field__label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--eb-muted);
}

.eb-prop-field__control { min-width: 0; }

.eb-prop-input {
  width: 100%;
  border: 1px solid var(--eb-panel-border);
  border-radius: 6px;
  padding: .4rem .55rem;
  font-size: .82rem;
  background: #fff;
}

.eb-insp-search {
  position: relative;
  margin-bottom: .65rem;
}

.eb-insp-search__input {
  width: 100%;
  border: 1px solid var(--eb-panel-border);
  border-radius: 999px;
  padding: .45rem .75rem .45rem 2rem;
  font-size: .8rem;
  background: var(--eb-surface);
}

.eb-insp-search__clear {
  position: absolute;
  inset-inline-start: .55rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--eb-muted);
  cursor: pointer;
  font-size: .85rem;
}

/* ---- Revisions ---- */
.eb-revisions {
  flex-shrink: 0;
  border-top: 1px solid var(--eb-panel-border);
  margin-top: auto;
}

.eb-revisions summary {
  cursor: pointer;
  font-size: .74rem;
  font-weight: 600;
  color: var(--eb-muted);
  padding: .55rem .85rem;
  list-style: none;
}

.eb-revisions__body {
  padding: 0 .85rem .65rem;
  max-height: 160px;
  overflow: auto;
}

/* ---- AI modal polish ---- */
.eb-ai-backdrop {
  backdrop-filter: blur(4px);
  background: rgba(15, 23, 42, .45) !important;
}

.eb-ai-modal {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 720px);
  overflow: hidden;
}

.eb-ai-modal__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 .25rem;
}

.eb-ai-modal__layout {
  flex: 1;
  min-height: 0;
}

/* ---- Admin full-bleed builder ---- */
.admin-content--builder-edit {
  padding: .35rem .5rem .5rem !important;
  max-width: none;
  overflow: hidden;
}

.admin-content--builder-edit .admin-pagehead {
  display: none;
}

/* ---- Responsive ---- */
@media (max-width: 1280px) {
  .eb-workspace--pro {
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr) minmax(220px, 260px);
  }

  .eb-pro-topbar__title strong { max-width: 140px; }
}

@media (max-width: 1024px) {
  .eb-workspace--pro {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
  }

  .eb-panel--canvas {
    grid-column: 1 / -1;
    grid-row: 1;
    max-height: 55vh;
  }

  .eb-panel--inspector { grid-column: 1; grid-row: 2; }
  .eb-panel--drawer { grid-column: 2; grid-row: 2; }

  .eb-pro-topbar__center { order: 3; width: 100%; justify-content: flex-start; }
}

@media (max-width: 720px) {
  .eb-workspace--pro {
    grid-template-columns: 1fr;
  }

  .eb-panel--inspector,
  .eb-panel--drawer,
  .eb-panel--canvas {
    grid-column: 1;
    max-height: none;
  }

  .eb-ai-modal__layout {
    grid-template-columns: 1fr !important;
  }

  .eb-ai-history { max-height: 180px; }
}
