/* 
==========================================================================
JSON Form Editor - Bootstrap Standard Design
Version: 4.0.0 (Bootstrap Style)
==========================================================================

BOOTSTRAP STANDARD DESIGN:
- Flache Farben (keine Gradients)
- Standard Bootstrap Farbpalette
- Klare Schatten und Borders
- Minimale Animationen
- Professionelles, sauberes Design
*/

/* ========== GLOBAL RESET ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #f8f9fa;
}

/* FIX: Statt globaler Überschreibung von .container / .container-fluid
   (die sonst auch die MainLayout-Wrapper trifft und das Gesamt-Layout bricht)
   wird hier eine spezifische Klasse für den Form-Designer-Workspace verwendet.
   Die Höhe ist robust gegen Header-Wraps, Layer-Bar etc. - min-height stellt
   sicher dass der Workspace immer gut sichtbar ist. */
.form-designer-workspace {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 320px);
    min-height: 600px;
    width: 100%;
    gap: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
    background: #f8f9fa;
}

/* ========== TOOLBOX (FESTE BREITE) ========== */
.toolbox {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    background: #ffffff;
    border-right: 1px solid #dee2e6;
    color: #212529;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    flex-grow: 0;
    flex-basis: 280px;
}

    .toolbox::-webkit-scrollbar {
        width: 8px;
    }

    .toolbox::-webkit-scrollbar-track {
        background: #f8f9fa;
    }

    .toolbox::-webkit-scrollbar-thumb {
        background: #ced4da;
        border-radius: 4px;
    }

        .toolbox::-webkit-scrollbar-thumb:hover {
            background: #adb5bd;
        }

    .toolbox h2 {
        font-size: 12px;
        font-weight: 700;
        margin-bottom: 12px;
        padding-bottom: 8px;
        border-bottom: 1px solid #dee2e6;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #6c757d;
    }

.toolbox-section {
    margin-bottom: 24px;
}

.toolbox-item {
    background: #ffffff;
    padding: 12px 14px;
    margin: 8px 0;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: move;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    user-select: none;
    font-size: 14px;
    font-weight: 500;
    color: #212529;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

    .toolbox-item:hover {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border-color: #007bff;
        box-shadow: 0 4px 8px rgba(0, 123, 255, 0.12);
        transform: translateX(4px);
    }

    .toolbox-item:active {
        transform: translateX(2px) scale(0.98);
    }

    .toolbox-item:active {
        background: #dee2e6;
    }

/* ========== CANVAS CONTAINER ========== */
.canvas-container {
    flex: 1 1 auto;
    min-width: 0; /* Wichtig für Flex-Overflow */
    min-height: 0; /* Wichtig für Flex-Shrinking der Höhe */
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f8f9fa;
}

    .canvas-container::-webkit-scrollbar {
        width: 10px;
    }

    .canvas-container::-webkit-scrollbar-track {
        background: #f8f9fa;
    }

    .canvas-container::-webkit-scrollbar-thumb {
        background: #ced4da;
        border-radius: 4px;
    }

        .canvas-container::-webkit-scrollbar-thumb:hover {
            background: #adb5bd;
        }

/* ========== CANVAS HEADER ========== */
.canvas-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 24px 28px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 2px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

    .canvas-header h1 {
        font-size: 26px;
        font-weight: 700;
        color: #212529;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 10px;
    }

.btn-group {
    display: flex;
    gap: 8px;
}

/* ========== BOOTSTRAP BUTTONS ========== */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

    .btn:focus {
        outline: 0;
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
    }

    .btn:active {
        transform: translateY(1px);
    }

    .btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
    }

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: #ffffff;
}

    .btn-primary:hover {
        background: linear-gradient(135deg, #0069d9 0%, #004494 100%);
    }

    .btn-primary:focus {
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
    }

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: #ffffff;
}

    .btn-success:hover {
        background: linear-gradient(135deg, #218838 0%, #155724 100%);
    }

    .btn-success:focus {
        box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.3);
    }

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #bd2130 100%);
    color: #ffffff;
}

    .btn-danger:hover {
        background: linear-gradient(135deg, #c82333 0%, #a71d2a 100%);
    }

    .btn-danger:focus {
        box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.3);
    }

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
    color: #ffffff;
}

    .btn-secondary:hover {
        background: linear-gradient(135deg, #5a6268 0%, #3e444a 100%);
    }

    .btn-secondary:focus {
        box-shadow: 0 0 0 3px rgba(108, 117, 125, 0.3);
    }

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
}

    .btn-warning:hover {
        background: linear-gradient(135deg, #e0a800 0%, #c69500 100%);
    }

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #117a8b 100%);
    color: #ffffff;
}

    .btn-info:hover {
        background: linear-gradient(135deg, #138496 0%, #0e6674 100%);
    }

border-color: #117a8b;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* ========== CANVAS ========== */
.canvas {
    background: #ffffff;
    min-height: 600px;
    width: 100%;
    padding: 30px;
    border-radius: 4px;
    border: 2px dashed #dee2e6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

    .canvas.drag-over {
        border-color: #007bff;
        background-color: rgba(0, 123, 255, 0.05);
    }

.canvas-empty {
    text-align: center;
    padding: 100px 20px;
    color: #6c757d;
}

    .canvas-empty i {
        font-size: 48px;
        margin-bottom: 16px;
        opacity: 0.5;
    }

    .canvas-empty h3 {
        font-size: 20px;
        font-weight: 600;
        margin-bottom: 8px;
        color: #495057;
    }

    .canvas-empty p {
        font-size: 14px;
        color: #6c757d;
    }

/* ========== FORM ELEMENTS ========== */
.form-element {
    background: #ffffff;
    padding: 20px;
    margin: 16px 0;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

    .form-element:hover {
        border-color: #007bff;
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.12);
        transform: translateY(-2px);
    }

    .form-element.draggable {
        cursor: move;
    }

    .form-element.dragging {
        opacity: 0.5;
        transform: rotate(2deg) scale(0.95);
        box-shadow: 0 8px 20px rgba(0, 123, 255, 0.3);
        border-color: #007bff;
        border-style: dashed;
    }
    
    .form-element.drag-over {
        border-color: #28a745;
        border-style: solid;
        border-width: 3px;
        background-color: rgba(40, 167, 69, 0.05);
        transform: scale(1.02);
    }

/* Drag Placeholder */
.drag-placeholder {
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.1) 0%, rgba(0, 123, 255, 0.05) 100%);
    border: 2px dashed #007bff;
    border-radius: 8px;
    padding: 20px;
    margin: 12px 0;
    text-align: center;
    animation: pulse 1.5s ease-in-out infinite;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-placeholder-text {
    color: #007bff;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

    .form-element.selected {
        border-color: #007bff;
        background-color: rgba(0, 123, 255, 0.03);
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15), 0 4px 12px rgba(0, 123, 255, 0.15);
    }

.element-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.element-type {
    font-weight: 600;
    color: #007bff;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.element-label {
    font-weight: 500;
    color: #212529;
    margin-bottom: 8px;
    font-size: 14px;
}

.element-scope {
    font-size: 11px;
    color: #6c757d;
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 6px;
    margin-top: 8px;
    display: inline-block;
}

.element-preview {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

    .element-preview input,
    .element-preview select,
    .element-preview textarea {
        width: 100%;
        padding: 10px 14px;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        font-size: 14px;
        background: #ffffff;
        transition: all 0.2s ease;
    }

        .element-preview input:focus,
        .element-preview select:focus,
        .element-preview textarea:focus {
            outline: none;
            border-color: #007bff;
            box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
        }

    .element-preview label {
        display: block;
        margin-bottom: 6px;
        font-size: 13px;
        font-weight: 500;
        color: #495057;
    }

/* ========== PROPERTIES PANEL ========== */
.properties {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    background: #ffffff;
    border-left: 1px solid #dee2e6;
    padding: 24px;
    overflow-y: auto;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    flex-grow: 0;
    flex-basis: 280px;
}

    .properties::-webkit-scrollbar {
        width: 8px;
    }

    .properties::-webkit-scrollbar-track {
        background: #f8f9fa;
    }

    .properties::-webkit-scrollbar-thumb {
        background: #ced4da;
        border-radius: 4px;
    }

    .properties h2 {
        font-size: 20px;
        font-weight: 700;
        margin-bottom: 24px;
        color: #212529;
        padding-bottom: 16px;
        border-bottom: 2px solid #e9ecef;
        display: flex;
        align-items: center;
        gap: 8px;
    }

/* Property Group - Bessere Gruppierung */
.property-group {
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

    .property-group:hover {
        background: #f0f3f5;
        border-color: #dee2e6;
    }

    /* Spezielle Styles f�r die Sichtbarkeits-Sektion */
    .property-group[style*="border-top"] {
        background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
        border: 2px solid #e3e8ff;
        padding: 20px;
        margin-top: 24px;
    }

        .property-group[style*="border-top"] h3 {
            font-size: 15px;
            font-weight: 700;
            margin-bottom: 16px;
            color: #495057;
            display: flex;
            align-items: center;
            gap: 8px;
        }

    .property-group label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
        font-size: 13px;
        color: #495057;
        letter-spacing: 0.2px;
    }

    .property-group input[type="text"],
    .property-group input[type="number"],
    .property-group input[type="email"],
    .property-group select,
    .property-group textarea {
        width: 100%;
        padding: 10px 14px;
        font-size: 14px;
        line-height: 1.5;
        color: #495057;
        background-color: #ffffff;
        border: 2px solid #dee2e6;
        border-radius: 10px;
        transition: all 0.2s ease;
        font-family: inherit;
    }

        .property-group input[type="text"]:focus,
        .property-group input[type="number"]:focus,
        .property-group input[type="email"]:focus,
        .property-group select:focus,
        .property-group textarea:focus {
            color: #495057;
            background-color: #ffffff;
            border-color: #007bff;
            outline: 0;
            box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
        }

        .property-group input[type="text"]:hover,
        .property-group input[type="number"]:hover,
        .property-group input[type="email"]:hover,
        .property-group select:hover,
        .property-group textarea:hover {
            border-color: #adb5bd;
        }

    .property-group textarea {
        resize: vertical;
        min-height: 80px;
    }

    .property-group small {
        display: block;
        margin-top: 6px;
        font-size: 12px;
        color: #6c757d;
        line-height: 1.4;
    }

    /* Checkbox Styling */
    .property-group input[type="checkbox"] {
        width: 18px;
        height: 18px;
        margin-right: 8px;
        cursor: pointer;
        border-radius: 4px;
        border: 2px solid #dee2e6;
        transition: all 0.2s ease;
    }

        .property-group input[type="checkbox"]:checked {
            background-color: #007bff;
            border-color: #007bff;
        }

        .property-group input[type="checkbox"]:focus {
            outline: none;
            box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
        }

    .property-group label:has(input[type="checkbox"]) {
        display: flex;
        align-items: center;
        cursor: pointer;
        margin-bottom: 0;
    }

    /* Aktive Regel Box */
    .property-group div[style*="background: #f5f5f5"] {
        background: linear-gradient(135deg, #fff9f0 0%, #fff5e6 100%) !important;
        border: 2px solid #ffe4c4 !important;
        border-radius: 10px !important;
        padding: 12px !important;
    }

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #495057;
    letter-spacing: 0.2px;
}

.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: #495057;
    background-color: #ffffff;
    background-clip: padding-box;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    transition: all 0.2s ease;
}

    .form-control:focus,
    .form-select:focus {
        color: #495057;
        background-color: #ffffff;
        border-color: #007bff;
        outline: 0;
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    }

    .form-control:hover,
    .form-select:hover {
        border-color: #adb5bd;
    }

.form-check {
    display: flex;
    align-items: center;
    padding-left: 0;
    margin-bottom: 8px;
}

.form-check-input {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: top;
    background-color: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 2px;
    cursor: pointer;
}

    .form-check-input:checked {
        background-color: #007bff;
        border-color: #007bff;
    }

    .form-check-input:focus {
        border-color: #80bdff;
        outline: 0;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }

.form-check-label {
    font-size: 14px;
    color: #495057;
    cursor: pointer;
}

/* ========== ALERT MESSAGES ========== */
.alert {
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 14px;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.no-selection {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

    .no-selection i {
        font-size: 48px;
        margin-bottom: 16px;
        opacity: 0.3;
    }

    .no-selection p {
        font-size: 14px;
        margin: 0;
    }

/* ========== LAYOUT ELEMENTS ========== */
.layout-element {
    background: linear-gradient(135deg, #fffef5 0%, #fff9e6 100%);
    border: 2px solid #ffc107;
    padding: 20px;
    margin: 16px 0;
    border-radius: 12px;
    min-height: 100px;
    position: relative;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.08);
}

    .layout-element:hover {
        border-color: #e0a800;
        box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
        transform: translateY(-2px);
    }

    .layout-element.draggable {
        cursor: move;
    }

    .layout-element.dragging {
        opacity: 0.5;
        transform: rotate(1deg) scale(0.95);
        box-shadow: 0 8px 20px rgba(255, 193, 7, 0.4);
        border-color: #ffc107;
        border-style: dashed;
    }
    
    .layout-element.drag-over {
        border-color: #28a745;
        border-style: solid;
        border-width: 3px;
        background: linear-gradient(135deg, rgba(40, 167, 69, 0.05) 0%, rgba(40, 167, 69, 0.1) 100%);
        transform: scale(1.02);
    }

    .layout-element.selected {
        border-color: #ffc107;
        background: linear-gradient(135deg, #fffef5 0%, #fff3cd 100%);
        box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2), 0 4px 12px rgba(255, 193, 7, 0.25);
    }

.layout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 193, 7, 0.3);
}

.layout-type {
    font-weight: 700;
    color: #856404;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.layout-content {
    display: flex;
    gap: 12px;
}

.layout-horizontal {
    flex-direction: row;
}

.layout-vertical {
    flex-direction: column;
    min-height: 100px;
}

/* Make VerticalLayout and Group drop zones */
.layout-content.layout-vertical {
    border: 2px dashed rgba(255, 193, 7, 0.4);
    border-radius: 4px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.15s ease-in-out;
    min-height: 100px;
}

    .layout-content.layout-vertical.drag-over {
        background-color: rgba(255, 193, 7, 0.1);
        border-color: #ffc107;
        border-style: solid;
    }

.layout-grid {
    display: grid;
    gap: 12px;
}

    .layout-grid.cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .layout-grid.cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .layout-grid.cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }

.layout-column {
    flex: 1;
    min-height: 80px;
    border: 2px dashed rgba(255, 193, 7, 0.4);
    border-radius: 4px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.15s ease-in-out;
}

    .layout-column.drag-over {
        background-color: rgba(255, 193, 7, 0.1);
        border-color: #ffc107;
        border-style: solid;
    }

.layout-column-empty {
    text-align: center;
    color: #6c757d;
    font-size: 12px;
    padding: 20px;
    pointer-events: none;
}

.required-star {
    color: #dc3545;
    font-weight: 700;
}

/* ========== TABS ========== */
.tabs-header {
    display: flex;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 16px;
    gap: 4px;
}

.tab-button {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid transparent;
    border-bottom: none;
    cursor: pointer;
    font-weight: 400;
    transition: all 0.15s ease-in-out;
    color: #495057;
    font-size: 14px;
    border-radius: 4px 4px 0 0;
}

    .tab-button:hover {
        background: #e9ecef;
        color: #212529;
    }

    .tab-button.active {
        background: #ffffff;
        color: #007bff;
        border-color: #dee2e6 #dee2e6 #ffffff;
        font-weight: 500;
    }

.tab-content {
    padding: 16px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 4px 4px;
    min-height: 100px;
}

/* ========== PREVIEW TABS ========== */
.preview-tabs-header {
    display: flex;
    border-bottom: 2px solid #007bff;
    margin-bottom: 20px;
    gap: 4px;
}

.preview-tab-button {
    padding: 10px 20px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-bottom: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
    color: #495057;
    font-size: 14px;
    border-radius: 4px 4px 0 0;
}

    .preview-tab-button:hover {
        background: #e9ecef;
        color: #212529;
    }

    .preview-tab-button.active {
        background: #007bff;
        color: #ffffff;
        border-color: #007bff;
    }

.preview-tab-content {
    padding: 20px 0;
}

.drag-handle {
    cursor: move;
    cursor: grab;
    padding: 4px 8px;
    display: inline-block;
    margin-right: 8px;
    font-size: 16px;
    color: #495057;
    opacity: 0.7;
    transition: all 0.2s ease-in-out;
    border-radius: 4px;
    background: rgba(0, 123, 255, 0.05);
}

    .drag-handle:hover {
        opacity: 1;
        background: rgba(0, 123, 255, 0.15);
        color: #007bff;
        transform: scale(1.1);
    }
    
    .drag-handle:active {
        cursor: grabbing;
    }

.element-actions {
    display: flex;
    gap: 6px;
}

/* ========== SCHEMA TABS (for Export/Import modals) ========== */
.modal-content-wide {
    max-width: 1000px !important;
    opacity: 1 !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
}

    .modal-content-wide.show {
        opacity: 1 !important;
    }

    .modal-content-wide.fade {
        opacity: 1 !important;
    }

    .modal-content-wide * {
        opacity: 1 !important;
    }

.schema-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
}

.schema-tab {
    padding: 10px 20px;
    background: #ffffff;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
    color: #495057;
    font-size: 14px;
}

    .schema-tab:hover {
        color: #212529;
        border-bottom-color: #dee2e6;
    }

    .schema-tab.active {
        color: #007bff;
        border-bottom-color: #007bff;
    }

.schema-section {
    margin-bottom: 16px;
}

    .schema-section h3 {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 8px;
        color: #212529;
    }

.schema-description {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 12px;
    font-style: italic;
}

/* ========== TOOLBOX ICONS ========== */
.toolbox-icon {
    font-size: 16px;
    min-width: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #495057;
}

/* ========== BADGES ========== */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    color: #ffffff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 3px;
}

.badge-primary {
    background-color: #007bff;
}

.badge-secondary {
    background-color: #6c757d;
}

.badge-success {
    background-color: #28a745;
}

.badge-danger {
    background-color: #dc3545;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-info {
    background-color: #17a2b8;
}

/* ========== CARDS ========== */
.card {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 16px;
}

.card-header {
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #212529;
}

.card-body {
    padding: 16px;
}

/* ========== MODALS ========== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 20px;
}

    .modal-backdrop.show {
        display: flex;
        opacity: 1 !important;
    }

.modal-content {
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    position: relative;
    opacity: 1 !important;
    background-color: #ffffff !important;
}

    .modal-content.show {
        opacity: 1 !important;
    }

    .modal-content.fade {
        opacity: 1 !important;
    }

    .modal-content * {
        opacity: 1 !important;
    }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

    .modal-header h2 {
        font-size: 20px;
        font-weight: 600;
        color: #212529;
        margin: 0;
    }

    .modal-header .btn {
        font-size: 24px;
        line-height: 1;
        padding: 4px 12px;
        min-width: auto;
    }

/* ========== JSON OUTPUT ========== */
.json-output {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ========== PROPERTY GROUP ========== */
.property-group {
    margin-bottom: 16px;
}

    .property-group textarea {
        width: 100%;
        padding: 10px;
        border: 1px solid #ced4da;
        border-radius: 4px;
        font-family: 'Courier New', monospace;
        font-size: 13px;
        resize: vertical;
    }

        .property-group textarea:focus {
            border-color: #80bdff;
            outline: 0;
            box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
        }

/* ========== RESPONSIVE ========== */

/* Override Bootstrap modal fade/show opacity */
.modal-backdrop.fade,
.modal-backdrop.show,
.modal.fade .modal-dialog,
.modal.show .modal-dialog,
.modal .modal-content.fade,
.modal .modal-content.show {
    opacity: 1 !important;
}

/* Ensure modal content and all children are fully opaque */
.modal-content,
.modal-content * {
    opacity: 1 !important;
}

@media (max-width: 1200px) {
    .toolbox {
        width: 240px;
    }

    .properties {
        width: 280px;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .toolbox,
    .properties {
        width: 100%;
        border: none;
        border-bottom: 1px solid #dee2e6;
    }

    .modal-content-wide {
        max-width: 95% !important;
    }

    .modal-content {
        max-width: 95%;
        padding: 15px;
    }
}

/* ========== FORM LIST STYLES ========== */
.form-list {
    max-height: 500px;
    overflow-y: auto;
}

.form-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 15px;
    background: #ffffff;
    transition: all 0.2s;
}

.form-list-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: #0d6efd;
}

.form-list-info {
    flex: 1;
}

.form-list-info h4 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: #212529;
}

.form-list-info p {
    margin: 0 0 8px 0;
    color: #6c757d;
    font-size: 14px;
}

.form-list-info small {
    color: #adb5bd;
    font-size: 12px;
}

.form-list-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.bg-secondary {
    background-color: #6c757d !important;
}

/* Alert styles */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 8px;
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.alert-info {
    color: #055160;
    background-color: #cff4fc;
    border-color: #b6effb;
}

/* ========== MEHRSPRACHIGKEIT MIT ICON & POPUP ========== */

/* Container für Feld mit Sprach-Icon */
.multilingual-field-container {
    position: relative;
    display: flex;
    align-items: stretch;
}

.multilingual-field-container input,
.multilingual-field-container textarea {
    flex: 1;
    padding-right: 45px; /* Platz für Icon-Button */
}

/* Sprach-Icon Button */
.multilingual-icon-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(102, 126, 234, 0.3);
    z-index: 10;
}

.multilingual-icon-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.multilingual-icon-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.multilingual-icon-btn i {
    font-size: 18px;
}

/* Für Textareas - Icon oben rechts */
.multilingual-field-container textarea ~ .multilingual-icon-btn {
    top: 10px;
    transform: none;
}

.multilingual-field-container textarea ~ .multilingual-icon-btn:hover {
    transform: scale(1.1);
}

.multilingual-field-container textarea ~ .multilingual-icon-btn:active {
    transform: scale(0.95);
}

/* Popup Modal Content */
.multilingual-popup-content {
    max-width: 700px !important;
    max-height: 80vh;
    overflow-y: auto;
}

.multilingual-popup-body {
    padding: 20px;
    max-height: calc(80vh - 160px);
    overflow-y: auto;
}

/* Einzelnes Sprach-Feld im Popup */
.multilingual-popup-field {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #f0f2f5 100%);
    border-radius: 10px;
    border: 1px solid #e1e4e8;
    transition: all 0.3s ease;
}

.multilingual-popup-field:hover {
    background: linear-gradient(135deg, #ffffff 0%, #f5f7fa 100%);
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

/* Label mit Flagge */
.multilingual-popup-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.language-flag {
    font-size: 24px;
}

.language-name {
    font-size: 15px;
    color: #2c3e50;
}

.language-code {
    font-size: 12px;
    color: #95a5a6;
    font-weight: 400;
}

/* Input/Textarea im Popup */
.multilingual-popup-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e4e8;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.multilingual-popup-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.multilingual-popup-input::placeholder {
    color: #bdc3c7;
    font-style: italic;
}

/* Textarea-spezifisches Styling */
textarea.multilingual-popup-input {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

/* Scrollbar für Popup */
.multilingual-popup-body::-webkit-scrollbar {
    width: 8px;
}

.multilingual-popup-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.multilingual-popup-body::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.multilingual-popup-body::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Modal Footer für Popup */
.multilingual-popup-content .modal-footer {
    padding: 15px 20px;
    border-top: 2px solid #e1e4e8;
    background: #f8f9fa;
}

.multilingual-popup-content .modal-footer .btn {
    min-width: 120px;
    padding: 10px 20px;
    font-weight: 600;
}

/* Animation für Popup */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.multilingual-popup-content {
    animation: slideIn 0.3s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .multilingual-popup-content {
        max-width: 95% !important;
        margin: 10px;
    }
    
    .multilingual-popup-body {
        padding: 15px;
    }
    
    .multilingual-popup-field {
        padding: 12px;
    }
}


/* ========== LANGUAGE SELECTOR ========== */
.language-selector {
    position: relative;
    display: inline-block;
}

.language-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.language-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.current-flag {
    font-size: 20px;
}

.current-language {
    font-size: 14px;
}

.language-button i {
    font-size: 10px;
    margin-left: 4px;
}

.language-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 14px;
}

.language-option:hover {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
}

.language-option.active {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    color: #667eea;
    font-weight: 600;
}

.lang-flag {
    font-size: 20px;
}

.lang-name {
    flex: 1;
}

.language-option .fa-check {
    color: #667eea;
    font-size: 14px;
}

/* ============================================
   DATABASE FIELD WIZARD
   ============================================ */

.wizard-step {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.collection-item:hover,
.field-item:hover {
    border-color: #2196F3 !important;
    background: #f0f8ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.collection-item.selected,
.field-item.selected {
    border-color: #2196F3 !important;
    background: #e3f2fd;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   DESIGNER PREVIEW-STYLE CANVAS
   Modern preview-style editing surface
   ============================================ */

/* Form elements: subtle light blue border */
.designer-element {
    position: relative;
    border: 1.5px solid transparent;
    border-radius: 6px;
    padding: 4px;
    margin: 4px 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.designer-element:hover {
    border-color: rgba(0, 123, 255, 0.3);
    background-color: rgba(0, 123, 255, 0.02);
}

.designer-element.selected {
    border-color: rgba(0, 123, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
    background-color: rgba(0, 123, 255, 0.03);
}

.designer-element.dragging {
    opacity: 0.4;
    transform: scale(0.98);
    border-style: dashed;
    border-color: #007bff;
}

/* Layout containers: subtle ocher/yellow border */
.designer-layout {
    position: relative;
    border: 1.5px dashed rgba(255, 193, 7, 0.35);
    border-radius: 8px;
    padding: 12px 10px 10px 10px;
    margin: 8px 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: 60px;
}

.designer-layout:hover {
    border-color: rgba(255, 193, 7, 0.55);
    background-color: rgba(255, 193, 7, 0.02);
}

.designer-layout.selected {
    border-color: rgba(255, 193, 7, 0.7);
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.1);
    background-color: rgba(255, 193, 7, 0.03);
}

.designer-layout.dragging {
    opacity: 0.4;
    transform: scale(0.98);
    border-color: #ffc107;
}

/* Floating action buttons - appear on hover/selection */
.designer-element-actions {
    position: absolute;
    top: -10px;
    right: 4px;
    display: none;
    align-items: center;
    gap: 2px;
    z-index: 10;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 2px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.designer-element:hover .designer-element-actions,
.designer-element.selected .designer-element-actions,
.designer-layout:hover > .designer-element-actions,
.designer-layout.selected > .designer-element-actions {
    display: flex;
}

.designer-element-actions .drag-handle {
    cursor: grab;
    padding: 2px 4px;
    font-size: 12px;
    color: #6c757d;
    opacity: 0.7;
    border-radius: 3px;
    transition: all 0.15s;
}

.designer-element-actions .drag-handle:hover {
    opacity: 1;
    color: #007bff;
    background: rgba(0, 123, 255, 0.08);
}

.designer-element-actions .drag-handle:active {
    cursor: grabbing;
}

.designer-element-actions .btn-action {
    background: none;
    border: none;
    padding: 2px 5px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px;
    color: #6c757d;
    transition: all 0.15s;
    line-height: 1;
}

.designer-element-actions .btn-action:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.08);
}

/* Layout label - small tag at top-left */
.designer-layout-label {
    position: absolute;
    top: -9px;
    left: 12px;
    background: #fff;
    padding: 0 8px;
    font-size: 10px;
    font-weight: 600;
    color: #d4a017;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: 3px;
    border: 1px solid rgba(255, 193, 7, 0.3);
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.designer-layout:hover .designer-layout-label,
.designer-layout.selected .designer-layout-label {
    opacity: 1;
}

/* Drop zones inside layouts */
.designer-drop-zone {
    min-height: 50px;
    border: 1.5px dashed rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    padding: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.designer-drop-zone:empty::after {
    content: "Element hierher ziehen";
    color: #c0c0c0;
    text-align: center;
    display: block;
    padding: 16px;
    font-size: 12px;
    font-style: italic;
}

.designer-drop-zone.drag-over {
    border-color: rgba(0, 123, 255, 0.5);
    background: rgba(0, 123, 255, 0.04);
    box-shadow: inset 0 0 0 1px rgba(0, 123, 255, 0.1);
}

/* Designer grid for HorizontalLayout/Grid - uses Bootstrap's row/col */
.designer-layout .row {
    --bs-gutter-x: 12px;
}

.designer-layout .row > .col {
    min-height: 50px;
}

/* Designer canvas specific overrides */
.canvas .designer-element .mb-3 {
    margin-bottom: 0.5rem !important;
}

.canvas .designer-element .form-label {
    font-size: 13px;
    margin-bottom: 4px;
}

.canvas .designer-element .form-control,
.canvas .designer-element .form-select {
    font-size: 13px;
    padding: 6px 10px;
}

.canvas .designer-element .form-text {
    font-size: 11px;
}

/* Tab navigation in designer mode */
.designer-layout .nav-tabs {
    margin-bottom: 12px;
}

.designer-layout .nav-tabs .nav-link {
    padding: 6px 14px;
    font-size: 12px;
}

/* Card borders for layout groups with ShowBorder */
.designer-layout .card {
    border-color: rgba(255, 193, 7, 0.2);
}

.designer-layout .card .card-header {
    background: rgba(255, 193, 7, 0.05);
    border-bottom-color: rgba(255, 193, 7, 0.15);
    padding: 8px 12px;
    font-size: 13px;
}

/* ============================================
   CODE EDITOR STYLES
   ============================================ */

.code-editor-wrapper {
    margin-bottom: 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}

.code-editor-toolbar {
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    gap: 4px;
}

.code-editor-toolbar label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.code-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.code-editor-actions button {
    background: none;
    border: 1px solid #dee2e6;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 4px;
    cursor: pointer;
    color: #495057;
    transition: all 0.15s;
    white-space: nowrap;
}

.code-editor-actions button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}

.code-editor-actions button.btn-validate {
    border-color: #198754;
    color: #198754;
}

.code-editor-actions button.btn-validate:hover {
    background: rgba(25, 135, 84, 0.1);
}

.code-editor-actions button.btn-popup {
    border-color: #0d6efd;
    color: #0d6efd;
}

.code-editor-actions button.btn-popup:hover {
    background: rgba(13, 110, 253, 0.1);
}

/* Code Editor Popup Modal */
.code-popup-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1070;
    background: rgba(0, 0, 0, 0.4);
}

.code-popup-modal {
    position: fixed;
    top: 5vh;
    left: 10vw;
    width: 80vw;
    height: 90vh;
    z-index: 1075;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.code-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.code-popup-header h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: #212529;
}

.code-popup-header .btn-action {
    background: none;
    border: 1px solid #dee2e6;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.code-popup-header .btn-action:hover {
    background: #e9ecef;
}

.code-popup-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.code-popup-actions .btn {
    font-size: 12px;
    padding: 4px 10px;
    white-space: nowrap;
}

.code-popup-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.code-popup-body textarea {
    flex: 1;
    width: 100%;
    font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.7;
    padding: 16px 20px;
    border: none;
    background: #1e1e2e;
    color: #cdd6f4;
    resize: none;
    tab-size: 2;
    white-space: pre;
    overflow-wrap: normal;
    overflow: auto;
}

.code-popup-body textarea:focus {
    outline: none;
}

.code-popup-body textarea::placeholder {
    color: #6c7086;
    font-style: italic;
}

/* Code Textarea Styling */
.code-textarea {
    width: 100%;
    min-height: 100px;
    max-height: 400px;
    font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 0 0 6px 6px;
    background: #1e1e2e;
    color: #cdd6f4;
    resize: vertical;
    tab-size: 2;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}

.code-textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
}

.code-textarea::placeholder {
    color: #6c7086;
    font-style: italic;
}

/* Validation result styles */
.validation-result {
    padding: 6px 10px;
    font-size: 11px;
    border-top: 1px solid #dee2e6;
}

.validation-result.valid {
    background: rgba(25, 135, 84, 0.08);
    color: #198754;
}

.validation-result.invalid {
    background: rgba(220, 53, 69, 0.08);
    color: #dc3545;
}

.validation-error-line {
    background: rgba(220, 53, 69, 0.1);
}

/* ============================================
   CODE ASSISTANT PANEL
   ============================================ */

.code-assistant-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    max-height: 70vh;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    z-index: 1060;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.code-assistant-header {
    padding: 10px 14px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-assistant-header h4 {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    color: #212529;
}

.code-assistant-body {
    overflow-y: auto;
    flex: 1;
    padding: 6px;
}

.code-assistant-category {
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #6c757d;
    letter-spacing: 0.8px;
    margin-top: 6px;
}

.code-assistant-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 12px;
    color: #212529;
}

.code-assistant-item:hover {
    background: rgba(0, 123, 255, 0.06);
}

.code-assistant-item .item-icon {
    font-size: 14px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.code-assistant-item .item-name {
    font-weight: 500;
}

.code-assistant-item .item-desc {
    font-size: 10px;
    color: #6c757d;
    margin-top: 1px;
}

/* Backdrop for closing assistant */
.code-assistant-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1055;
    background: rgba(0, 0, 0, 0.15);
}

/* ===== Designer linkes Panel — Segment-Control Tabs (Apple-Stil) ===== */
.dh-panel-tabs {
    display: flex;
    gap: 2px;
    padding: 4px;
    margin: 8px;
    border-radius: 8px;
    background: #eef2f6;
    border: 1px solid #dfe5ec;
}
.dh-panel-tab {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #525b70;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.08s;
}
.dh-panel-tab:hover {
    color: #0a0f1c;
}
.dh-panel-tab:active {
    transform: scale(0.98);
}
.dh-panel-tab.active {
    background: #ffffff;
    color: #1a7fd0;
    box-shadow: 0 1px 2px rgba(10, 15, 28, 0.08), 0 0 0 0.5px rgba(10, 15, 28, 0.04);
}
.dh-panel-tab.active i {
    color: #1a7fd0;
}
.dh-panel-tab i {
    font-size: 1rem;
    color: #6b7280;
    transition: color 0.15s;
}
.dh-panel-tab-label { font-weight: 500; letter-spacing: 0.01em; }

/* Dark-Mode Support */
[data-theme="dark"] .dh-panel-tabs {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .dh-panel-tab { color: rgba(255, 255, 255, 0.65); }
[data-theme="dark"] .dh-panel-tab.active {
    background: rgba(255, 255, 255, 0.12);
    color: #60a5fa;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ===== Designer-Tree (VS Code / Figma Stil) ===== */
.designer-tree-root { padding: 4px 0 12px; }
.designer-tree-empty {
    padding: 32px 16px;
    text-align: center;
    color: #8a91a3;
}
.designer-tree-empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
    color: #cbd5e1;
}
.designer-tree-empty div { font-weight: 500; margin-bottom: 4px; color: #475569; }
.designer-tree-empty small { font-size: 0.78rem; }

.designer-tree,
.designer-tree-children {
    list-style: none;
    padding: 0;
    margin: 0;
}
.designer-tree-li { position: relative; margin: 0; }

/* Node-Row — einzeilige, flex-basierte Zeile */
.designer-tree-node {
    position: relative;
    display: flex;
    align-items: center;
    padding: 3px 8px 3px 0;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    font-size: 0.82rem;
    color: #0a0f1c;
    line-height: 1.35;
    min-height: 26px;
    border-left: 2px solid transparent;
}
.designer-tree-node:hover {
    background: #f1f4f9;
}
.designer-tree-node.selected {
    background: rgba(26, 127, 208, 0.12);
    border-left-color: #1a7fd0;
}
.designer-tree-node.dragging { opacity: 0.45; }

/* Einrueck-Spacer pro Ebene (gibt der Node die raeumliche Tiefe) */
.designer-tree-indent {
    position: relative;
    display: inline-block;
    width: 16px;
    align-self: stretch;
    flex-shrink: 0;
}
/* Guide-Linie: in jeder Indent-Spalte eine duenne vertikale Linie,
   damit der Nutzer die Eltern-Kind-Beziehung sofort sieht. */
.designer-tree-indent::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 8px;
    width: 1px;
    background: #e4eaf1;
}
.designer-tree-node.selected .designer-tree-indent::before {
    background: #bfdbfe;
}

/* Chevron: 16px Breit, klickbar, bei Containern mit Kindern */
.designer-tree-chevron {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    flex-shrink: 0;
    font-size: 0.7rem;
    transition: color 0.1s;
    border-radius: 3px;
}
.designer-tree-chevron:hover { color: #0a0f1c; background: rgba(10, 15, 28, 0.06); }
.designer-tree-chevron:empty { pointer-events: none; }

/* Drag-Handle — nur beim Hover sichtbar */
.designer-tree-grip {
    width: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.1s;
    flex-shrink: 0;
    cursor: grab;
}
.designer-tree-node:hover .designer-tree-grip { opacity: 1; }
.designer-tree-node:active .designer-tree-grip { cursor: grabbing; }

/* Typ-Icon — farbig */
.designer-tree-icon {
    width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

/* Label */
.designer-tree-label {
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: 2px;
}
.designer-tree-node.is-container .designer-tree-label { font-weight: 600; }

/* Typ-Chip (rechts neben Label) */
.designer-tree-type {
    font-size: 0.68rem;
    color: #94a3b8;
    text-transform: lowercase;
    padding: 1px 5px;
    background: #f1f5f9;
    border-radius: 3px;
    flex-shrink: 0;
    margin-left: 6px;
    font-family: var(--font-mono, ui-monospace, monospace);
    letter-spacing: 0.02em;
}
.designer-tree-node.selected .designer-tree-type {
    background: rgba(26, 127, 208, 0.2);
    color: #1a7fd0;
}

/* Actions (Delete) — beim Hover sichtbar */
.designer-tree-actions {
    display: inline-flex;
    gap: 2px;
    margin-left: 6px;
    opacity: 0;
    transition: opacity 0.1s;
    flex-shrink: 0;
}
.designer-tree-node:hover .designer-tree-actions,
.designer-tree-node.selected .designer-tree-actions {
    opacity: 1;
}
.designer-tree-action-btn {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 4px;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.1s, color 0.1s;
}
.designer-tree-action-btn:hover {
    background: rgba(220, 53, 69, 0.12);
    color: #dc3545;
}

/* Drop-Zonen (schmal, Hover-Indikator als blaue Linie/Flaeche) */
.designer-tree-drop {
    position: absolute;
    left: 0;
    right: 0;
    height: 5px;
    pointer-events: auto;
    z-index: 2;
}
.designer-tree-drop.before { top: -2px; }
.designer-tree-drop.after  { bottom: -2px; }
.designer-tree-drop:hover::before {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    top: 50%;
    height: 2px;
    background: #1a7fd0;
    border-radius: 2px;
    box-shadow: 0 0 0 2px rgba(26, 127, 208, 0.2);
}

/* Kinder-Container: kein extra Einzug hier — der Einzug passiert via .designer-tree-indent
   am Node selbst, damit Drop-Zones die volle Zeilenbreite bleiben. */
.designer-tree-children { padding: 0; margin: 0; }

/* Dark-Mode Tree */
[data-theme="dark"] .designer-tree-node { color: rgba(255, 255, 255, 0.85); }
[data-theme="dark"] .designer-tree-node:hover { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] .designer-tree-node.selected { background: rgba(96, 165, 250, 0.15); border-left-color: #60a5fa; }
[data-theme="dark"] .designer-tree-indent::before { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .designer-tree-type { background: rgba(255, 255, 255, 0.08); color: #94a3b8; }
[data-theme="dark"] .designer-tree-empty div { color: rgba(255, 255, 255, 0.6); }

