/* =========================
MAGIC BASE LAYOUT
========================= */

.layout-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.layout-inner {
  max-width: var(--layout-width, 1420px);
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* =========================
HEADER
========================= */

.header-wrapper {
  flex: 0 0 auto;
}

.site-header {
  height: var(--header-height, auto);
}

/* =========================
BODY STRUCTURE
========================= */

.layout-body {
  flex: 1;
  display: flex;
  gap: 20px;
  padding: 20px;
  box-sizing: border-box;
  min-width: 0;
}

/* =========================
CONTENT AREA
========================= */

.layout-content {
  order: 2;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* MAIN STAGE (MAGIC CANVAS) */

.layout-stage {
  position: relative;
  width: 100%;
  min-height: 200px;
}

/* =========================
SIDEBARS
========================= */

.layout-sidebar {
  flex: 0 0 var(--sidebar-width, 280px);
  min-width: 0;
}

.sidebar-left {
  order: 1;
}

.sidebar-right {
  order: 3;
}

/* =========================
FOOTER
========================= */

.footer-wrapper {
  flex: 0 0 auto;
}

.site-footer {
  height: var(--footer-height, auto);
}

/* =========================
FULL WIDTH TEMPLATE
========================= */

.layout-fullwidth .layout-sidebar {
  display: none;
}

/* =========================
MAGIC PREP (ВАЖНО ДЛЯ БИЛДЕРА)
========================= */

.main-wrapper {
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}

.layout-stage > * {
  max-width: 100%;
}

/* =========================
MAGIC NODE UI
========================= */

.magic-node {
  position: relative;
  cursor: move;
}

/* hover outline */
.magic-node:hover {
  outline: 2px dashed #4af;
  outline-offset: 2px;
}

/* active drag */
.magic-node.magic-dragging {
  outline: 2px solid #0ff;
  z-index: 9999;
}

/* =========================
MAGIC RESIZE UI
========================= */

.magic-node {
  position: relative;
}

.magic-resize {
  position: absolute;
  width: 10px;
  height: 10px;
  right: -5px;
  bottom: -5px;
  background: #0ff;
  cursor: se-resize;
  z-index: 10000;
}

.magic-node.magic-resizing {
  outline: 2px solid #0ff;
}

/* SAVE BUTTON */

.magic-save-btn {
  position: fixed;
  top: 80px;
  right: 20px;
  background: #0ff;
  color: #000;
  padding: 10px 14px;
  font-weight: bold;
  cursor: pointer;
  z-index: 99999;
}

.magic-save-btn.saved {
  background: #4caf50;
  color: #fff;
}
