:root {
    --primary: #2F1ED6;
    --bg: #ffffff;
    --surface: #f8f9fb;
    --muted: #777;
    --radius: 10px;
    --shadow: 0 2px 6px rgba(0,0,0,0.05);
    font-family: Roboto, sans-serif;
}

.designer-studio { min-height:100vh; background:#fafafa; }
.app-bar {
  height:60px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 24px;
  background: rgba(47,30,214,0.05);
  border-bottom:1px solid #e5e5ee;
  box-shadow:0 1px 4px rgba(0,0,0,0.05);
  position:sticky; top:0; z-index:100;
}
.breadcrumb { display:flex; align-items:center; gap:6px; font-size:14px; color:#444; }
.breadcrumb .divider { color:#999; }
.app-actions { display:flex; gap:8px; align-items:center; }

/*.btn { display:inline-flex; align-items:center; gap:8px; border-radius:999px; padding:8px 12px; border:none; cursor:pointer; font-weight:600; }
.btn.primary { background:var(--primary); color:#fff; box-shadow:0 6px 14px rgba(47,30,214,0.18); }
.btn.subtle { background:#f3f4fb; color:var(--primary); }
*/
.studio-body {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  height: calc(100vh - 60px);
  gap: 20px;
  padding: 20px;
  box-sizing: border-box;
  overflow: hidden; /* prevent page scroll; only center column scrolls */
}

.studio-sidebar {
  width: 260px;
  background: var(--bg);
  border-right: 1px solid #eee;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow);
  border-radius: 8px;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}
/*.sidebar-nav h4 { font-weight:600; margin:0 0 6px; }
.nav-item { display:flex; align-items:center; gap:8px; padding:8px 10px; border-radius:6px; color:#333; background:transparent; border:none; text-align:left; cursor:pointer; }
.nav-item:hover { background:#f4f4ff; color:var(--primary); }
.nav-item.is-active { background:#ececff; color:var(--primary); }
*/
.sidebar-toolbox { margin-top:8px; border-top:1px solid #eee; padding-top:12px; }
.toolbox-item { display:flex; align-items:center; gap:8px; padding:6px 8px; margin-bottom:6px; border-radius:8px; background:#f8f8ff; cursor:grab; transition:background .15s; }
.toolbox-item:hover { background:#ececff; }

.studio-canvas-area {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow: hidden; /* block outer scrolling */
}

.page-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 8px;
}

.page-controls__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid #d3d4de;
  border-radius: 8px;
  background: #fff;
  color: #333;
  cursor: pointer;
  transition: background 0.15s ease;
}

.page-controls__button:hover:not([disabled]) {
  background: #ececff;
  color: var(--primary);
}

.page-controls__button[disabled] {
  opacity: 0.5;
  cursor: default;
}

.page-controls__label {
  font-weight: 600;
  color: #333;
  margin-right: auto;
}

.canvas-header { width:100%; display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; padding:12px 20px; box-sizing:border-box; }

/* Scrollable inner container */
.canvas-scroll-container {
  flex: 1;
  overflow: auto; /* scroll only inside this container */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.canvas-wrapper {
  position: relative;
  background: #fff;
  border-radius: 12px; /* ensures top + bottom rounded corners */
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden; /* clip inner grid to border radius */
}

/* Dotted grid background */
.canvas-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.16) 1px, transparent 1px);
  background-size: 8px 8px;
  background-position: 0 0;
  background-color: transparent;
  border-radius: inherit;
  z-index: 0;
}
.workspace-scroll {
  position: relative;
  flex: 1;
  overflow: auto;
  background: var(--surface);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100%;
}

.workspace-zoom-wrapper {
  display: inline-block;
  transform-origin: top left;
  transition: transform 0.15s ease-out;
  background: transparent;
  margin: auto 0; /* no forced offset */
}

/* center container inside the scroll viewport */
.workspace-center {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 40px;
}

/* alias the zoom wrapper name used by some templates */
.zoom-wrapper {
  display: inline-block;
  transform-origin: top left;
  transition: transform 0.15s ease-out;
}

.canvas-surface {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.studio-properties { width:340px; background:var(--bg); border-left:1px solid #ddd; display:flex; flex-direction:column; overflow-y:auto; padding-top:0; padding-bottom:10px; }
.studio-properties .placeholder { text-align:center; color:var(--muted); }

/* Property panel styles */
.property-panel { display:flex; flex-direction:column; height:100%; width:100%; }
.property-header { display:flex; justify-content:space-between; align-items:center; background:var(--primary); color:#fff; padding:10px; border-radius:8px; margin-bottom:12px; }
.property-body { flex:1; overflow-y:auto; padding-right:6px; }
.prop-group { display:flex; flex-direction:column; margin-bottom:10px; }
.prop-group-inline { display:flex; gap:8px; margin-bottom:10px; }
.prop-input { border:1px solid #ddd; border-radius:6px; padding:6px 8px; }
.prop-input.short { width:120px; }
.prop-btn { border:1px solid #ddd; border-radius:6px; padding:6px 8px; background:#f8f8ff; cursor:pointer; }
.prop-btn:hover { background:#ececff; color:var(--primary); }
.prop-checkbox-group { display:flex; gap:12px; flex-wrap:wrap; }
.prop-checkbox-group label { display:inline-flex; gap:6px; align-items:center; font-size:13px; color:#333; }

/* Zoom Controls */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-left: auto;
}
.zoom-btn {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 16px;
  cursor: pointer;
  line-height: 24px;
}
.zoom-btn:hover {
  border-color: #2F1ED6;
  background: #f6f6ff;
}
.zoom-btn.reset {
  width: auto;
  padding: 0 10px;
}
.zoom-display {
  width: 48px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

/* Text style buttons */
.textstyle-buttons {
  display: flex;
  gap: 6px;
}
.property-placeholder { display:flex; flex-direction:column; align-items:center; justify-content:center; color:#888; height:100%; text-align:center; }
.property-placeholder .material-symbols-outlined { font-size:48px; margin-bottom:8px; }

/* PropertyGrid styles (Visual Studio-like) */
.propertygrid-container { display:flex; flex-direction:column; padding:8px 0 0 0; margin-top:0; }
.propertygrid-header { background:var(--primary); color:#fff; padding:10px 16px; font-size:15px; font-weight:600; border-bottom:1px solid #ccc; position:sticky; top:0; z-index:10; }
.property-category { border-top:1px solid #eee; padding-bottom:4px; }
.category-title { padding:6px 12px; background:#f7f7fb; font-weight:500; color:#444; cursor:pointer; -webkit-user-select:none; user-select:none; }
.category-title:hover { background:#f0f0ff; }
.property-row { display:grid; grid-template-columns:130px 1fr; align-items:center; padding:4px 10px; font-size:13px; border-top:1px solid #fafafa; }
.property-row:hover { background:#fafaff; }
.prop-name { color:#555; white-space:nowrap; }
.prop-editor { width:100%; border:1px solid #ccc; border-radius:4px; font-size:13px; padding:2px 4px; background:#fff; }
.prop-editor.short { width:70px; }
.prop-editor.color { height:28px; padding:0; border:none; background:transparent; }

.table-meta { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.table-meta__value { font-weight:600; color:#2f1ed6; font-size:13px; }
.table-meta__actions { display:flex; gap:4px; }
.table-editor-list { display:flex; flex-direction:column; gap:10px; padding:8px 12px 12px 16px; }
.table-editor-item { border:1px solid #e2e4ff; border-radius:8px; padding:10px 12px; background:#ffffff; box-shadow:0 1px 2px rgba(23, 26, 70, 0.05); display:flex; flex-direction:column; gap:8px; }
.table-editor-item__header { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.table-editor-title { font-weight:600; color:#2f2b63; font-size:13px; }
.table-editor-actions { display:flex; gap:4px; }
.table-editor-row { display:flex; flex-wrap:wrap; gap:10px; }
.table-editor-field { display:flex; flex-direction:row; align-items:center; gap:8px; font-size:12px; color:#4f5375; min-width:220px; flex:1 1 240px; }
.table-editor-field label { font-weight:600; color:#3b3f5c; min-width:110px; margin:0; }
.table-editor-field .prop-editor,
.table-editor-field select,
.table-editor-field input,
.table-editor-field textarea { font-size:13px; flex:1 1 auto; }
.table-editor-field input[type="color"] { flex:0 0 auto; width:46px; min-width:46px; height:28px; padding:0; }
.table-checkbox { display:flex; align-items:center; gap:6px; font-size:12px; color:#4b4f6a; }
.table-checkbox input[type="checkbox"] { width:16px; height:16px; }
.table-editor-cells { display:grid; grid-template-columns:repeat(auto-fit, minmax(140px, 1fr)); gap:10px; }
.table-editor-cell { display:flex; flex-direction:column; gap:6px; padding:8px; background:#f8f9ff; border:1px dashed #d9dcff; border-radius:6px; }
.table-editor-cell__header { font-weight:600; color:#30345c; font-size:12px; }
.table-style-row { display:flex; flex-wrap:wrap; gap:12px; padding:6px 12px; }
.table-style-flags { display:flex; flex-wrap:wrap; gap:12px; padding:8px 12px; }
.table-style-flags label { display:flex; align-items:center; gap:6px; font-size:12px; color:#4b4f6a; }

.canvas-elements-surface { position:relative; width:100%; height:100%; }
.canvas-element { position: absolute; box-sizing:border-box; border:1px solid #ddd; border-radius:6px; background:#fff; overflow:visible; }
.canvas-element.selected { border-color:var(--primary); box-shadow:0 0 0 2px rgba(47,30,214,0.08); z-index:5; }

/* resize handles (kept small but hit-friendly) */
.resize-handle { width:8px; height:8px; border-radius:50%; background:var(--primary); position:absolute; z-index:100; box-shadow:0 0 0 2px #fff; }
.handle-nw, .resize-handle.nw { top:-4px; left:-4px; cursor:nwse-resize; }
.handle-ne, .resize-handle.ne { top:-4px; right:-4px; cursor:nesw-resize; }
.handle-sw, .resize-handle.sw { bottom:-4px; left:-4px; cursor:nesw-resize; }
.handle-se, .resize-handle.se { bottom:-4px; right:-4px; cursor:nwse-resize; }
.handle-n, .resize-handle.n { top:-4px; left:50%; transform:translateX(-50%); cursor:ns-resize; }
.handle-s, .resize-handle.s { bottom:-4px; left:50%; transform:translateX(-50%); cursor:ns-resize; }
.handle-e, .resize-handle.e { right:-4px; top:50%; transform:translateY(-50%); cursor:ew-resize; }
.handle-w, .resize-handle.w { left:-4px; top:50%; transform:translateY(-50%); cursor:ew-resize; }

.drag-handle-center { width:12px; height:12px; border-radius:50%; background:#9EA5F8; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); cursor:move; z-index:99; }

.fields-tree-panel {
  margin: 12px 0 0 0;
  padding: 12px 14px;
  background: #f7f7ff;
  border: 1px solid #e3e3ff;
  border-radius: 10px;
  max-height: 260px;
  overflow-y: auto;
}

.fields-tree {
  list-style: none;
  padding-left: 0;
  margin: 0;
  font-size: 13px;
  color: #373a56;
}

.fields-tree__node {
  margin-bottom: 4px;
  line-height: 1.4;
  padding-left: 0;
}

.fields-tree__row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fields-tree__node--clear {
  margin-top: 10px;
}

.fields-tree__children {
  list-style: none;
  padding-left: 16px;
  margin: 4px 0 0 0;
}

.fields-tree-clear {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin-top: 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #5b5fe5;
  font-weight: 600;
  cursor: pointer;
}

.fields-tree-clear:hover {
  background: rgba(91, 95, 229, 0.08);
}

.fields-tree__toggle {
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: #5b5fe5;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fields-tree__toggle--placeholder {
  width: 18px;
  height: 18px;
  display: inline-block;
}

.fields-tree__label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  border: none;
  background: transparent;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  color: #373a56;
  font-size: 13px;
}

.fields-tree__label:hover {
  background: rgba(91, 95, 229, 0.08);
}

.fields-tree__label--selected {
  background: #d8daf8;
  color: #0f123a;
  font-weight: 600;
}

.studio-sidebar::-webkit-scrollbar,
.canvas-scroll-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.studio-sidebar::-webkit-scrollbar-track,
.canvas-scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

.studio-sidebar::-webkit-scrollbar-thumb,
.canvas-scroll-container::-webkit-scrollbar-thumb {
  background-color: rgba(122, 125, 168, 0.6);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

