.page {
    padding: 20px;
    display: none;
}

.card {
    margin-bottom: 20px;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}

.table-responsive {
    margin: -1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.btn-sm {
    margin: 0 2px;
}

#schema-form {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
}

.modal-body pre {
    max-height: 200px;
    overflow-y: auto;
}

.modal-body textarea[name="definition"] {
    font-family: monospace;
    font-size: 0.9em;
}

.modal-body .form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.modal-dialog {
    max-width: 800px;
}

.search-box {
    width: 200px;
    margin-right: 10px;
}

#configure-json-path-page .card {
    margin-top: 20px;
}

#json-path-form {
    max-width: 100%;
}

#json-path-form .form-control {
    margin-bottom: 15px;
}

#json-path-form textarea.code-input {
    font-family: monospace;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre;
    min-height: 200px;
    resize: vertical;
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
}

#json-path-form textarea.code-input:focus {
    background-color: #fff;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.nested-object-container {
    padding: 15px;
    margin: 10px 0;
    border-left: 2px solid #dee2e6;
    background-color: rgba(0,0,0,0.02);
}

.array-item {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.nested-form-container {
    background-color: white;
    padding: 10px;
    border-radius: 4px;
}

.array-item-content {
    flex-grow: 1;
}

.nested-object-form {
    background-color: white;
}

.array-item .row {
    margin-right: 25px;
}

#json-path-form .text-muted {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}
.component-controls {
    margin-top: 10px;
}

.component-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.item-selection {
    min-width: 200px;
}

.item-select {
    font-size: 0.875rem;
    padding: 2px 5px;
}

.components-section {
    margin-top: 10px;
    padding-left: 20px;
}

.component-list {
    margin-bottom: 10px;
}
/* Add these styles for the JSON path view modal */
#json-path-view-modal .code-input {
    font-family: monospace;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre;
    background-color: #f8f9fa;
    cursor: default;
}

#json-path-view-modal .form-control[readonly] {
    background-color: #f8f9fa;
}

#json-paths-table .btn {
    margin-right: 5px;
}

/* Add these styles for the JSON template view in instance modal */
#json-template-view-modal .code-input {
    font-family: monospace;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre;
    background-color: #f8f9fa;
    cursor: default;
}

#json-template-view-modal .form-control[readonly] {
    background-color: #f8f9fa;
}

.input-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Update these styles for the page definition tree view */
.definition-tree {
    margin-left: 20px;
}

.tree-item {
    margin: 10px 0;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background-color: #f8f9fa;
    overflow: hidden;
}

.tree-item .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 5px;
    background-color: #fff;
}

.tree-item .header:hover {
    background-color: #e9ecef;
}

.tree-item .content {
    margin-top: 10px;
    padding-left: 20px;
    display: none;
    background-color: #fff;
}

.tree-item.expanded > .content {
    display: block;
}

/* Add these new styles */
.tree-item .header span {
    display: flex;
    align-items: center;
}

.tree-item .toggle-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    transition: transform 0.2s;
    text-align: center;
}

.tree-item.expanded > .header .toggle-icon {
    transform: rotate(90deg);
}

/* Distinct colors for each level */
.layout-item {
    border-left: 3px solid #007bff;
    margin-left: 0;
}

.widget-item {
    border-left: 3px solid #28a745;
    margin-left: 20px;
}

.component-item {
    border-left: 3px solid #ffc107;
    margin-left: 20px;
}

.item-instance {
    border-left: 3px solid #dc3545;
    margin-left: 20px;
}

.layout-actions {
    display: flex;
    gap: 8px;
}

.layout-actions .btn {
    padding: 2px 8px;
    font-size: 0.875rem;
}

/* Prevent button clicks from toggling the tree item */
.layout-actions button {
    z-index: 1;
}

/* Add these styles for the JSON path view modal */
#view-json-path-modal .code-input {
    font-family: monospace;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre;
    background-color: #f8f9fa;
    cursor: default;
}

#view-json-path-modal .form-control[readonly] {
    background-color: #f8f9fa;
}

#existing-json-paths-table .btn {
    margin-right: 5px;
}

.json-path-actions {
    white-space: nowrap;
}

/* Add these styles for the JSON path view button */
.input-group .btn-info {
    display: flex;
    align-items: center;
    gap: 4px;
}

.code-input {
    font-family: monospace;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre;
    background-color: #f8f9fa;
}

#view-selected-json-path-modal .modal-dialog {
    max-width: 800px;
}

#view-selected-json-path-modal textarea {
    resize: vertical;
}

/* Add styles for template definition section */
.template-section {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 1rem;
    background-color: #f8f9fa;
}

.template-section .mb-3:last-child {
    margin-bottom: 0;
}

#template-fields-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

/* Styles for array fields */
.array-field-container {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    background-color: #f8f9fa;
}

.array-item {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
}

.array-item .btn-danger {
    padding: 0.25rem 0.5rem;
}

.array-items {
    max-height: 300px;
    overflow-y: auto;
}

/* Styles for object fields */
.object-field-container {
    margin-bottom: 1.5rem;
}

.object-fields {
    background-color: white;
    margin-top: 0.5rem;
}

.object-fields .form-label {
    font-size: 0.9rem;
}

.object-fields .form-text {
    font-size: 0.8rem;
}

/* Schema search container styles */
.schema-select-container {
    position: relative;
    margin-bottom: 1rem;
}

.schema-select-container input[type="text"] {
    width: 100%;
    margin-bottom: 0.5rem;
    padding-left: 30px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>');
    background-repeat: no-repeat;
    background-position: 8px center;
    background-size: 16px;
}

.schema-select-container select {
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    transition: all 0.2s ease;
}

.schema-select-container select[size]:not([size="1"]) {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    height: auto;
    background-image: none;
    padding-right: 0.75rem;
    z-index: 1000;
    position: relative;
}

/* Prevent option text wrapping */
.schema-select-container select option {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Highlight the selected option */
.schema-select-container select option:checked {
    background-color: #007bff;
    color: white;
}