/* Global ScreenFlowLayoutEditor styles (not CSS-isolated).
   Scoped .razor.css does not apply to markup built via RenderFragment. */

.flow-editor-canvas {
    overflow-x: auto;
    padding: 1rem 1rem 1.25rem;
    background-color: var(--bs-body-bg, #fff);
}

.flow-editor-group > .screen-row {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

.flow-editor-canvas > .flow-editor-group > .screen-row > [class*="col"] {
    /* Keep page columns wide enough for chrome + labels; wrap rather than crush. */
    min-width: 16rem;
    max-width: 100%;
}

.flow-editor-group-nested > .screen-row > [class*="col"] {
    min-width: 0;
    max-width: 100%;
}

.flow-drop-zone {
    min-height: 0;
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    border: 2px dashed transparent;
    border-radius: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: min-height 0.1s ease, max-height 0.1s ease, opacity 0.1s ease, margin 0.1s ease, border-color 0.1s ease, background-color 0.1s ease;
}

.flow-drop-zone-label {
    font-size: 0.7rem;
    color: transparent;
    user-select: none;
}

.flow-editor-canvas.is-dragging .flow-drop-zone {
    min-height: 1.6rem;
    max-height: 2.5rem;
    margin: 0.2rem 0;
    opacity: 1;
    pointer-events: auto;
    border-color: rgba(13, 110, 253, 0.35);
    background-color: rgba(13, 110, 253, 0.04);
}

.flow-editor-canvas.is-dragging .flow-drop-zone .flow-drop-zone-label {
    color: var(--bs-primary, #0d6efd);
}

.flow-drop-zone-active,
.flow-editor-canvas.is-dragging .flow-drop-zone-active,
.flow-editor-canvas.is-dragging .flow-drop-zone:hover {
    min-height: 2rem;
    max-height: 3rem;
    border-color: var(--bs-primary, #0d6efd);
    background-color: rgba(13, 110, 253, 0.14);
}

.flow-drop-zone-active .flow-drop-zone-label,
.flow-editor-canvas.is-dragging .flow-drop-zone:hover .flow-drop-zone-label {
    color: var(--bs-primary, #0d6efd);
    font-weight: 600;
}

/* Preview chrome sits in document flow so it never covers labels or inputs. */
.flow-preview-item {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-radius: 0.35rem;
    padding: 0.35rem 0.4rem;
    transition: background-color 0.12s ease, box-shadow 0.12s ease, outline-color 0.12s ease;
}

.flow-preview-field {
    width: 100%;
}

.flow-preview-item:hover,
.flow-preview-item:focus-within {
    outline: 1px dashed rgba(13, 110, 253, 0.45);
    outline-offset: 0;
}

.flow-preview-dragging {
    opacity: 0.45;
    outline: 1px dashed var(--bs-primary, #0d6efd);
}

.flow-preview-highlight {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.28);
    outline: 2px solid var(--bs-primary, #0d6efd);
}

.flow-preview-chrome {
    position: static;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem;
    width: 100%;
    margin: 0 0 0.4rem;
    padding: 0.15rem;
    border-radius: 0.4rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    background: var(--bs-body-bg, #fff);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    pointer-events: auto;
}

.flow-preview-chrome > * {
    flex: 0 0 auto;
}

.flow-preview-handle,
.flow-preview-handle * {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    color: var(--bs-secondary, #6c757d);
    cursor: grab !important;
    user-select: none;
    -webkit-user-drag: element;
    border-radius: 0.25rem;
}

.flow-preview-handle:active,
.flow-preview-handle:active * {
    cursor: grabbing !important;
}

.flow-preview-handle:hover {
    color: var(--bs-body-color, #212529);
    background: var(--bs-secondary-bg, #e9ecef);
}

.flow-preview-handle i {
    width: auto;
    height: auto;
    pointer-events: none;
}

.flow-preview-span {
    width: auto;
    min-width: 5.75rem;
    max-width: 100%;
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
    font-size: 0.75rem;
}

.flow-preview-chrome .btn {
    padding: 0.15rem 0.4rem;
    line-height: 1.2;
}

/* Column — no panel chrome; fields carry the light backdrop */
.flow-preview-column {
    width: 100%;
}

.flow-preview-column-title {
    min-width: 0;
}

.flow-editor-canvas .screen-flow-panel-heading {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #212529;
    line-height: 1.3;
    margin: 0 0 0.75rem;
    padding: 0 0 0.4rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.flow-editor-canvas .screen-flow-panel-heading-input {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #212529;
    line-height: 1.3;
    margin: 0 0 0.75rem;
    padding: 0.25rem 0.4rem 0.35rem;
    border: 1px solid transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 0.25rem;
    background: transparent;
    box-shadow: none;
}

.flow-editor-canvas .screen-flow-panel-heading-input:hover:not(:disabled),
.flow-editor-canvas .screen-flow-panel-heading-input:focus {
    border-color: rgba(13, 110, 253, 0.45);
    background: #fff;
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.12);
    outline: 0;
}

.flow-editor-canvas .screen-flow-panel-heading-input::placeholder {
    font-weight: 500;
    color: #adb5bd;
}

.flow-editor-canvas .compact-label {
    margin-bottom: 0.2rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #495057;
    overflow-wrap: break-word;
    word-break: normal;
}

.flow-preview-column-body {
    min-height: 1.5rem;
}

.flow-preview-field .control-wrapper {
    min-width: 0;
    padding: 0.55rem 0.7rem 0.6rem;
    margin-bottom: 0.65rem;
    border-radius: 0.4rem;
    background-color: #f5f6f8;
}

.flow-preview-faux {
    pointer-events: none;
    background-color: var(--bs-secondary-bg, #e9ecef);
    border-style: solid;
    color: var(--bs-secondary-color, #6c757d) !important;
    min-height: calc(1.5em + 0.5rem + 2px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flow-preview-faux-textarea {
    min-height: 4.25rem;
    white-space: pre-wrap;
    text-overflow: unset;
}

.flow-preview-readonly {
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
    color: #212529;
    min-height: calc(1.5em + 0.25rem);
}

.flow-editor-canvas .control-wrapper-readonly {
    background-color: transparent;
    border-style: dashed;
}

.flow-editor-group-nested {
    min-height: 0.5rem;
}

.flow-editor-panel-empty {
    border: 1px dashed rgba(13, 110, 253, 0.45);
    border-radius: 0.35rem;
    padding: 0.65rem 0.5rem;
    color: var(--bs-secondary, #6c757d);
    font-size: 0.75rem;
    text-align: center;
    margin-bottom: 0.35rem;
}
