body .search-panel {
    margin-top: 0;
    margin-bottom: 0;
    background: var(--panel-background);
    border: 1px solid var(--border-panel);
    border-radius: 12px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    max-height: 800px;
    min-height: 600px;
    position: relative;
}

body .search-panel .panel-header {
    background: var(--panel-header-background);
    padding: 1.25rem;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

body .search-panel .search-content {
    background: var(--panel-background);
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    height: calc(100% - 70px);
    min-height: 0;
    overflow: visible;
    position: relative;
    flex: 1;
}

body .search-panel .query-box,
body .search-panel .results-container {
    background: var(--panel-background);
    border: 1px solid var(--border-panel);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 500px;
    overflow: visible;
    position: relative;
}

body .search-panel .query-label {
    padding: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--panel-header-background);
}

.query-editor {
    flex: 1 1 auto;
    min-height: 350px;
    max-height: calc(100% - 80px);
    border: none;
    background-color: #1a1a1a !important;
    position: relative;
    z-index: 10;
    overflow: hidden !important;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.results-container {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.results-header {
    padding: 1rem;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--panel-header-background);
    flex-shrink: 0;
}

.results-preview {
    flex: 1;
    min-height: 400px;
    margin: 0;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-code);
    background: var(--panel-background);
    overflow-y: auto;
    overflow-x: auto;
    white-space: pre;
}


.results-preview.json-highlighted {
    padding: 1rem;
    border: none;
    background: var(--panel-background);
}

#searchIndexSelector {
    min-width: 250px;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--input-text);
    background: var(--input-background);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#searchIndexSelector:hover {
    border-color: var(--button-hover-border);
}

#searchIndexSelector:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus-ring);
}

.btn-icon {
    padding: 0.35rem;
    border-radius: 4px;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    z-index: 10;
}

.btn-icon:hover {
    background: var(--button-hover-bg);
    color: var(--primary-color);
}

#executeQuery {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
    height: 2.1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    position: relative !important;
    z-index: 100 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#executeQuery:hover {
    background: var(--primary-hover);
}

#executeQuery i {
    font-size: 1.1rem;
}

.query-actions-wrapper {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--panel-header-background);
    border-top: 1px solid var(--border-panel);
    z-index: 1000;
    height: auto;
    min-height: 60px;
    overflow: visible !important;
    flex-shrink: 0;
    margin-top: auto;
}

.query-actions {
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    background: var(--panel-header-background);
    position: relative;
    z-index: 1000;
    min-height: 60px;
    overflow: visible !important;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1000;
    position: relative;
    overflow: visible;
}

.btn-icon[title]::after,
.btn-icon[title]::before,
.editor-actions .btn-icon[title]::after,
.editor-actions .btn-icon[title]::before,
[data-theme="dark"] .btn-icon[title]::after,
[data-theme="dark"] .btn-icon[title]::before,
[data-theme="light"] .btn-icon[title]::after,
[data-theme="light"] .btn-icon[title]::before {
    content: none;
    display: none;
}

.btn-icon[title]:hover::after,
.btn-icon[title]:hover::before,
.editor-actions .btn-icon[title]:hover::after {
    opacity: 0;
    visibility: hidden;
    display: none;
    transform: none;
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.popular-queries,
.saved-queries {
    position: relative;
}

.popular-queries-btn,
.saved-queries-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--button-bg);
    border: 1px solid var(--button-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.popular-queries-btn:hover,
.saved-queries-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.popular-queries-menu,
.saved-queries-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    width: 300px;
    background: var(--dropdown-bg);
    border: 1px solid var(--dropdown-border);
    border-radius: 8px;
    box-shadow: var(--dropdown-shadow);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 2;
    padding: 0.5rem 0;
}

.popular-queries-menu.show,
.saved-queries-menu.show {
    opacity: 1;
    visibility: visible;
}

.saved-queries-btn {
    white-space: nowrap;
}

.saved-queries-menu {
    display: none;
}

.saved-queries-menu.show {
    display: block;
}

.query-category {
    padding: 1rem;
    border-bottom: 1px solid var(--dropdown-border);
}

.query-category:last-child {
    border-bottom: none;
}

.category-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.query-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem;
    font-size: 0.875rem;
    color: var(--dropdown-text);
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.query-item:hover {
    background: var(--dropdown-item-hover);
    color: var(--dropdown-hover-text);
}

.query-item i {
    width: 16px;
    color: var(--text-secondary);
}

.query-item:hover i {
    color: var(--primary-color);
}

.saved-queries {
    position: relative;
    display: inline-block;
}

.saved-queries-list {
    max-height: 300px;
    overflow-y: auto;
}

.saved-query-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.saved-query-item:hover {
    background: var(--surface-hover-color);
}

.saved-query-name {
    flex: 1;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.saved-query-name:hover {
    color: var(--primary-color);
    background: var(--dropdown-item-hover);
}

.saved-query-actions {
    display: flex;
    gap: 0.5rem;
}

.query-action-btn {
    padding: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary-color);
    transition: color 0.2s ease;
}

.query-action-btn:hover {
    color: var(--text-primary-color);
}

.query-action-btn.delete:hover {
    color: var(--danger-color);
}

.query-action-btn.delete {
    position: relative;
}

.rename-input {
    flex: 1;
    font-size: 0.875rem;
    padding: 0.25rem;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    background: var(--dropdown-bg);
    color: var(--text-primary);
    margin-right: 0.5rem;
    outline: none;
}

.rename-input:focus {
    box-shadow: 0 0 0 2px var(--primary-color-transparent);
}

.query-action-btn.rename:hover {
    color: var(--primary-color);
}

.saved-query-item:last-child {
    border-bottom: none;
}

.saved-query-item.no-queries {
    color: var(--text-secondary);
    font-style: italic;
    cursor: default;
}

.saved-query-item.no-queries:hover {
    background: none;
}

.saved-query-item.no-queries .saved-query-name {
    cursor: default;
}

.saved-query-item.no-queries .saved-query-name:hover {
    color: inherit;
    background: none;
}

.query-action-btn.load {
    display: none;
}

[data-theme="dark"] .monaco-editor,
[data-theme="dark"] .monaco-editor-background,
[data-theme="dark"] .monaco-editor .inputarea,
[data-theme="dark"] .monaco-editor .margin,
[data-theme="dark"] .monaco-editor .monaco-editor-background,
[data-theme="dark"] .monaco-editor .overflow-guard,
[data-theme="dark"] .monaco-editor .monaco-scrollable-element,
[data-theme="dark"] .monaco-editor .editor-scrollable,
[data-theme="dark"] .monaco-editor .lines-content,
[data-theme="dark"] .monaco-editor iframe {
    background-color: #1a1a1a !important;
}

[data-theme="dark"] .monaco-editor .suggest-widget,
[data-theme="dark"] .monaco-editor .parameter-hints-widget,
[data-theme="dark"] .monaco-editor .find-widget,
[data-theme="dark"] .monaco-editor .rename-box {
    background-color: #252525 !important;
    border-color: #333333 !important;
    color: #f0f0f0 !important;
}

[data-theme="dark"] .monaco-editor .scrollbar {
    background-color: #1a1a1a !important;
}

[data-theme="dark"] .monaco-editor .scrollbar .slider {
    background-color: #444444 !important;
}

[data-theme="dark"] .monaco-editor .current-line {
    background-color: #252525 !important;
}

[data-theme="dark"] .monaco-editor .mtk1 { color: #f0f0f0 !important; } 
[data-theme="dark"] .monaco-editor .mtk2 { color: #569cd6 !important; } 
[data-theme="dark"] .monaco-editor .mtk3 { color: #ce9178 !important; } 
[data-theme="dark"] .monaco-editor .mtk4 { color: #b5cea8 !important; } 
[data-theme="dark"] .monaco-editor .mtk5 { color: #608b4e !important; } 
[data-theme="dark"] .monaco-editor .mtk6 { color: #9cdcfe !important; } 
[data-theme="dark"] .monaco-editor .mtk7 { color: #d7ba7d !important; } 
[data-theme="dark"] .monaco-editor .mtk8 { color: #4ec9b0 !important; } 

@media (max-width: 768px) {
    body .search-panel {
        height: auto;
        min-height: auto;
        max-height: none;
        overflow: visible;
        position: relative;
    }
    
    body .search-panel .search-content {
        height: auto;
        overflow: visible;
        padding-bottom: 0;
        grid-template-columns: 1fr;
        min-height: 600px;
    }
    
    .query-editor, .results-preview {
        height: 350px !important;
        max-height: 350px !important;
    }
    
    body .search-panel .query-box {
        min-height: 450px;
        max-height: none;
        padding-bottom: 0;
        position: relative;
        overflow: visible;
    }
    
    body .search-panel .results-container {
        margin-top: 1rem;
        max-height: 400px;
        overflow: hidden;
    }
    
    .query-actions {
        padding: 1rem;
        flex-wrap: wrap;
        justify-content: space-between;
        z-index: 1000;
        min-height: 70px;
        overflow: visible !important;
    }
    
    .query-actions-wrapper {
        min-height: 70px;
        height: auto;
        overflow: visible !important;
        flex-shrink: 0;
        position: relative;
        bottom: auto;
    }
    
    .editor-actions {
        justify-content: flex-end;
        flex-wrap: wrap;
        z-index: 1000;
        overflow: visible !important;
    }
    
    .monaco-editor,
    .monaco-editor-background,
    .monaco-editor .overflow-guard {
        z-index: 1;
        overflow: hidden !important;
    }
}

@media (max-width: 576px) {
    .query-editor, .results-preview {
        height: 250px !important;
        max-height: 250px !important;
    }
    
    body .search-panel .query-box {
        min-height: 350px;
        max-height: none;
        overflow: visible;
    }
    
    body .search-panel .results-container {
        max-height: 300px;
    }
    
    body .search-panel .search-content {
        min-height: 500px;
        overflow: visible;
    }
    
    .query-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 1.25rem;
        min-height: 100px;
        overflow: visible !important;
    }
    
    .query-actions-wrapper {
        min-height: 100px;
        height: auto;
        overflow: visible !important;
        position: relative;
        bottom: auto;
        margin-top: auto;
    }
    
    .editor-actions {
        justify-content: center;
        margin-bottom: 0.75rem;
        width: 100%;
        overflow: visible !important;
    }
    
    #executeQuery {
        width: 100%;
        margin-top: 0.75rem;
        min-height: 44px;
    }
}

.monaco-editor .overflow-guard {
    overflow: hidden !important;
    max-height: 100% !important;
}

.monaco-editor .monaco-scrollable-element {
    overflow: auto !important;
    max-height: 100% !important;
}

body .search-panel .query-box {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    display: flex;
    flex-direction: column;
    border-bottom: none;
}

#queryInput {
    flex: 1;
    position: relative;
    min-height: 300px;
    max-height: calc(100% - 80px);
    z-index: 1;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}

.query-editor .monaco-editor {
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
}

.monaco-editor .context-view,
.monaco-editor .monaco-menu,
.monaco-editor .context-menu {
    z-index: 100 !important;
}

.monaco-editor .editor-widget,
.monaco-editor .overlayWidgets {
    z-index: 50 !important;
}

body .search-panel.collapsed {
    height: auto;
    min-height: auto;
    max-height: none;
    overflow: hidden;
}

body .search-panel.collapsed .search-content {
    display: none;
    height: 0;
    overflow: hidden;
}

.monaco-editor .overflow-guard {
    overflow: hidden !important;
    max-height: 100% !important;
    position: relative !important;
}

.monaco-editor .monaco-scrollable-element {
    overflow: auto !important;
    max-height: 100% !important;
    position: relative !important;
}
