/* =========================================================
   Sectie-editor — JobSectionEditorRenderer
   ========================================================= */

.section-editor-root {
    display: grid;
    grid-template-columns: 360px 1fr 260px;
    gap: 0;
    height: 70vh;
    min-height: 500px;
    border: 1px solid var(--dxbl-grid-border-color, #dee2e6);
    border-radius: 8px;
    overflow: hidden;
    background: var(--dxbl-back-color, #fff);
    position: relative;
}

/* Slide-in paneel met geavanceerde container-stijl (rand, marge, padding) — schuift vanaf rechts
   over de preview-kolom heen, lijst + inhoud-paneel blijven altijd zichtbaar en klikbaar. Opent
   alleen via de expliciete "Geavanceerd"-knop bovenin het inhoud-paneel. */
.section-editor-settings-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, calc(100% - 360px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--dxbl-back-color, #fff);
    border-left: 1px solid var(--dxbl-grid-border-color, #dee2e6);
    box-shadow: -6px 0 18px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 20;
}

.section-editor-settings-drawer.open { transform: translateX(0); }

/* Onzichtbare klik-vanger onder het slide-in paneel — ligt over lijst/inhoud/preview heen zodat
   een klik ernaast (buiten het paneel zelf) het paneel sluit; het paneel zelf ligt er met een
   hogere z-index overheen, dus klikken in het paneel bereiken deze laag niet. */
.section-editor-drawer-backdrop {
    position: absolute;
    inset: 0;
    z-index: 19;
    background: transparent;
}

.section-drawer-close-btn { margin-left: auto; }
.section-advanced-btn { margin-left: auto; }

/* --- Linker paneel: lijst --- */
.section-editor-list-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--dxbl-grid-border-color, #dee2e6);
    overflow: hidden;
}

.section-editor-list-header {
    padding: 12px 12px 8px;
    border-bottom: 1px solid var(--dxbl-grid-border-color, #dee2e6);
    background: var(--dxbl-toolbar-bg, #f8f9fa);
}

.section-editor-list-title {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--dxbl-text-color, #212529);
}

.section-editor-add-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.section-editor-type-combo { flex: 1; min-width: 0; }
.section-editor-add-btn { flex-shrink: 0; }

.section-editor-sortable {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.section-editor-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    user-select: none;
    border-left: 3px solid transparent;
    transition: background 0.15s;
}

.section-editor-item:hover { background: var(--dxbl-listbox-item-hover-bg, #f0f4ff); }

.section-editor-item.selected {
    background: var(--dxbl-listbox-item-selected-bg, #e8eeff);
    border-left-color: var(--dxbl-btn-primary-bg, #4263eb);
}

.section-editor-item.hidden-section { opacity: 0.55; }

.section-editor-item.drag-over {
    background: #dbeafe;
    border-left-color: #3b82f6;
}

.section-drag-handle { cursor: grab; color: #adb5bd; font-size: 16px; }
.section-editor-item-drag { flex-shrink: 0; }
.section-editor-item-icon { flex-shrink: 0; font-size: 16px; color: var(--dxbl-btn-primary-bg, #4263eb); }

.section-editor-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.section-item-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6c757d;
    letter-spacing: 0.03em;
}

.section-item-title {
    font-size: 13px;
    color: var(--dxbl-text-color, #212529);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-editor-item-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* Zichtbaar-toggle, deelnemer-toggle (of de lege placeholder als een sectietype die niet heeft)
   krijgen allemaal dezelfde vaste breedte, zodat de prullenbak-knop bij elke rij op dezelfde
   horizontale positie staat, ongeacht welk type sectie het is. */
.section-visibility-toggle,
.section-participant-toggle,
.section-participant-toggle-placeholder {
    width: 20px;
    flex: 0 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.section-editor-empty {
    padding: 24px 16px;
    text-align: center;
    color: #6c757d;
    font-size: 13px;
}

.section-empty-icon { font-size: 32px; display: block; margin-bottom: 8px; opacity: 0.4; }

.section-editor-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--dxbl-grid-border-color, #dee2e6);
    background: var(--dxbl-toolbar-bg, #f8f9fa);
    font-size: 12px;
    color: #6c757d;
}

.section-editor-info-icon { font-size: 16px; flex-shrink: 0; }

/* --- Midden paneel: instellingen --- */
.section-editor-settings-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--dxbl-grid-border-color, #dee2e6);
}

.section-editor-settings-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    padding: 32px;
    text-align: center;
}

.section-settings-placeholder-icon { font-size: 40px; opacity: 0.3; margin-bottom: 12px; display: block; }

.section-editor-settings-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid var(--dxbl-grid-border-color, #dee2e6);
    background: var(--dxbl-toolbar-bg, #f8f9fa);
}

.section-editor-settings-body { flex: 1; overflow-y: auto; padding: 16px; }

.section-editor-settings-header--sub {
    margin: 20px -16px 14px;
    padding: 8px 16px;
    font-size: 13px;
}

.section-settings-grid { display: flex; flex-direction: column; gap: 14px; }

.section-settings-field { display: flex; flex-direction: column; gap: 1px; }

.section-settings-field label { font-size: 12px; font-weight: 600; color: #6c757d; }

.section-settings-checkbox { flex-direction: row; align-items: center; gap: 8px; }

.section-settings-reset-btn { padding: 0 4px; font-size: 12px; white-space: nowrap; }

/* Gegroepeerde, omkaderde instellingenblokken (bv. Rand, Padding, Marge) met velden naast elkaar
   i.p.v. onder elkaar — schermruimte in het midden-paneel is breed genoeg daarvoor. */
.section-settings-groups-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.section-settings-groups-row > .section-settings-group {
    flex: 1 1 260px;
    min-width: 260px;
}

.section-settings-group {
    border: 1px solid var(--dxbl-grid-border-color, #dee2e6);
    border-radius: 8px;
    padding: 12px 14px 14px;
}

.section-settings-group-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    margin-bottom: 10px;
}

.section-settings-group + .section-settings-group { margin-top: 14px; }

.section-settings-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.section-settings-row > .section-settings-field {
    flex: 1 1 130px;
    min-width: 130px;
}

/* Hoogte van alle DxHtmlEditor-instanties in de sectie-editor settings panels — hier centraal aanpasbaar. */
.section-html-editor,
.section-html-editor .dxbl-html-editor-content-container {
    height: 600px;
}

/* Alleen het echte tekst-canvas (Quill's .ql-editor) krijgt de achtergrondkleur — niet .section-html-editor
   zelf, want dat is de hele editor inclusief de werkbalk (font/size/bold-knoppen etc.). */
.section-html-editor .ql-editor.dx-htmleditor-content {
    background-color: var(--section-editor-bg, transparent);
}

.section-settings-info {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    color: #6c757d;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px 10px;
}

/* --- Rechter paneel: preview --- */
.section-editor-preview-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f8f9fa;
}

.section-editor-preview-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid var(--dxbl-grid-border-color, #dee2e6);
    background: var(--dxbl-toolbar-bg, #f8f9fa);
    color: #495057;
}

.section-editor-preview-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.section-preview-card {
    position: relative;
    display: flex;
    background: #fff;
    border-radius: 6px;
    border: 2px solid transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.section-preview-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }

.section-preview-card.section-preview-active {
    border-color: var(--dxbl-btn-primary-bg, #4263eb);
    box-shadow: 0 0 0 3px rgba(66,99,235,0.12);
}

.section-preview-card.section-preview-hidden { opacity: 0.5; }

.section-preview-stripe { width: 4px; flex-shrink: 0; }
.section-preview-stripe--hero    { background: #7c3aed; }
.section-preview-stripe--highlight { background: #dc2626; }
.section-preview-stripe--navigation { background: #0d9488; }
.section-preview-stripe--gallery { background: #059669; }
.section-preview-stripe--chapter { background: #2563eb; }
.section-preview-stripe--text    { background: #d97706; }
.section-preview-stripe--divider { background: #6b7280; }

.section-preview-card-inner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    flex: 1;
    min-width: 0;
}

.section-preview-card-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; color: #6c757d; }

.section-preview-card-content { flex: 1; min-width: 0; }

.section-preview-type {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9ca3af;
}

.section-preview-title {
    font-size: 13px;
    font-weight: 600;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-preview-desc {
    font-size: 11px;
    color: #6c757d;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-preview-hidden-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 10px;
    background: #e9ecef;
    color: #6c757d;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
}

.section-preview-empty { padding: 24px; text-align: center; color: #9ca3af; font-size: 12px; }

/* =========================================================
   Gallery Image Picker
   ========================================================= */

.gallery-picker-root {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--dxbl-grid-border-color, #dee2e6);
    border-radius: 6px;
    overflow: hidden;
    max-height: 520px;
}

.gallery-picker-body {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.9fr);
    gap: 12px;
    padding: 0 10px 10px;
    min-height: 0;
    flex: 1;
}

.gallery-picker-grid-wrap {
    min-width: 0;
    min-height: 0;
}

.gallery-picker-loading,
.gallery-picker-empty {
    padding: 16px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

.gallery-picker-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--dxbl-grid-border-color, #dee2e6);
    flex-shrink: 0;
}

.gallery-picker-count {
    font-size: 12px;
    color: #495057;
}

.gallery-picker-toolbar-actions {
    display: flex;
    gap: 6px;
}

.gallery-picker-btn {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--dxbl-btn-primary-bg, #4263eb);
    background: var(--dxbl-btn-primary-bg, #4263eb);
    color: #fff;
    cursor: pointer;
    transition: opacity 0.15s;
}

.gallery-picker-btn:hover { opacity: 0.85; }

.gallery-picker-btn--ghost {
    background: transparent;
    color: #6c757d;
    border-color: #ced4da;
}

.gallery-picker-btn--ghost:hover { background: #f1f3f5; opacity: 1; }

.gallery-picker-preview {
    min-height: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(180deg, #f8f9fa 0%, #eef2f6 100%);
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-picker-preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.gallery-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    overflow-y: auto;
    align-content: start;
    padding-right: 4px;
    max-height: 100%;
}

.gallery-picker-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.08);
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.gallery-picker-thumb:hover {
    transform: none;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.14);
}

.gallery-picker-thumb.selected {
    border-color: var(--dxbl-btn-primary-bg, #4263eb);
    box-shadow: inset 0 0 0 3px rgba(66, 99, 235, 0.28), 0 1px 3px rgba(0,0,0,0.08);
}

.gallery-picker-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #f8f9fa;
}

.gallery-picker-thumb:hover .gallery-picker-img {
    transform: none;
}

.gallery-picker-check {
    position: absolute;
    inset: 0;
    background: rgba(66, 99, 235, 0.35);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 3px;
}

.gallery-picker-check .dx-icon-check {
    color: #fff;
    font-size: 14px;
    background: var(--dxbl-btn-primary-bg, #4263eb);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navigation-targets-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.navigation-targets-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: start;
    column-gap: 10px;
    row-gap: 2px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    background: #fff;
}

.navigation-targets-item.selected {
    border-color: var(--dxbl-btn-primary-bg, #4263eb);
    box-shadow: 0 0 0 2px rgba(66,99,235,0.12);
}

.navigation-targets-item input {
    margin-top: 2px;
}

.navigation-targets-item__title {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
}

.navigation-targets-item__meta {
    grid-column: 2;
    font-size: 11px;
    color: #6b7280;
}

@media (max-width: 900px) {
    .gallery-picker-body {
        grid-template-columns: 1fr;
    }

    .gallery-picker-preview {
        min-height: 180px;
        max-height: 220px;
    }

    .gallery-picker-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .gallery-picker-thumb:hover {
        transform: none;
    }

    .gallery-picker-thumb:hover .gallery-picker-img {
        transform: none;
    }
}
