/* general_health_editor.css - Adapted from dashboard/css/form_editor.css */

#general-health-editor-modal .modal-content {
    width: 95%;
    max-width: 1200px;
    /* Wider for the editor */
    height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    background-color: #fff;
    /* Ensure white background */
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    /* Ensure content stays inside rounded corners */
    margin-top: 40px;
}

/* Scoped Button Styles */
#general-health-editor-modal .btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-family: Heebo, Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    line-height: 1;
    height: 40px;
    white-space: nowrap;
}

#general-health-editor-modal .btn:hover {
    transform: translateY(-1px);
}

#general-health-editor-modal .btn-secondary {
    background: linear-gradient(135deg, #6c757d, #868e96);
    color: white;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

#general-health-editor-modal .btn-primary {
    background: linear-gradient(135deg, #17669d, #4a90c2);
    color: white;
    box-shadow: 0 4px 12px rgba(23, 102, 157, 0.3);
}

#general-health-editor-modal .btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

#general-health-editor-modal .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    height: 32px;
}

#general-health-editor-modal .modal-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#general-health-editor-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f8f9fa;
}

#general-health-editor-modal .modal-footer {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background-color: #fff;
}

/* Scoped Styles for the Editor Content */
/* .editor-wrapper removed as it was empty */

/* Form Name Input */
#general-health-editor-modal .form-group label {
    display: block;
    font-family: Heebo, Arial, Helvetica, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

#general-health-editor-modal .form-control {
    width: 95%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-family: Heebo, Arial, Helvetica, sans-serif;
    font-size: 15px;
    background-color: #fafbfc;
    transition: all 0.3s ease;
}

#general-health-editor-modal .form-control:focus {
    outline: none;
    border-color: #17669d;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(23, 102, 157, 0.1);
}

/* Sections Container */
#general-health-editor-modal #sections-container {
    min-height: 100px;
    margin-bottom: 25px;
}

/* Section Actions Bar */
#general-health-editor-modal .section-actions-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 25px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px dashed #82aac5;
    transition: all 0.3s ease;
}

#general-health-editor-modal .section-actions-bar:hover {
    border-color: #17669d;
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

#general-health-editor-modal .insert-section-btn {
    background: rgba(23, 102, 157, 0.1);
    border: 2px solid #17669d;
    color: #17669d;
    box-shadow: none;
}

#general-health-editor-modal .insert-section-btn:hover {
    background: rgba(23, 102, 157, 0.2);
}

#general-health-editor-modal .save-form-btn {
    background: rgba(40, 167, 69, 0.1);
    border: 2px solid #28a745;
    color: #28a745;
    box-shadow: none;
}

#general-health-editor-modal .save-form-btn:hover {
    background: rgba(40, 167, 69, 0.2);
}

#general-health-editor-modal .remove-section-btn,
#general-health-editor-modal #reset-defaults-btn {
    background: rgba(108, 117, 125, 0.1);
    border: 2px solid #6c757d;
    color: #6c757d;
    box-shadow: none;
}

#general-health-editor-modal .remove-section-btn:hover,
#general-health-editor-modal #reset-defaults-btn:hover {
    background: rgba(108, 117, 125, 0.2);
    color: #495057;
}

/* Section Drag Handle */
#general-health-editor-modal .section-drag-handle {
    cursor: grab;
    color: #6c757d;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    background: rgba(108, 117, 125, 0.1);
    border: 1px solid rgba(108, 117, 125, 0.3);
}

#general-health-editor-modal .section-drag-handle:hover {
    background-color: rgba(23, 102, 157, 0.1);
    color: #17669d;
    border-color: #17669d;
}

/* Form Section Styling */
#general-health-editor-modal .form-section {
    background: #fff;
    border: 2px solid #82aac5;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    position: relative;
    transition: all 0.3s ease;
}

#general-health-editor-modal .form-section:hover {
    border-color: #17669d;
    box-shadow: 0 8px 25px rgba(23, 102, 157, 0.15);
}

/* Section Header */
#general-health-editor-modal .section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

#general-health-editor-modal .section-title-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

#general-health-editor-modal .section-toggle-btn {
    background: rgba(23, 102, 157, 0.1);
    border: 2px solid #17669d;
    color: #17669d;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#general-health-editor-modal .section-toggle-btn.collapsed i {
    transform: rotate(-90deg);
}

#general-health-editor-modal .section-title-input {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 0;
    transition: border-color 0.3s ease;
    flex: 1;
}

#general-health-editor-modal .section-title-input:focus {
    outline: none;
    border-bottom-color: #17669d;
    background-color: rgba(23, 102, 157, 0.05);
    border-radius: 4px 4px 0 0;
    padding-left: 8px;
    padding-right: 8px;
}

/* Section Content - Collapsible */
#general-health-editor-modal .section-content {
    transition: max-height 0.4s ease-out, opacity 0.4s ease-out, padding 0.4s ease-out;
    overflow: hidden;
    opacity: 1;
}

#general-health-editor-modal .section-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    margin-bottom: 0;
}

/* Form Field Styling */
#general-health-editor-modal .form-field {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    position: relative;
}

#general-health-editor-modal .form-field:hover {
    border-color: #17669d;
    box-shadow: 0 4px 15px rgba(23, 102, 157, 0.15);
}

#general-health-editor-modal .form-field::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #17669d;
    border-radius: 8px 0 0 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#general-health-editor-modal .form-field:hover::before {
    opacity: 1;
}

#general-health-editor-modal .form-field-grip {
    cursor: grab;
    color: #6c757d;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

#general-health-editor-modal .form-field-name-input,
#general-health-editor-modal .form-field-label-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 180px;
    /* NEW: Prevent collapse */
}

#general-health-editor-modal .form-select {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background-color: #fff;
    cursor: pointer;
    min-width: 150px;
    transition: all 0.3s ease;
    line-height: 1.5;
    /* Normalize line height */
    vertical-align: middle;
    /* Ensure vertical centering */
    font-family: inherit;
    /* Use system/parent font to avoid metric issues with custom fonts in native selects */
}

/* Group Styling */
#general-health-editor-modal .form-group-container {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #d1ecf1;
    border-radius: 10px;
    margin: 15px 0;
    padding: 20px;
    position: relative;
    transition: all 0.3s ease;
}

#general-health-editor-modal .form-group-container::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #17a2b8;
    border-radius: 10px 0 0 10px;
    opacity: 0.7;
}

#general-health-editor-modal .group-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

#general-health-editor-modal .group-drag-handle {
    cursor: grab;
    color: #17a2b8;
    padding: 8px;
    border-radius: 4px;
    background: rgba(23, 162, 184, 0.1);
    border: 1px solid rgba(23, 162, 184, 0.3);
}

#general-health-editor-modal .group-toggle-btn {
    background: rgba(23, 162, 184, 0.1);
    border: 2px solid #17a2b8;
    color: #17a2b8;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#general-health-editor-modal .group-toggle-btn.collapsed i {
    transform: rotate(-90deg);
}

#general-health-editor-modal .group-title-container {
    flex: 1;
}

#general-health-editor-modal .group-title-input {
    font-size: 18px;
    font-weight: 600;
    color: #17a2b8;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 6px 0;
    width: 100%;
    margin-bottom: 5px;
}

#general-health-editor-modal .group-description-input {
    font-size: 14px;
    color: #6c757d;
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    padding: 4px 0;
    width: 100%;
    font-style: italic;
}

#general-health-editor-modal .group-content {
    transition: max-height 0.4s ease-out, opacity 0.4s ease-out;
    overflow: hidden;
    opacity: 1;
}

#general-health-editor-modal .group-content.collapsed {
    max-height: 0;
    opacity: 0;
}

#general-health-editor-modal .group-fields-container {
    background: rgba(23, 162, 184, 0.05);
    border-radius: 6px;
    padding: 12px;
    min-height: 50px;
    margin-bottom: 12px;
    border: 2px dashed #bee5eb;
}

#general-health-editor-modal .group-fields-container:empty::before {
    content: 'Felder zur Gruppe hinzufügen...';
    color: #6c757d;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 35px;
    font-size: 13px;
}

/* Button variants for groups */
#general-health-editor-modal .add-group-btn {
    border: 2px dashed #17a2b8;
    background: rgba(23, 162, 184, 0.05);
    color: #17a2b8;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 6px;
}

#general-health-editor-modal .add-field-to-group-btn {
    border: 2px dashed #28a745;
    background: rgba(40, 167, 69, 0.05);
    color: #28a745;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 6px;
}

#general-health-editor-modal .btn-info-group {
    background: rgba(23, 162, 184, 0.1);
    border: 2px solid #17a2b8;
    color: #17a2b8;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

#general-health-editor-modal .btn-danger-group {
    background: rgba(220, 53, 69, 0.1);
    border: 2px solid #dc3545;
    color: #dc3545;
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* Groups Container */
#general-health-editor-modal .groups-container {
    background: rgba(23, 162, 184, 0.02);
    border-radius: 8px;
    padding: 15px;
    min-height: 80px;
    margin-bottom: 15px;
    border: 2px dashed #d1ecf1;
}

#general-health-editor-modal .groups-container:empty::before {
    content: 'Gruppen hier hinzufügen...';
    color: #6c757d;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
}

/* Drop-Zone Highlight */
#general-health-editor-modal .group-fields-container.drop-zone-highlight {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1) 0%, rgba(40, 167, 69, 0.05) 100%);
    border: 2px dashed #28a745;
}

/* Sortable Ghost Styles */
#general-health-editor-modal .sortable-ghost {
    opacity: 0.5;
    background: rgba(23, 102, 157, 0.1);
    border: 2px dashed #17669d;
}

/* Initial Add Section Button */
#general-health-editor-modal .initial-add-section {
    text-align: center;
    margin: 30px 0;
}

/* Options Modal (Nested) */
#general-health-editor-options-modal {
    position: fixed;
    /* Fixed to viewport */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 700px;
    /* Fixed manageable width instead of percentage */
    max-width: 90vw;
    /* Responsive constraint */
    height: auto;
    max-height: 80vh;
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    z-index: 2000;
    /* Much higher than editor modal */
    display: none;
    flex-direction: column;
    padding: 0;
    /* Remove padding here, handle in body/header */
    border: 1px solid #ccc;
}

#general-health-editor-options-modal .modal-header {
    border-bottom: 1px solid #e9ecef;
    /*padding: 20px 25px;*/
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    border-radius: 8px 8px 0 0;
}

#gh-editor-options-close {
    color: #aaa;
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 1;
    position: relative;
    /* In flex container */
    width: auto;
    height: auto;
}

#gh-editor-options-close:hover {
    color: #000;
    background-color: #D3D3D3;
    width: 34px;
    height: 34px;
}

#general-health-editor-options-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    background-color: #fff;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#general-health-editor-options-modal .modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 20px 25px;
    display: flex;
    justify-content: flex-end;
    background-color: #fff;
    border-radius: 0 0 8px 8px;
}

#general-health-editor-options-modal textarea {
    width: 100%;
    min-height: 200px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 10px;
    font-family: monospace;
    resize: none;
    /* Disable horizontal and vertical resizing */
    box-sizing: border-box;
    /* Ensure padding doesn't overflow width */
}

#gh-editor-save-options-btn {
    background: rgba(108, 117, 125, 0.1) !important;
    border: 2px solid #6c757d !important;
    color: #6c757d !important;
    box-shadow: none !important;
}

#gh-editor-save-options-btn:hover {
    background: rgba(108, 117, 125, 0.2) !important;
    color: #545b62 !important;
    transform: translateY(-1px);
}