/* These controls belong to the editor chrome, never the published website. */
.component-editor-panel { font-family: Inter,"Tajawal",sans-serif; color: var(--editor-ink, #17202B); }
.component-editor-panel:dir(rtl) { font-family: "Tajawal",Inter,sans-serif; }
.component-editor-panel :is(button, input, select, textarea) { font-family: inherit; }
.component-editor-panel { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--editor-border, #DCE3EF); scroll-margin-top: calc(var(--inline-toolbar-height, 112px) + 20px); }
.component-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.component-editor-heading h2 { font-size: 1.05rem; margin: 4px 0 6px; color: var(--editor-ink, #17202B); }
.component-add-toggle { border: 1px solid var(--editor-border-active, #A9BCFF); color: var(--editor-primary, #245CFF); background: #fff; width: 36px; height: 36px; border-radius: 9px; font-size: 1.2rem; flex-shrink: 0; transition: background .12s; }
.component-add-toggle:hover { background: var(--editor-soft, #EDF2FF); }
.component-editor-panel .component-editor-hint { color: var(--editor-muted, #566477); font-size: .74rem; line-height: 1.55; }
.component-picker select { text-overflow: ellipsis; }
.component-library { border: 1px solid var(--editor-border, #DCE3EF); border-radius: 12px; padding: 12px; margin-block: 14px; background: #fff; }
.component-library > summary { display: flex; align-items: center; justify-content: space-between; font-weight: 650; font-size: .81rem; cursor: pointer; list-style: none; }
.component-library > summary::-webkit-details-marker { display: none; }
.component-library[open] > summary { margin-bottom: 12px; }
.component-library > p { font-size: .72rem; }
.component-library-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.component-library-item { display: flex; flex-direction: column; align-items: start; position: relative; gap: 7px; min-width: 0; min-height: 80px; border: 1px solid var(--editor-border, #DCE3EF); border-radius: 10px; padding: 10px 8px; background: #fff; color: var(--editor-ink, #17202B); text-align: start; font-size: .72rem; line-height: 1.4; cursor: grab; transition: background .12s, border-color .12s; }
.component-library-item:hover { border-color: var(--editor-border-active, #A9BCFF); background: var(--editor-soft, #EDF2FF); }
.component-library-item:active { cursor: grabbing; }
.component-library-icon { font-size: 1.2rem; line-height: 1; color: var(--editor-primary, #245CFF); font-weight: 650; }
.component-library-plus { position: absolute; inset-inline-end: 7px; top: 5px; font-size: .8rem; color: var(--editor-primary, #245CFF); }
.component-settings { padding-top: 5px; }
.component-settings > h3 { font-size: 1.05rem; margin: 6px 0 9px; line-height: 1.45; }
.component-editor-panel .component-editor-status { color: #4d6b51; font-size: .72rem; }
.component-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 10px; }
.component-fields .field { margin-block: 13px 4px; gap: 5px; }
.component-fields label { font-size: .73rem; line-height: 1.4; }
.component-fields input:not([type=checkbox]),.component-fields select { padding: 8px!important; font-size: .78rem!important; min-height: 40px!important; }
.component-fields .component-field-boolean { grid-column: 1 / -1; }
.component-fields .component-field-boolean label { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px; border: 1px solid var(--editor-border, #DCE3EF); border-radius: 8px; background: #fff; cursor: pointer; text-align: start; }
.component-fields .component-field-boolean label span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.component-fields .component-field-boolean input[type=checkbox] { flex: 0 0 20px; width: 20px; height: 20px; min-height: 20px; margin: 0; padding: 0; accent-color: var(--editor-primary, #245CFF); cursor: pointer; }
.component-dimension-control { display: grid; grid-template-columns: minmax(0,1fr) 62px; gap: 4px; min-width: 0; }
.component-fields .component-dimension-control input,.component-fields .component-dimension-control select { min-width: 0; padding-inline: 4px!important; }
.component-fields .component-dimension-control input { appearance: textfield; -moz-appearance: textfield; }
.component-dimension-control input::-webkit-inner-spin-button,.component-dimension-control input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.component-fields .component-dimension-control input:disabled { background: var(--editor-sand, #F7F3EB); color: var(--editor-muted, #566477); }
.component-fields .component-dimension-control select { font-size: .72rem!important; }
.component-fields small { font-size: .65rem; }
.component-settings form > .button { margin-top: 16px; }
.component-editor-panel .component-content-hint { font-size: .72rem; margin-top: 12px; color: var(--editor-muted, #566477); }
.component-position { border-top: 1px solid var(--editor-border, #DCE3EF); padding-top: 13px; margin-top: 16px; }
.component-position > summary { font-size: .78rem; font-weight: 600; cursor: pointer; }
.component-move-buttons { display: flex; gap: 8px; margin-top: 9px; }
.component-move-buttons button { flex: 1; min-height: 40px; border: 1px solid var(--editor-border, #DCE3EF); border-radius: 7px; background: #fff; color: var(--editor-ink, #17202B); font-size: .76rem; }
.component-delete { margin-top: 18px; min-height: 35px; }
.component-editor-error { padding: 11px; border: 1px solid #f0c0b0; border-radius: 10px; background: #fff5f2; color: #8a2f19; font-size: .78rem; margin-block: 12px; }
.inline-format-bar .inline-add-component { background: var(--editor-primary, #245CFF); color: white; margin-inline-start: auto; white-space: nowrap; }
.inline-format-bar .inline-add-component:hover { background: var(--editor-primary, #245CFF); color: white; filter: brightness(.92); }
.inline-canvas .studio-block[data-component-id] { outline-offset: 5px; }
.inline-canvas .studio-block[data-component-id]:hover { outline: 1px dashed var(--editor-border-active, #A9BCFF); }
.inline-canvas .studio-block.is-component-selected { outline: 2px solid var(--editor-primary, #245CFF); }
.inline-canvas .studio-block > .component-handle { position: absolute; top: 3px; inset-inline-end: 3px; z-index: 40; display: flex; align-items: center; gap: 5px; width: auto; max-width: calc(100% - 6px); min-width: 32px; min-height: 30px; padding: 5px 9px; border: 1px solid var(--editor-border, #DCE3EF); border-radius: 6px; background: #fff; color: var(--editor-primary, #245CFF); font-family: Inter,"Tajawal",sans-serif; font-size: 11px; font-weight: 650; line-height: 1.4; letter-spacing: normal; text-transform: none; box-shadow: 0 2px 6px #17202B26; opacity: 0; cursor: grab; touch-action: manipulation; }
.inline-canvas .studio-block:hover > .component-handle,.inline-canvas .studio-block:focus-within > .component-handle,.inline-canvas .studio-block.is-component-selected > .component-handle { opacity: 1; }
.inline-canvas .studio-block > .component-handle:focus-visible { opacity: 1; outline: 3px solid var(--editor-primary, #245CFF); }
.inline-canvas .studio-block > .component-handle:active { cursor: grabbing; }
.inline-canvas .studio-block[data-component-drop=before] { box-shadow: 0 -5px 0 var(--editor-primary, #245CFF); }
.inline-canvas .studio-block[data-component-drop=after] { box-shadow: 0 5px 0 var(--editor-primary, #245CFF); }
.inline-canvas [data-component-drop=end] { outline: 3px dashed var(--editor-primary, #245CFF); outline-offset: -8px; }
.inline-canvas [data-component-drop]::after { content: attr(data-component-drop-label); position: absolute; inset-inline-start: 8px; top: 0; z-index: 50; padding: 3px 10px; border-radius: 5px; color: white; background: var(--editor-primary, #245CFF); font: 600 12px/1.6 Inter,"Tajawal",sans-serif; pointer-events: none; }
.inline-canvas [data-component-drop=after]::after,.inline-canvas [data-component-drop=end]::after { top: auto; bottom: 0; }
.is-component-dragging .inline-canvas .studio-section { outline: 1px dashed var(--editor-border-active, #A9BCFF); outline-offset: -3px; }
@media (min-width: 1001px) { .inline-editor:has(.component-editor-panel) .inline-editor-layout { grid-template-columns: minmax(0,1fr) 290px; } }
@media (max-width: 760px) { .inline-editor:has(.component-editor-panel) .inline-inspector { order: -1; max-height: 540px; overflow-y: auto; } .component-editor-panel { scroll-margin-top: calc(var(--inline-toolbar-height, 184px) + 20px); } .component-library-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } .component-library-item { min-height: 72px; } .component-fields { grid-template-columns: repeat(2,minmax(0,1fr)); } .inline-canvas .studio-block > .component-handle { opacity: 1; min-height: 34px; } }
@media (pointer: coarse) { .inline-canvas .studio-block > .component-handle { opacity: 1; } }

.component-mode-tabs { display: flex; padding: 4px; gap: 4px; background: var(--editor-soft, #EDF2FF); border-radius: 10px; margin-block: 14px; }
.component-mode-tabs button { flex: 1; border: 0; border-radius: 7px; min-height: 44px; background: transparent; color: var(--editor-muted, #566477); font: inherit; font-size: .8rem; cursor: pointer; }
.component-mode-tabs button[aria-selected=true] { background: #fff; color: var(--editor-primary, #245CFF); font-weight: 700; box-shadow: 0 1px 5px #17202B15; }
.component-size-summary { font-size: .8rem; font-weight: 650; color: var(--editor-primary, #245CFF); margin-block: 14px 8px; }
.component-quick-size,.component-ratio-buttons { display: flex; gap: 8px; }
.component-quick-size button,.component-ratio-buttons button { flex: 1; min-height: 44px; border: 1px solid var(--editor-border, #DCE3EF); border-radius: 8px; background: #fff; color: var(--editor-primary, #245CFF); font-size: .78rem; cursor: pointer; }
.component-quick-size button:hover,.component-ratio-buttons button:hover { background: var(--editor-soft, #EDF2FF); }
.component-auto-size { background: transparent; color: var(--editor-muted, #566477); border: 0; min-height: 44px; font-size: .75rem; text-decoration: underline; cursor: pointer; }
.component-beside { padding-block: 12px; border-top: 1px solid var(--editor-border, #DCE3EF); }
.component-beside summary { font-weight: 650; font-size: .8rem; cursor: pointer; }
.component-beside label { font-size: .76rem; }
.component-editor-panel button:focus-visible { outline: 3px solid var(--editor-primary, #245CFF); outline-offset: 2px; }
.component-editor-panel button:disabled { opacity: .5; cursor: default; }
.inline-canvas .studio-block > .component-handle { touch-action: none; }
.component-library-item { touch-action: none; }
.inline-canvas .studio-block > .component-resize { position: absolute; z-index: 45; display: block; padding: 0; margin: 0; border: 2px solid white; background: var(--editor-primary, #245CFF); box-shadow: 0 0 0 1px var(--editor-primary, #245CFF); opacity: 0; touch-action: none; }
.inline-canvas .studio-block > .component-resize--start,.inline-canvas .studio-block > .component-resize--end { top: calc(50% - 16px); width: 12px; height: 32px; min-height: 32px; border-radius: 6px; cursor: ew-resize; }
.inline-canvas .studio-block > .component-resize--start { inset-inline-start: 3px; }
.inline-canvas .studio-block > .component-resize--end { inset-inline-end: 3px; }
.inline-canvas .studio-block > .component-resize--height { bottom: 3px; left: calc(50% - 16px); width: 32px; height: 12px; min-height: 12px; border-radius: 6px; cursor: ns-resize; }
.inline-canvas .studio-block:is(:hover,:focus-within,.is-component-selected) > .component-resize { opacity: 1; }
.inline-canvas .studio-block > .component-resize:focus-visible { opacity: 1; outline: 3px solid var(--editor-primary, #245CFF); outline-offset: 3px; }
.inline-canvas .studio-block[data-component-drop=split] { outline: 2px solid var(--editor-primary, #245CFF); outline-offset: 3px; }
.component-split-preview { position: absolute; inset: 0; display: grid; gap: 5px; padding: 5px; background: #ffffff70; z-index: 44; pointer-events: none; }
.component-split-preview > span { display: flex; align-items: center; justify-content: center; min-width: 0; border: 2px dashed var(--editor-primary, #245CFF); border-radius: 8px; background: #EDF2FFbb; color: var(--editor-ink, #17202B); font: 700 16px/1.5 Inter,"Tajawal",sans-serif; }
.component-split-preview > .is-incoming { border-style: solid; background: #245CFFdc; color: white; }
.inline-canvas :is(.component-handle, .component-split-preview > span):dir(rtl),
.inline-canvas [data-component-drop]:dir(rtl)::after { font-family: "Tajawal",Inter,sans-serif; }
.is-component-dragging .component-resize { visibility: hidden; }
.is-component-resizing { user-select: none; }
.is-component-resizing .inline-canvas .studio-block { transition: none!important; }
@media (pointer: coarse) {
  .inline-canvas .studio-block.is-component-selected > .component-resize--start,.inline-canvas .studio-block.is-component-selected > .component-resize--end { width: 22px; height: 44px; top: calc(50% - 22px); }
  .inline-canvas .studio-block.is-component-selected > .component-resize--height { width: 44px; height: 22px; left: calc(50% - 22px); }
}
@media (prefers-reduced-motion: reduce) { .component-editor-panel * { transition: none!important; } }
