/* ────────── Module DynamicForms : preview mobile + éditeur ────────── */

/* ─── Preview mobile (chrome iOS/Android) ─── */
.dyn-preview {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
}

.dyn-preview-frame {
    width: 380px;
    height: 760px;
    border-radius: 36px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
    position: relative;
    display: flex;
    flex-direction: column;
}

.dyn-preview-landscape .dyn-preview-frame {
    width: 760px;
    height: 380px;
}

.dyn-preview-ios .dyn-preview-frame {
    border: 8px solid #1a1a1a;
}

.dyn-preview-android .dyn-preview-frame {
    border: 6px solid #2c2c2c;
    border-radius: 24px;
}

.dyn-preview-statusbar {
    background: #f8f9fa;
    color: #1a1a1a;
    font-size: 11px;
    padding: 6px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.dyn-preview-titlebar {
    background: #fff;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.dyn-preview-titlebar i {
    font-size: 18px;
    color: #6c757d;
}

.dyn-preview-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
}

.dyn-preview-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f5f5f7;
}

.dyn-preview-empty {
    text-align: center;
    color: #adb5bd;
    padding: 60px 20px;
}

.dyn-preview-empty i {
    font-size: 42px;
    display: block;
    margin-bottom: 8px;
}

.dyn-preview-homebar {
    height: 5px;
    width: 130px;
    background: #1a1a1a;
    border-radius: 3px;
    margin: 8px auto;
    opacity: 0.6;
}

.dyn-preview-controls {
    display: flex;
    gap: 6px;
}

.dyn-preview-controls .form-select {
    width: auto;
}

/* ─── Section dans la preview ─── */
.dyn-section {
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.dyn-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.dyn-section-title {
    margin: 0;
    flex: 1;
    font-size: 14px;
    font-weight: 600;
}

.dyn-section-badge {
    font-size: 9px;
    padding: 2px 6px;
}

.dyn-section-description {
    color: #6c757d;
    font-size: 11px;
    margin: 0 0 8px 0;
}

.dyn-section-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dyn-subsection {
    border-left: 3px solid #dee2e6;
    margin-left: 6px;
    padding-left: 8px;
    margin-top: 8px;
}

.dyn-repeatable-item {
    border: 1px dashed #ced4da;
    border-radius: 6px;
    padding: 8px;
    background: #f8f9fa;
}

.dyn-repeatable-header {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.dyn-repeatable-counter {
    font-weight: 600;
    color: #495057;
    font-size: 11px;
    flex: 1;
}

/* ─── Champs mobile ─── */
.dyn-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dyn-field-label {
    font-size: 12px;
    font-weight: 500;
    color: #212529;
}

.dyn-required {
    color: #dc3545;
    margin-left: 2px;
}

.dyn-field-description {
    font-size: 10px;
    color: #6c757d;
    margin-bottom: 2px;
}

.dyn-input {
    width: 100%;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    background: #fff;
    color: #495057;
}

.dyn-input-multiline {
    resize: vertical;
    min-height: 60px;
}

.dyn-input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.dyn-unit {
    position: absolute;
    right: 10px;
    color: #6c757d;
    font-size: 11px;
    pointer-events: none;
}

.dyn-radio-group,
.dyn-checkbox-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dyn-radio-option,
.dyn-checkbox-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    cursor: not-allowed;
    color: #495057;
}

.dyn-calculated {
    background: #f8f9fa;
    border: 1px dashed #ced4da;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 11px;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dyn-calculated code {
    background: transparent;
    color: #0d6efd;
    font-size: 11px;
}

.dyn-placeholder {
    background: #f8f9fa;
    border: 1px dashed #ced4da;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    color: #6c757d;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dyn-placeholder i {
    font-size: 18px;
}

.dyn-placeholder-large {
    padding: 24px;
    flex-direction: column;
}

.dyn-placeholder-large i {
    font-size: 28px;
}

/* ─── Wizard ─── */
.dyn-progress {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    margin-bottom: 10px;
    overflow: hidden;
}

.dyn-progress-bar {
    height: 100%;
    background: #198754;
    transition: width 0.2s ease;
}

.dyn-wizard-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    gap: 8px;
}

.dyn-wizard-counter {
    font-size: 11px;
    color: #6c757d;
}

/* ─── Éditeur (FormEdit.razor) ─── */
.dyn-editor-page {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: calc(100vh - 60px);
    overflow: hidden;
}

.dyn-editor-page .tab-content {
    flex: 1;
    overflow: auto;
    background: #f8f9fa;
}

.dyn-editor-page .nav-tabs {
    flex-shrink: 0;
}

.dyn-editor-page .nav-tabs .nav-link {
    background: transparent;
    border-color: transparent;
    color: #495057;
    font-size: 13px;
}

.dyn-editor-page .nav-tabs .nav-link.active {
    background: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
    color: #0d6efd;
    font-weight: 500;
}

.dyn-editor {
    display: grid;
    grid-template-columns: 220px 1fr 360px;
    grid-template-rows: 1fr;
    gap: 12px;
    height: 100%;
    min-height: 600px;
}

.dyn-editor-toolbar {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dyn-palette {
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    overflow-y: auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dyn-palette h6 {
    font-size: 11px;
    text-transform: uppercase;
    color: #6c757d;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.dyn-palette-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.dyn-palette-btn {
    border: 1px solid #dee2e6;
    background: #fff;
    border-radius: 6px;
    padding: 8px 4px;
    font-size: 10px;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
}

.dyn-palette-btn:hover {
    background: #e7f1ff;
    border-color: #86b7fe;
}

.dyn-palette-btn .dyn-palette-icon {
    font-size: 18px;
    display: block;
    margin-bottom: 2px;
    color: #0d6efd;
}

.dyn-structure {
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    overflow-y: auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dyn-structure ul {
    list-style: none;
    padding-left: 12px;
    margin: 0;
}

.dyn-structure-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 2px;
}

.dyn-structure-item:hover {
    background: #f1f3f5;
}

.dyn-structure-item.selected {
    background: #cfe2ff;
}

.dyn-structure-item.dyn-section-node {
    font-weight: 600;
}

.dyn-structure-handle {
    cursor: grab;
    color: #adb5bd;
    font-size: 12px;
}

.dyn-structure-handle:active {
    cursor: grabbing;
}

.dyn-properties {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    overflow-y: auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dyn-properties h6 {
    font-size: 12px;
    text-transform: uppercase;
    color: #6c757d;
    letter-spacing: 0.5px;
    margin-top: 10px;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #f1f3f5;
}

.dyn-properties .form-label {
    font-size: 12px;
    margin-bottom: 2px;
    font-weight: 500;
}

/* ─── Validation panel ─── */
.dyn-lint-panel {
    background: #fff;
    border-radius: 8px;
    padding: 8px;
    max-height: 220px;
    overflow-y: auto;
    margin-top: 8px;
}

.dyn-lint-issue {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    margin-bottom: 2px;
}

.dyn-lint-issue:hover {
    background: #f1f3f5;
}

.dyn-lint-issue-error i {
    color: #dc3545;
}

.dyn-lint-issue-warning i {
    color: #fd7e14;
}

/* ─── Sub-sections ─── */
.dyn-subsections {
    list-style: none;
    padding-left: 16px;
    margin: 4px 0 0 0;
    border-left: 2px dashed #dee2e6;
}

.dyn-structure-subsection {
    margin-bottom: 4px;
}

.dyn-sub-section-node {
    font-weight: 500;
    font-style: italic;
    color: #495057;
}

/* ─── Drag-drop visuel ─── */
.dyn-drag-ghost {
    opacity: 0.4;
    background: #e7f1ff !important;
}

/* ─── Editors imbriqués (Rules / References / Dashboard) ─── */
.dyn-rules-editor,
.dyn-references-editor,
.dyn-dashboard-configurator {
    background: #fff;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.dyn-rules-editor table,
.dyn-references-editor table,
.dyn-dashboard-configurator table {
    margin-bottom: 0;
}

.dyn-rules-editor h6,
.dyn-references-editor h6,
.dyn-dashboard-configurator h6 {
    color: #1f4e79;
    font-size: 14px;
    margin: 0;
}

.dyn-rules-editor details {
    margin-top: 12px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.dyn-rules-editor details summary {
    cursor: pointer;
    font-weight: 500;
    user-select: none;
}

/* ─── Réponse — bandeau métadonnées ─── */
.dyn-response-meta {
    background: #f8f9fa;
    border-left: 4px solid #0d6efd;
}

.dyn-response-meta code {
    background: rgba(13, 110, 253, 0.08);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.85em;
}

/* ─── ResponseView ─── */
.dyn-response-section {
    background: #fff;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.dyn-response-section h5 {
    margin-bottom: 12px;
    color: #1f4e79;
    font-size: 16px;
}

.dyn-response-occurrence {
    border-left: 3px solid #cfe2ff;
    padding-left: 12px;
    margin-bottom: 12px;
}

.dyn-response-occurrence-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
    font-size: 13px;
}
