/*
 * Page Builder styles.
 *
 * Section 1 ("pbx-*" component classes) is what
 * Services/PageBuilder/PageComponentRegistry.cs actually emits on published
 * pages (Views/Pages/Show.cshtml) and what the admin builder's canvas
 * preview (wwwroot/js/page-builder/canvas-renderer.js + ui.js) renders, so
 * both look the same — exactly the same reasoning as form-builder.css's own
 * "fb-*" section. Section 2 is the admin editor chrome only (palette,
 * canvas, inspector, layers, toolbar) and never appears on the public site.
 *
 * Deliberately prefixed "pb-"/"pbx-" (not "fb-") so this file can be loaded
 * alongside form-builder.css without any class collisions — both are
 * included on both _AdminLayout.cshtml and _Layout.cshtml.
 */

:root {
    --pb-primary: #2563eb;
    --pb-primary-dark: #1d4ed8;
    --pb-border: #e3e7ee;
    --pb-border-strong: #cdd4e0;
    --pb-text: #1c2536;
    --pb-muted: #67728a;
    --pb-bg: #f4f6fb;
    --pb-card: #ffffff;
    --pb-danger: #d92d3f;
    --pb-radius: 10px;
    --pb-radius-sm: 6px;
}

/* ===================================================================
   1. Shared component output (public site + admin canvas preview)
   =================================================================== */

.pbx-section, .pbx-container {
    box-sizing: border-box;
}

.pbx-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    box-sizing: border-box;
}

.pbx-column {
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
}

.pbx-heading {
    margin: .6em 0 .4em;
    color: var(--pb-text);
    font-weight: 800;
    line-height: 1.35;
}

.pbx-text {
    margin: .5em 0;
    color: var(--pb-text);
    line-height: 1.9;
}

.pbx-image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: var(--pb-radius);
}

.pbx-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 26px;
    border: 1px solid var(--pb-primary);
    border-radius: var(--pb-radius-sm);
    background: var(--pb-primary);
    color: #fff;
    font: inherit;
    font-weight: 700;
    font-size: .92rem;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.pbx-button:hover { background: var(--pb-primary-dark); border-color: var(--pb-primary-dark); }


/* ------------------------------------------------------------------ */
/*  Media Library components — video / audio / fileLink.               */
/*  Shared by the published page (Services/PageBuilder/                */
/*  PageComponentRegistry.cs) and the editor canvas                    */
/*  (wwwroot/js/page-builder/canvas-renderer.js), which is why they    */
/*  live beside .pbx-image above rather than in the editor-only        */
/*  section further down.                                              */
/* ------------------------------------------------------------------ */
.pbx-video {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    background: #000;
    border-radius: var(--pb-radius);
}

.pbx-audio {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.pbx-audio audio { width: 100%; }

.pbx-audio-title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--pb-text);
}

.pbx-filelink {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    color: var(--pb-text);
    text-decoration: none;
    background: var(--pb-bg);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius-sm);
    transition: border-color .15s ease, background .15s ease;
}

.pbx-filelink:hover { background: #fff; border-color: var(--pb-primary); }
.pbx-filelink i { font-size: 1.2rem; color: var(--pb-primary); }
.pbx-filelink-text { font-weight: 700; }

.pbx-filelink-desc {
    display: block;
    font-size: .78rem;
    font-weight: 400;
    color: #6b7280;
}

/* Editor-canvas-only: a video/audio node with no file chosen yet. The
   published renderer emits nothing at all for that case (an empty
   <video src=""> is a broken element), so this class never reaches a
   visitor. */
.pbx-media-placeholder {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 22px;
    font-size: .85rem;
    color: #6b7280;
    background: var(--pb-bg);
    border: 1px dashed var(--pb-border);
    border-radius: var(--pb-radius-sm);
}

/* Public page wrapper (Views/Pages/Show.cshtml) */
.pbx-page { min-height: 40vh; }

/* Editor-canvas-only placeholder for an unresolved/unconfigured global
   component reference, product grid, or embedded form (Phase 9) — never
   emitted on the public site (that substitutes the real resolved markup,
   or nothing, server-side). */
.pb-node-globalRef .pbx-globalref-placeholder,
.pb-node-productGrid .pbx-productgrid-placeholder,
.pb-node-embeddedForm .pbx-embeddedform-placeholder {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border: 1px dashed var(--pb-border-strong);
    border-radius: var(--pb-radius-sm);
    color: var(--pb-muted);
    font-size: .82rem;
    background: var(--pb-bg);
}

@media (max-width: 640px) {
    .pbx-row { flex-wrap: wrap; }
    .pbx-row > .pbx-column { flex: 1 1 100%; }
}

/* Phase 4 (Layout Engine): responsive hide-flag classes, applied server-side
   by PageSchemaHelpers.BuildClassAttribute when a node's
   props.responsive.hideDesktop/hideTablet/hideMobile is true — the exact
   same static-class + real-media-query mechanism form-builder.css already
   proved with its own .fb-hide-* classes, reused here under the pbx- prefix
   so both builders' output can share a page without collisions. These never
   fight PageSchemaRenderer's generated <style> block (tablet/mobile
   overrides, desktop-only column width) because a hidden element's other
   styles are irrelevant once display:none wins. */
.pbx-hide-desktop, .pbx-hide-tablet, .pbx-hide-mobile { display: initial; }

@media (max-width: 767px) {
    .pbx-hide-mobile { display: none !important; }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .pbx-hide-tablet { display: none !important; }
}

@media (min-width: 1024px) {
    .pbx-hide-desktop { display: none !important; }
}

/* Phase 6 (Advanced Components): tabs/tabItem and slider/slide.

   .pbx-tab-panel and .pbx-slide both default to display:none here.
   PageComponentRegistry.cs's tabs/slider Render functions emit a small
   inline <style>#firstChildId{display:block}</style> snippet alongside
   their own HTML (gated by PageSchemaHelpers.IsSafeCssIdentifier) so the
   first child is visible even before/without
   wwwroot/js/page-builder/runtime.js running — the script (loaded only
   on published pages, never the admin editor) is what switches between
   children after first paint, and it always sets .style.display
   directly rather than toggling a class: an ID-selector rule (the
   inline <style> above) outranks a class-selector rule regardless of
   source order, so a class-based visibility toggle would leave the
   first child stuck visible forever. See
   docs/page-builder/PHASE6_ADVANCED_COMPONENTS.md for the full writeup. */
.pbx-tabs, .pbx-slider { box-sizing: border-box; }

.pbx-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--pb-border);
}

.pbx-tabs-tab {
    padding: 10px 18px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--pb-muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.pbx-tabs-tab.is-active { color: var(--pb-primary); border-bottom-color: var(--pb-primary); }

.pbx-tab-panel { display: none; box-sizing: border-box; }

.pbx-slider {
    position: relative;
    overflow: hidden;
}

.pbx-slider-track { position: relative; box-sizing: border-box; }

.pbx-slide { display: none; box-sizing: border-box; }

/* Physical (not logical) positioning to match this project's RTL
   default (PageRenderContext.Direction): "prev" points right and sits
   on the right edge, "next" points left and sits on the left edge —
   mirrors PageComponentRegistry.cs's own comment on these same two
   buttons. */
.pbx-slider-prev, .pbx-slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    color: var(--pb-text);
    box-shadow: 0 2px 8px rgba(16, 24, 40, .18);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.pbx-slider-prev { right: 12px; }
.pbx-slider-next { left: 12px; }
.pbx-slider-prev:hover, .pbx-slider-next:hover { background: #fff; }

.pbx-slider-dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 2;
}

.pbx-slider-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .6);
    cursor: pointer;
}

.pbx-slider-dot.is-active { background: #fff; }

/* ===================================================================
   2. Admin builder chrome
   =================================================================== */

.pb-editor {
    display: flex;
    flex-direction: column;
    min-height: 80vh;
    margin: 0 -28px -40px;
    background: var(--admin-bg, var(--pb-bg));
}

@media (max-width: 700px) {
    .pb-editor { margin: 0 -14px -32px; }
}

.pb-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 18px;
    background: var(--admin-card, #fff);
    border-bottom: 1px solid var(--admin-border, var(--pb-border));
    flex-wrap: wrap;
}

.pb-topbar-start, .pb-topbar-center, .pb-topbar-end {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pb-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: var(--pb-text);
    background: var(--pb-bg);
}

.pb-title-block { display: flex; align-items: center; gap: 8px; }
.pb-title-block strong { font-size: 1rem; }

.pb-save-indicator {
    font-size: .75rem;
    padding: 3px 9px;
    border-radius: 999px;
    background: #eef0f4;
    color: var(--pb-muted);
}

.pb-save-indicator.pb-save-saved { background: #e9f9f1; color: #17a262; }
.pb-save-indicator.pb-save-saving { background: #fef3e2; color: #b76a06; }
.pb-save-indicator.pb-save-unsaved { background: #eef0f4; color: var(--pb-muted); }
.pb-save-indicator.pb-save-error { background: #fdecee; color: var(--pb-danger); }

.pb-history-group, .pb-breakpoint-group {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--pb-bg);
    border-radius: 10px;
}

.pb-icon-btn, .pb-bp-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--pb-text);
    cursor: pointer;
}

.pb-icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.pb-bp-btn.is-active, .pb-icon-btn:hover:not(:disabled) {
    background: #fff;
    box-shadow: var(--admin-shadow-xs, 0 1px 2px rgba(16,24,40,.08));
    color: var(--pb-primary);
}

.pb-mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid var(--pb-border-strong);
    background: #fff;
    color: var(--pb-text);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
}

.pb-editor.is-preview .pb-mode-toggle { background: var(--pb-primary); border-color: var(--pb-primary); color: #fff; }

/* Phase 10 (Global Components Management): the info banner
   Areas/Admin/Views/GlobalComponents/Builder.cshtml shows in place of the
   Pages builder's history/publish controls — a global component has no
   draft/publish distinction (Models/Entities/GlobalComponentDefinition.cs
   is a single SchemaJson column), so saving here takes effect immediately
   everywhere the component is referenced, and this banner says so. */
.pb-global-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #eaf1ff;
    border-bottom: 1px solid var(--pb-border);
    color: var(--pb-text);
    font-size: .85rem;
}

.pb-global-notice i {
    color: var(--pb-primary);
}

.pb-body {
    flex: 1;
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    min-height: 640px;
}

.pb-sidebar-left, .pb-inspector {
    overflow-y: auto;
    padding: 14px;
    background: var(--admin-card, #fff);
}

.pb-sidebar-left { border-left: 1px solid var(--admin-border, var(--pb-border)); display: flex; flex-direction: column; }
.pb-inspector { border-right: 1px solid var(--admin-border, var(--pb-border)); }

.pb-sidebar-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 12px;
    background: var(--pb-bg);
    border-radius: 10px;
}

.pb-sidebar-tab {
    flex: 1;
    padding: 7px 4px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--pb-muted);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
}

.pb-sidebar-tab.is-active { background: #fff; color: var(--pb-primary); box-shadow: 0 1px 2px rgba(16,24,40,.08); }

.pb-palette-group { margin-bottom: 18px; }
.pb-palette-group h3 { margin: 0 0 8px; font-size: .8rem; color: var(--pb-muted); font-weight: 700; }

.pb-palette-target {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    margin-bottom: 14px;
    border-radius: 8px;
    background: var(--pb-bg);
    border: 1px dashed var(--pb-border-strong);
    color: var(--pb-muted);
    font-size: .74rem;
}
.pb-palette-target i { color: var(--pb-primary); }

.pb-palette-list { display: flex; flex-direction: column; gap: 6px; }

.pb-palette-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border: 1px solid var(--pb-border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: .85rem;
}

.pb-palette-item:hover { border-color: var(--pb-primary); color: var(--pb-primary); }
.pb-palette-item i { width: 16px; color: var(--pb-muted); }

.pb-canvas-wrap { overflow: auto; padding: 24px; }
.pb-canvas-scroller { min-height: 100%; }

.pb-canvas {
    max-width: 100%;
    margin: 0 auto;
    min-height: 400px;
    padding: 20px;
    background: var(--pb-card);
    border-radius: 14px;
    border: 1px solid var(--admin-border, var(--pb-border));
    transition: max-width .2s ease;
}

.pb-canvas[data-breakpoint="tablet"] { max-width: 768px; }
.pb-canvas[data-breakpoint="mobile"] { max-width: 375px; }

.pb-canvas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 20px;
    color: var(--pb-muted);
    text-align: center;
}

.pb-canvas-empty i { font-size: 2rem; opacity: .5; }

.pb-node {
    position: relative;
    border: 1px dashed transparent;
    border-radius: 8px;
    transition: border-color .1s ease;
    margin-block: 2px;
}

.pb-node:hover { border-color: var(--pb-border-strong); }
.pb-node.is-selected { border-color: var(--pb-primary); box-shadow: 0 0 0 1px var(--pb-primary); }

.pb-node.pb-node-has-hidden::after {
    content: "واکنش‌گرا";
    position: absolute;
    top: -9px;
    left: 8px;
    font-size: .62rem;
    background: #b76a06;
    color: #fff;
    padding: 1px 6px;
    border-radius: 999px;
    z-index: 2;
}

/* Phase 7 (Dynamic System): mirrors .pb-node-has-hidden above (same
   scan-at-a-glance badge idea), on the opposite corner (right instead
   of left) so a node with both a responsive hide flag and a visibility
   condition can show both badges at once without overlapping. See
   ui.js's renderNodeElement for when this class is applied. */
.pb-node.pb-node-has-visibility-rule::after {
    content: "شرطی";
    position: absolute;
    top: -9px;
    right: 8px;
    font-size: .62rem;
    background: var(--pb-primary);
    color: #fff;
    padding: 1px 6px;
    border-radius: 999px;
    z-index: 2;
}

.pb-node-toolbar {
    position: absolute;
    top: -13px;
    right: 8px;
    display: none;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: var(--pb-text);
    border-radius: 7px;
    z-index: 3;
    box-shadow: 0 4px 10px rgba(16, 24, 40, .25);
}

.pb-node:hover > .pb-node-toolbar,
.pb-node.is-selected > .pb-node-toolbar {
    display: flex;
}

.pb-node-label {
    font-size: .66rem;
    color: #cbd3e1;
    padding: 0 6px;
    white-space: nowrap;
}

.pb-tb-btn {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #e5e9f2;
    cursor: pointer;
    font-size: .7rem;
}

.pb-tb-btn:hover { background: rgba(255, 255, 255, .15); }
.pb-tb-btn.pb-tb-danger:hover { background: var(--pb-danger); color: #fff; }
.pb-drag-handle { cursor: grab; }

.pb-node-inner { padding: 10px; min-height: 24px; }

.pb-node-row > .pb-node-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 6px;
}

.pb-node-row > .pb-node-inner > .pb-node { flex: 1 1 0; min-width: 0; }
.pb-node-column > .pb-node-inner { min-height: 40px; }

.pb-dropzone-empty-hint {
    padding: 16px 10px;
    text-align: center;
    color: var(--pb-muted);
    font-size: .78rem;
    border: 1px dashed var(--pb-border-strong);
    border-radius: 6px;
}

/* Phase 4 (Layout Engine): drag-to-resize handle between two adjacent
   columns in a row (ui.js's buildColumnResizeHandle). flex:0 0 14px with
   -7px margins on both sides nets to zero extra width in the flex layout
   (14 - 7 - 7 = 0) so the handle itself never widens a row; the row's own
   `gap` still applies on both sides of it like any other flex item, so
   editor-mode rows end up with slightly more breathing room between
   columns than the published page has — a harmless, editor-only chrome
   difference, the same category as the selection border or the toolbar. */
.pb-col-resize-handle {
    flex: 0 0 14px;
    align-self: stretch;
    margin: 0 -7px;
    position: relative;
    z-index: 4;
    cursor: col-resize;
}

.pb-col-resize-handle::after {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 5px;
    right: 5px;
    border-radius: 3px;
    background: transparent;
    transition: background .12s ease;
}

.pb-col-resize-handle:hover::after {
    background: var(--pb-primary);
}

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

.pb-editor.is-preview .pb-col-resize-handle {
    display: none;
}

.pb-drop-indicator {
    height: 3px;
    margin: 4px 0;
    background: var(--pb-primary);
    border-radius: 3px;
}

/* Layers / Navigator panel */
.pb-layers-empty { color: var(--pb-muted); font-size: .82rem; padding: 12px 4px; }
.pb-layers-list { display: flex; flex-direction: column; }

.pb-layer-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 6px 6px 4px;
    border-radius: 6px;
    cursor: pointer;
    font-size: .82rem;
}

.pb-layer-row:hover { background: var(--pb-bg); }
.pb-layer-row.is-selected { background: #eaf1ff; color: var(--pb-primary); }

.pb-layer-toggle {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--pb-muted);
    font-size: .68rem;
    cursor: pointer;
    flex-shrink: 0;
}
.pb-layer-toggle:disabled { cursor: default; }
.pb-layer-toggle-spacer { width: 8px; display: inline-block; }

.pb-layer-icon { width: 14px; color: var(--pb-muted); font-size: .74rem; flex-shrink: 0; }
.pb-layer-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-layer-actions { display: none; gap: 2px; }
.pb-layer-row:hover .pb-layer-actions, .pb-layer-row.is-selected .pb-layer-actions { display: flex; }
.pb-layer-actions .pb-tb-btn { color: var(--pb-muted); }
.pb-layer-actions .pb-tb-btn:hover { background: var(--pb-border); color: var(--pb-text); }
.pb-layer-actions .pb-tb-btn.pb-tb-danger:hover { background: var(--pb-danger); color: #fff; }

.pb-editor.is-preview .pb-node-toolbar,
.pb-editor.is-preview .pb-dropzone-empty-hint,
.pb-editor.is-preview .pb-add-child-btn {
    display: none !important;
}

.pb-editor.is-preview .pb-node:hover,
.pb-editor.is-preview .pb-node.is-selected {
    border-color: transparent;
    box-shadow: none;
}

.pb-inspector-empty { color: var(--pb-muted); font-size: .85rem; padding: 20px 4px; }
.pb-inspector-header { padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--pb-border); }

.pb-tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--pb-border); }

.pb-tab {
    padding: 7px 4px;
    border: none;
    background: transparent;
    color: var(--pb-muted);
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.pb-tab.is-active { color: var(--pb-primary); border-bottom-color: var(--pb-primary); }

/* Phase 5 (Styling Engine): the Style tab's "عادی/هاور" state toggle —
   visually the same pill-button language as .pb-history-group/.pb-bp-btn
   above (background-well + a raised, primary-colored active pill) so it
   reads as part of the same UI family rather than a one-off control. */
.pb-style-state-bar {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 12px;
    background: var(--pb-bg);
    border-radius: 10px;
    width: fit-content;
}

.pb-style-state-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--pb-text);
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
}

.pb-style-state-btn.is-active {
    background: #fff;
    color: var(--pb-primary);
    box-shadow: var(--admin-shadow-xs, 0 1px 2px rgba(16, 24, 40, .08));
}

.pb-style-intro { margin-top: 0; }

/* Phase 7 (Dynamic System): the "available {{tokens}}" hint at the top
   of the Content tab for a token-aware component (see ui.js's
   TOKEN_AWARE_TYPES) — a light chip rather than plain muted prose so it
   reads as a quick reference, not just an explanatory sentence. */
.pb-token-hint {
    padding: 8px 10px;
    margin-top: 0;
    margin-bottom: 14px;
    background: var(--pb-bg);
    border: 1px dashed var(--pb-border-strong);
    border-radius: var(--pb-radius-sm);
    font-size: .74rem;
    line-height: 1.7;
}

.pb-prop-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.pb-prop-group label { font-size: .76rem; color: var(--pb-muted); font-weight: 600; }

.pb-prop-input {
    padding: 7px 9px;
    border: 1px solid var(--pb-border-strong);
    border-radius: 6px;
    font: inherit;
    font-size: .84rem;
}

input.pb-prop-input[type="color"] { padding: 3px; height: 34px; cursor: pointer; }
textarea.pb-prop-input { resize: vertical; }

.pb-history-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }

.pb-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--pb-border);
    border-radius: 8px;
}

.pb-settings-error {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #fdecee;
    color: var(--pb-danger);
    font-size: .8rem;
}

@media (max-width: 1100px) {
    .pb-body { grid-template-columns: 220px 1fr 260px; }
}

/* Phase 6 (Advanced Components): the "+" add-child button a tabs/slider
   node appends inside its own dropzone (see ui.js's buildAddChildButton)
   — visually kin to .pb-palette-item (same border/hover language) but
   full-width and living inside the canvas itself, not the palette,
   since tabItem/slide are not draggable palette entries. */
.pb-add-child-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    border: 1px dashed var(--pb-border-strong);
    border-radius: var(--pb-radius-sm);
    background: transparent;
    color: var(--pb-muted);
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
}

.pb-add-child-btn:hover { border-color: var(--pb-primary); color: var(--pb-primary); }


/* ================================================================== */
/*  Hidden-by-default left sidebar + the right-click context menu that */
/*  replaced it (wwwroot/js/page-builder/context-menu.js).             */
/*                                                                     */
/*  The panel is hidden, not deleted: .pb-sidebar-hidden is toggled on */
/*  #pb-editor by ui.js and remembered per browser, so an author who   */
/*  prefers a permanent palette can bring it back from the top bar or  */
/*  the context menu itself.                                           */
/* ================================================================== */
.pb-editor.pb-sidebar-hidden .pb-sidebar-left { display: none; }
.pb-editor.pb-sidebar-hidden .pb-body { grid-template-columns: 1fr 300px; }

@media (max-width: 1400px) {
    .pb-editor.pb-sidebar-hidden .pb-body { grid-template-columns: 1fr 260px; }
}

/* Top-bar toggle. .is-active marks "the sidebar is currently showing",
   matching the breakpoint buttons' own convention. */
#pb-toggle-sidebar.is-active {
    color: var(--pb-primary);
    background: rgba(181, 139, 60, .14);
}

.pb-ctx-menu {
    position: fixed;
    z-index: 1300;
    min-width: 232px;
    padding: 6px;
    font-size: .84rem;
    background: #fff;
    border: 1px solid var(--pb-border);
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, .22);
}

.pb-ctx-heading {
    padding: 6px 10px 8px;
    margin-bottom: 4px;
    font-size: .76rem;
    font-weight: 700;
    color: #6b7280;
    border-bottom: 1px solid var(--pb-border);
}

.pb-ctx-item {
    display: flex;
    gap: 9px;
    align-items: center;
    width: 100%;
    padding: 8px 10px;
    font: inherit;
    font-size: .84rem;
    color: var(--pb-text);
    text-align: right;
    cursor: pointer;
    background: none;
    border: none;
    border-radius: 8px;
}

.pb-ctx-item:hover:not(.is-disabled) { background: var(--pb-bg); }
.pb-ctx-item > i { width: 16px; font-size: .84rem; color: #6b7280; text-align: center; }
.pb-ctx-label { flex: 1; }

.pb-ctx-hint {
    font-size: .7rem;
    color: #9ca3af;
    direction: ltr;
}

.pb-ctx-caret { font-size: .68rem !important; }

.pb-ctx-item.is-disabled {
    color: #b6bcc7;
    cursor: default;
}

.pb-ctx-item.is-disabled > i { color: #cfd4dd; }
.pb-ctx-item.is-danger { color: #b42318; }
.pb-ctx-item.is-danger > i { color: #b42318; }
.pb-ctx-item.is-danger:hover:not(.is-disabled) { background: #fee4e2; }

.pb-ctx-separator {
    height: 1px;
    margin: 5px 6px;
    background: var(--pb-border);
}

/* --- flyout submenus --------------------------------------------- */
.pb-ctx-submenu { position: relative; }

.pb-ctx-panel {
    position: absolute;
    top: -6px;
    /* RTL: the flyout opens to the LEFT of its parent row. */
    right: 100%;
    z-index: 1;
    display: none;
    width: 250px;
    max-height: 360px;
    padding: 6px;
    margin-left: 4px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--pb-border);
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, .22);
}

.pb-ctx-submenu.is-open > .pb-ctx-panel { display: block; }

.pb-ctx-group-title {
    padding: 8px 10px 4px;
    font-size: .72rem;
    font-weight: 700;
    color: #9ca3af;
}

.pb-ctx-target-hint {
    padding: 7px 10px;
    margin-bottom: 4px;
    font-size: .72rem;
    color: #6b7280;
    background: var(--pb-bg);
    border-radius: 8px;
}

.pb-ctx-layers { max-height: 320px; overflow-y: auto; }

/* The layer tree is rendered by the same ui.js code that fills the
   sidebar panel, so its rows need the sidebar's own row styling to
   survive being moved into a much narrower flyout. */
.pb-ctx-layers .pb-layer-row { font-size: .8rem; }
.pb-ctx-layers .pb-layers-empty { padding: 10px; font-size: .78rem; color: #6b7280; }
