/* Visual Page Block Editor Styles */

.editor-workspace {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    background: #090d16;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    animation: fadeIn 0.3s ease-out;
}

.editor-header {
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    color: #f8fafc;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    color: #f8fafc;
}

.btn-back-arrow {
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    color: #fff;
    transition: background-color 0.2s;
    flex-shrink: 0;
}
.btn-back-arrow:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-page-settings-dots {
    position: relative;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background-color 0.2s, color 0.2s;
    margin-left: 8px;
}
.btn-page-settings-dots:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

#editor-page-title {
    color: #f8fafc !important;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}

.settings-build-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 8px 12px;
    color: #f1f5f9;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
    text-align: left;
}
.btn-page-settings-dots:hover .settings-build-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(2px);
}

/* Customizable Layout Structure */
.editor-layout-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - 60px);
}

.editor-layout-middle {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar Styling */
.editor-sidebar {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    overflow: auto;
    z-index: 50;
}

.sidebar-vertical {
    flex-direction: column;
    width: 320px;
    flex: 0 0 320px;
    height: 100%;
    min-width: 200px;
    max-width: 800px;
}

/* Sidebar Resizer Handles */
.sidebar-resizer {
    background: rgba(255, 255, 255, 0.04);
    position: relative;
    z-index: 60;
    user-select: none;
    transition: background 0.2s ease, width 0.2s ease;
}

.resizer-vertical {
    width: 6px;
    cursor: col-resize;
    height: 100%;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    margin: 0 -1px;
    flex-shrink: 0;
}

.sidebar-resizer:hover,
.sidebar-resizer:active {
    background: var(--secondary-color);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

body.editor-resizing {
    cursor: col-resize !important;
    user-select: none !important;
}

body.editor-resizing * {
    user-select: none !important;
}

.sidebar-horizontal {
    flex-direction: row;
    height: 200px;
    width: 100%;
}

/* Collapsible Panel Container */
.panel-container {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 150px;
    flex: 1;
}

.panel-container.collapsed {
    min-height: 0 !important;
    flex: 0 0 auto !important;
}

.panel-container.collapsed .panel-body {
    display: none !important;
}


.panel-header {
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 16px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: #e2e8f0;
}

.panel-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.panel-body {
    padding: 16px;
    flex: 1;
    overflow: auto;
}

/* Design Canvas */
.design-canvas {
    flex: 1;
    background: #0f172a;
    padding: 40px;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.canvas-container {
    width: 100%;
    max-width: 1240px;
    min-height: 500px;
    background: var(--bg-body, var(--fallback-bg-body, #ffffff));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    color: var(--text-primary, var(--fallback-text-primary, #1e293b));
    transition: max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flow-root;
    overflow: clip;
    box-sizing: border-box;
}

.canvas-container.theme-mode-light {
    --fallback-bg-body: #ffffff;
    --fallback-text-primary: #1e293b;
}

.canvas-container.theme-mode-dark {
    --fallback-bg-body: #0f172a;
    --fallback-text-primary: #f8fafc;
}

@media (prefers-color-scheme: light) {
    .canvas-container.theme-mode-system {
        --fallback-bg-body: #ffffff;
        --fallback-text-primary: #1e293b;
    }
}

@media (prefers-color-scheme: dark) {
    .canvas-container.theme-mode-system {
        --fallback-bg-body: #0f172a;
        --fallback-text-primary: #f8fafc;
    }
}

.canvas-container[data-device-view="mobile"] {
    max-width: 320px !important;
}
.canvas-container[data-device-view="tablet"] {
    max-width: 768px !important;
}
.canvas-container[data-device-view="desktop"] {
    max-width: 1240px !important;
}
.canvas-container[data-device-view="wide"] {
    max-width: 1400px !important;
}

/* Interactive Boundaries & Outlines on Canvas */
.editor-block-rendered {
    position: relative;
    outline: 1px dashed rgba(59, 130, 246, 0.3);
    transition: outline 0.15s ease, box-shadow 0.15s ease;
    min-height: 30px;
    box-sizing: border-box;
}

.editor-block-rendered:hover {
    outline: 1px solid var(--secondary-color);
}

.editor-block-rendered.selected {
    outline: 2px solid var(--secondary-color) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.editor-body-root {
    min-height: 500px;
    width: 100%;
    margin: 0 !important;
    box-sizing: border-box;
    display: flow-root;
}

/* Form Builder Canvas Field & Span Layout Rules */
.cms-form-inner > .editor-block-rendered,
.cms-form-inner > .referenced-block-read-only {
    width: 100%;
    box-sizing: border-box;
}

.cms-form-inner.cms-form-layout-grid-2 > .editor-block-rendered.cms-span-full,
.cms-form-inner.cms-form-layout-grid-2 > .referenced-block-read-only.cms-span-full,
.cms-form-inner.cms-form-layout-grid-3 > .editor-block-rendered.cms-span-full,
.cms-form-inner.cms-form-layout-grid-3 > .referenced-block-read-only.cms-span-full {
    grid-column: 1 / -1;
    width: 100%;
}

.cms-form-inner.cms-form-layout-grid-2 > .editor-block-rendered.cms-span-1-col,
.cms-form-inner.cms-form-layout-grid-2 > .referenced-block-read-only.cms-span-1-col,
.cms-form-inner.cms-form-layout-grid-3 > .editor-block-rendered.cms-span-1-col,
.cms-form-inner.cms-form-layout-grid-3 > .referenced-block-read-only.cms-span-1-col {
    grid-column: span 1;
}

.cms-form-inner.cms-form-layout-grid-3 > .editor-block-rendered.cms-span-2-col,
.cms-form-inner.cms-form-layout-grid-3 > .referenced-block-read-only.cms-span-2-col {
    grid-column: span 2;
}

.block-placeholder {
    padding: 20px;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    background: repeating-linear-gradient(
        45deg,
        rgba(0, 0, 0, 0.02),
        rgba(0, 0, 0, 0.02) 10px,
        rgba(0, 0, 0, 0.04) 10px,
        rgba(0, 0, 0, 0.04) 20px
    );
    border: 1px dashed #cbd5e1;
    border-radius: 4px;
    margin: 8px;
}

/* Block Tree Hierarchy Panel styles */
.tree-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tree-node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.tree-node-header:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.tree-node-header.selected {
    background: var(--secondary-color);
    color: #ffffff;
    border-color: var(--secondary-color);
}

.tree-node-header.dragging {
    opacity: 0.4;
    border: 1px dashed var(--secondary-color) !important;
}

.tree-node-header.drag-over {
    border: 1px solid var(--accent-color) !important;
    background: rgba(16, 185, 129, 0.15) !important;
    color: #ffffff;
}

.tree-node-header.drag-before {
    border-top: 2px solid var(--accent-color) !important;
}

.tree-node-header.drag-inside {
    background: rgba(16, 185, 129, 0.25) !important;
}

.tree-node-header.drag-after {
    border-bottom: 2px solid var(--accent-color) !important;
}

.node-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    padding-right: 4px;
}

.node-label code {
    font-size: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 1px 4px;
    border-radius: 3px;
}

.node-actions {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 3px;
    opacity: 0;
    pointer-events: none;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(6px);
    padding: 3px 6px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: opacity 0.15s ease;
    z-index: 2;
}

.tree-node-header:hover .node-actions {
    opacity: 1;
    pointer-events: auto;
}

.node-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 10px;
    border-radius: 2px;
}

.node-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* The editor injects the tenant's public-site global CSS into the document
   (for the canvas preview), which can redefine --text-primary etc. with a light
   theme's colors. Scope the editor chrome variables so sidebars stay readable. */
.editor-sidebar {
    --text-primary: #f8fafc;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
}

/* Palette Available Blocks list */
.palette-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Quick filter input — fixed editor chrome colors (never inherit the site theme) */
#palette-filter-input {
    color: #f8fafc;
    caret-color: #f8fafc;
}
#palette-filter-input::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.palette-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: 6px;
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.palette-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--secondary-color);
}

.palette-item.active {
    background: rgba(59, 130, 246, 0.2) !important;
    border-color: var(--secondary-color) !important;
    box-shadow: inset 0 0 0 1px var(--secondary-color);
}

.palette-item-content {
    flex: 1;
}

.palette-item-name {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
}

.palette-item-meta {
    font-size: 10px;
    color: #94a3b8;
}

.btn-icon-cog {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.btn-icon-cog:hover {
    opacity: 1;
}

/* Palette Sections (collapsible groups in Available Blocks) */
.palette-section {
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.3);
}

.palette-section.collapsed .palette-section-body {
    display: none !important;
}

.palette-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    user-select: none;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.15s, color 0.15s;
}

.palette-section-header:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}

.palette-section-toggle {
    font-size: 9px;
    color: #64748b;
    transition: color 0.15s;
}

.palette-section-header:hover .palette-section-toggle {
    color: #94a3b8;
}

.palette-section-body {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.palette-section-body .palette-item {
    margin: 0;
}

/* Star / Favorite button on palette items */
.palette-item-fav {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    flex-shrink: 0;
    transition: color 0.15s;
}

.palette-item-fav:hover {
    color: #fbbf24;
}

.palette-item-fav.active {
    color: #fbbf24;
}

/* Help icon on palette items */
.palette-item-help {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    transition: color 0.15s, background 0.15s;
    border-radius: 4px;
    line-height: 1;
}

.palette-item-help:hover {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
}

/* Block Help Popover */
.block-help-popover {
    position: fixed;
    z-index: 9999;
    width: 440px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: popoverFadeIn 0.15s ease-out;
}

.block-help-popover.hidden {
    display: none;
}

.block-help-popover-scroll {
    padding: 24px;
    overflow-y: auto;
}

.block-help-popover-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    z-index: 1;
    transition: color 0.15s;
}

.block-help-popover-close:hover {
    color: #f1f5f9;
}

.block-help-section {
    margin-bottom: 14px;
}

.block-help-section:last-child {
    margin-bottom: 0;
}

.block-help-label {
    font-size: 9px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
}

.block-help-value {
    font-size: 12px;
    color: #e2e8f0;
    line-height: 1.5;
}

@keyframes popoverFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Block help content typography */
.block-help-value p {
    margin: 0 0 8px 0;
}

.block-help-value p:last-child {
    margin-bottom: 0;
}

.block-help-value ul {
    margin: 4px 0 8px 0;
    padding-left: 18px;
}

.block-help-value li {
    margin-bottom: 3px;
}

.block-help-value code {
    background: rgba(96, 165, 250, 0.15);
    color: #93c5fd;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.block-help-value strong {
    color: #f1f5f9;
    font-weight: 600;
}

.block-help-value table.hlp-table {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0 4px 0;
    font-size: 11px;
}

.block-help-value table.hlp-table th,
.block-help-value table.hlp-table td {
    padding: 4px 8px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.block-help-value table.hlp-table th {
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 9px;
    letter-spacing: 0.5px;
}

.block-help-value table.hlp-table td {
    color: #cbd5e1;
}

.block-help-value table.hlp-table td code {
    font-size: 10px;
}

/* Form Styling in Sidebars */
.inspector-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group label {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 4px;
    display: block;
    font-weight: 500;
}

.input-group input[type="text"],
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.8);
    color: #f1f5f9;
    font-family: inherit;
    font-size: 12px;
    box-sizing: border-box;
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.45;
}

.input-group input[type="color"] {
    width: 100%;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    cursor: pointer;
    padding: 0;
}

/* Animation utilities */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.99); }
    to { opacity: 1; transform: scale(1); }
}

.history-item-card:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.history-item-card.active:hover {
    background: rgba(59, 130, 246, 0.25) !important;
    border-color: var(--secondary-color) !important;
}

/* Referenced Section Editor Styles */
.referenced-section-wrapper {
    border: 2px dashed #8b5cf6 !important;
    padding: 24px 12px 12px 12px;
    margin: 16px 0;
    position: relative;
    border-radius: 8px;
    background: rgba(139, 92, 246, 0.02);
}
.referenced-section-wrapper:hover {
    border: 2px solid #8b5cf6 !important;
}
.referenced-section-wrapper.selected {
    outline: 2px solid #8b5cf6 !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2) !important;
}
.referenced-section-badge {
    background: #8b5cf6;
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    border-top-left-radius: 6px;
    border-bottom-right-radius: 6px;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.referenced-section-content {
    margin-top: 10px;
}
.referenced-block-read-only {
    position: relative;
    outline: 1px dashed rgba(139, 92, 246, 0.15);
    min-height: 24px;
    box-sizing: border-box;
}

#editor-overlay-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1500;
}

/* Built-in Block Styles: Image Frames & Stacks */
.img-frame-rounded-border {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.35);
}
.img-frame-shadow {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
}
.img-frame-rounded-shadow {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.2);
}
.mobile-frame-white {
    background: #ffffff;
    border-radius: 32px;
    padding: 24px 12px;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.05);
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
}
.mobile-frame-white .mobile-notch {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 10px;
    background: #0f172a;
    border-radius: 5px;
    z-index: 10;
}
.mobile-frame-white .mobile-home-bar {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    z-index: 10;
}
.mobile-frame-white .mobile-screen {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    display: flex;
}
.mobile-frame-white .mobile-screen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mobile-frame-transparent {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 32px;
    padding: 24px 12px;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.15);
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.1);
}
.mobile-frame-transparent .mobile-notch {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 10px;
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.1);
    border-radius: 5px;
    z-index: 10;
}
.mobile-frame-transparent .mobile-home-bar {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    z-index: 10;
}
.mobile-frame-transparent .mobile-screen {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(0,0,0,0.2);
    display: flex;
}
.mobile-frame-transparent .mobile-screen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-stack-container {
    position: relative;
    box-sizing: border-box;
}
.image-stack-container > * {
    position: absolute !important;
}

/* Grid & Grid Item Blocks */
.grid-block-container {
    display: flex;
    flex-wrap: wrap;
    box-sizing: border-box;
}
.grid-item-block {
    box-sizing: border-box;
}

/* Content Detail Popover (in-editor preview) */
.cms-popover-overlay { position:fixed !important;inset:0 !important;z-index:99999 !important;display:flex;align-items:center;justify-content:center;background:rgba(15,23,42,0.65);backdrop-filter:blur(6px);opacity:0;transition:opacity 0.25s ease;pointer-events:none; }
.cms-popover-overlay.visible { opacity:1;pointer-events:all; }
html.cms-popover-open, body.cms-popover-open { overflow:hidden !important; }
.cms-popover-box { position:relative;box-sizing:border-box;width:80vw;height:auto;max-width:80vw;max-height:80vh;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;border-radius:20px;padding:clamp(24px,4vw,48px);animation:cms-popover-in 0.25s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes cms-popover-in { from { transform:scale(0.94) translateY(12px);opacity:0; } to { transform:scale(1) translateY(0);opacity:1; } }
.cms-popover-box.style-theme { background:var(--bg-card, var(--card-bg, #0f172a)); color:var(--text-primary, var(--text-color, #f8fafc)); border:1px solid var(--border-color, var(--card-border, rgba(148,163,184,0.35))); box-shadow:0 30px 80px rgba(0,0,0,0.35),inset 0 1px 0 rgba(255,255,255,0.08); }
.cms-popover-box.cms-popover-with-footer { display:flex; flex-direction:column; height:auto; max-height:80vh; padding:0; overflow:hidden; }
.cms-popover-with-footer .cms-popover-scroll { flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; padding:clamp(24px,4vw,48px); }
.cms-popover-with-footer .cms-popover-footer { display:flex; flex:0 0 auto; justify-content:flex-end; gap:10px; padding:14px clamp(24px,4vw,48px); border-top:1px solid var(--border-color, rgba(148,163,184,0.25)); }
.cms-popover-box.style-ultra-modern { background:rgba(15,23,42,0.9);backdrop-filter:blur(24px) saturate(1.6);-webkit-backdrop-filter:blur(24px) saturate(1.6);border:1px solid rgba(255,255,255,0.12);color:#e2e8f0;box-shadow:0 32px 80px rgba(0,0,0,0.5),inset 0 1px 0 rgba(255,255,255,0.08); }
.cms-popover-box.style-traditional { background:#fff;border:1px solid rgba(0,0,0,0.06);color:#1e293b;box-shadow:0 20px 60px rgba(0,0,0,0.22); }
.cms-popover-close { position:absolute;top:16px;right:20px;z-index:2;background:rgba(148,163,184,0.12);border:none;border-radius:999px;width:36px;height:36px;cursor:pointer;font-size:24px;line-height:1;opacity:0.7;color:inherit;transition:opacity 0.15s,background-color 0.15s; }
@media (max-width:640px) { .cms-popover-box { width:90vw;height:auto;max-width:90vw;max-height:85vh;padding:24px; } .cms-popover-box.cms-popover-with-footer { padding:0; max-height:85vh; } .cms-popover-with-footer .cms-popover-scroll { padding:24px; } .cms-popover-with-footer .cms-popover-footer { padding:12px 24px; } }
.cms-popover-close:hover { opacity:1; }
.cms-popover-title { font-size:1.4em;font-weight:700;margin:0 0 8px; }
.cms-popover-meta { font-size:0.82em;opacity:0.6;margin-bottom:16px; }
.cms-popover-summary { font-size:0.97em;opacity:0.85;margin-bottom:20px;line-height:1.55; }
.cms-popover-body { line-height:1.7;font-size:0.95em; }
.cms-popover-body img { max-width:100%;border-radius:8px;margin:12px 0; }

/* Top Bar Device Quick-Select Combo */
.device-view-btn-group {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.device-view-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.device-view-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.device-view-btn.active {
    background: var(--secondary-color);
    color: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Settings Modal Tabs & View Presets */
.editor-settings-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 20px;
}

.settings-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #94a3b8;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.settings-tab-btn:hover {
    color: #ffffff;
}

.settings-tab-btn.active {
    color: #ffffff;
    border-bottom-color: var(--secondary-color);
}

.view-presets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}

.view-preset-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.view-preset-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

.view-preset-card.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--secondary-color);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.view-preset-card .preset-title {
    font-weight: 600;
    font-size: 13px;
}

.view-preset-card .preset-width {
    font-size: 11px;
    color: #94a3b8;
}

.view-preset-card.active .preset-width {
    color: #cbd5e1;
}

/* Ensure canvas form submit and reset buttons inherit text color and typography */
.canvas-container .cms-submit-btn,
.canvas-container .cms-reset-btn,
.editor-block-rendered .cms-submit-btn,
.editor-block-rendered .cms-reset-btn {
    font-family: inherit;
}

.canvas-container .cms-submit-btn .btn-text,
.canvas-container .cms-reset-btn .btn-text,
.editor-block-rendered .cms-submit-btn .btn-text,
.editor-block-rendered .cms-reset-btn .btn-text {
    color: inherit !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    font-family: inherit !important;
    cursor: inherit !important;
}




/* ---------- Patterns palette ---------- */
.palette-view-btn { transition: background .15s ease, color .15s ease; }
.pattern-group { margin-bottom: 12px; }
.pattern-group-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin: 8px 0 6px;
    font-weight: 600;
}
.pattern-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
}
.pattern-head { display: flex; align-items: flex-start; gap: 8px; }
.pattern-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: rgba(59, 130, 246, .12);
    color: #93c5fd;
}
.pattern-icon svg { width: 16px; height: 16px; }
.pattern-icon.content { background: rgba(59, 130, 246, .12); color: #93c5fd; }
.pattern-icon.marketing { background: rgba(139, 92, 246, .14); color: #c4b5fd; }
.pattern-icon.layout { background: rgba(148, 163, 184, .12); color: #cbd5e1; }
.pattern-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pattern-title {
    font-size: 12px;
    font-weight: 600;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.pattern-desc { font-size: 10.5px; color: var(--text-muted); line-height: 1.35; }
.pattern-meta { font-size: 9.5px; color: var(--text-muted); opacity: .8; letter-spacing: .01em; }
.pattern-badge {
    font-size: 8.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 1px 5px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.pattern-badge.starter { color: #93c5fd; background: rgba(59, 130, 246, .14); border-color: rgba(59, 130, 246, .3); }
.pattern-badge.tenant { color: #c4b5fd; background: rgba(139, 92, 246, .14); border-color: rgba(139, 92, 246, .3); }
.pattern-badge.workspace { color: #6ee7b7; background: rgba(16, 185, 129, .12); border-color: rgba(16, 185, 129, .3); }
.pattern-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pattern-insert-btn {
    flex: 1 1 auto;
    min-width: 70px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 5px;
    background: var(--secondary-color, #3b82f6);
    color: #fff;
    cursor: pointer;
}
.pattern-insert-btn:hover { opacity: .9; }
.pattern-mini-btn {
    padding: 5px 8px;
    font-size: 10px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .05);
    color: var(--text-muted);
    cursor: pointer;
}
.pattern-mini-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.pattern-mini-btn.danger:hover { background: rgba(239, 68, 68, .18); color: #fca5a5; border-color: rgba(239, 68, 68, .35); }
.pattern-empty { text-align: center; padding: 24px 12px; color: var(--text-muted); font-size: 12px; line-height: 1.5; }

.insp-field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.insp-field-label-row label { margin-bottom: 0 !important; }
.insp-expand-btn {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid rgba(148,163,184,0.2);
    border-radius: 6px;
    background: rgba(148,163,184,0.08);
    color: var(--text-muted);
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.insp-expand-btn:hover {
    color: #fff;
    border-color: rgba(59,130,246,0.5);
    background: rgba(59,130,246,0.15);
}

/* Block Styles editor sticky block-type filter */
.styles-block-type-filter {
    position: sticky;
    top: -15px;
    z-index: 8;
    margin: -15px -15px 10px;
    padding: 12px 15px 10px;
    background: rgba(15, 23, 42, 0.97);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Blocks/Patterns palette sticky header */
.palette-sticky-head {
    position: sticky;
    top: -16px;
    z-index: 8;
    margin: -16px -16px 10px;
    padding: 12px 16px 10px;
    background: rgba(15, 23, 42, 0.97);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.panel-header #btn-create-def-header:hover {
    color: #fff;
    border-color: rgba(59,130,246,0.5);
}

.insp-picker-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.insp-picker-btn {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border: 1px solid rgba(148,163,184,0.25);
    border-radius: 6px;
    background: rgba(148,163,184,0.08);
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.insp-picker-btn:hover {
    color: #fff;
    border-color: rgba(59,130,246,0.5);
    background: rgba(59,130,246,0.15);
}

/* Inline help for CSS shorthand inspector fields */
.insp-field-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex: 0 0 auto;
}
.insp-field-help-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: auto;
    flex: 0 0 auto;
}
.insp-field-actions .insp-field-help-wrap { margin-left: 0; }
.insp-field-help-btn {
    width: 16px;
    height: 16px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148,163,184,0.38);
    border-radius: 50%;
    background: rgba(148,163,184,0.08);
    color: var(--text-muted, #94a3b8);
    font: 700 10px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: help;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.insp-field-help-btn:hover,
.insp-field-help-btn:focus {
    color: #fff;
    background: rgba(99,102,241,0.25);
    border-color: rgba(129,140,248,0.7);
    outline: none;
}
.insp-field-help-pop {
    display: none;
    position: absolute;
    top: calc(100% - 2px);
    right: 0;
    z-index: 10050;
    width: 300px;
    max-width: min(300px, calc(100vw - 48px));
    padding: 12px 14px;
    border: 1px solid rgba(148,163,184,0.35);
    border-radius: 10px;
    background: #0f172a;
    color: #dbe4f0;
    box-shadow: 0 12px 30px rgba(0,0,0,0.45);
    font-size: 11px;
    line-height: 1.5;
    text-align: left;
    white-space: normal;
}
.insp-field-help-wrap:hover .insp-field-help-pop,
.insp-field-help-wrap:focus-within .insp-field-help-pop { display: block; }
.insp-field-help-pop strong {
    display: block;
    margin-bottom: 6px;
    color: #f8fafc;
    font-size: 11px;
    font-weight: 700;
}
.insp-field-help-pop p { margin: 0 0 7px; }
.insp-field-help-pop p:last-child { margin-bottom: 0; }
.insp-field-help-pop code {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(148,163,184,0.14);
    color: #c7d2fe;
    font-size: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
