/* SchoolDB Custom Styles */

.jumbotron {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
}

.query-container {
    min-height: 400px;
}

.results-table {
    max-height: 500px;
    overflow-y: auto;
}

.error-message {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
}

.success-message {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
}

/* SQL Editor Styles */
#sql-editor {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    min-height: 250px;
}

#sql-editor:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* CodeMirror SQL Editor Styles */
.CodeMirror {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    height: 250px;
    background-color: #ffffff;
}

.CodeMirror-focused {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.CodeMirror .CodeMirror-placeholder {
    color: #6c757d;
    font-style: italic;
}

/* SQL syntax highlighting */
.cm-s-default .cm-keyword { color: #0066cc; font-weight: bold; }
.cm-s-default .cm-string { color: #009900; }
.cm-s-default .cm-number { color: #ff6600; }
.cm-s-default .cm-comment { color: #999999; font-style: italic; }
.cm-s-default .cm-operator { color: #333333; }
.cm-s-default .cm-builtin { color: #6600cc; font-weight: bold; }
.cm-s-default .cm-variable { color: #333333; }
.cm-s-default .cm-variable-2 { color: #0066cc; }
.cm-s-default .cm-variable-3 { color: #009900; }

/* CodeMirror Autocomplete Styling */
.CodeMirror-hints {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background-color: #ffffff;
    max-height: 200px;
    z-index: 1050;
}

.CodeMirror-hint {
    padding: 4px 8px;
    border-radius: 0.25rem;
    margin: 2px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.CodeMirror-hint-active {
    background-color: #0d6efd;
    color: white;
}

.CodeMirror-hint:hover {
    background-color: #e9ecef;
}

.CodeMirror-hint-active:hover {
    background-color: #0b5ed7;
}

/* Spezifische Styles für verschiedene Hint-Typen */
.sql-column-hint {
    color: #0066cc;
    font-weight: normal;
}

.sql-table-hint {
    color: #009900;
    font-weight: bold;
}

.CodeMirror-hint.sql-column-hint:before {
    content: "📊 ";
    font-size: 11px;
}

.CodeMirror-hint.sql-table-hint:before {
    content: "🗃️ ";
    font-size: 11px;
}

.query-container .card-body {
    padding: 1rem;
}

.results-table-container {
    max-height: 400px;
    overflow: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}

.results-table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.results-table th {
    background-color: #212529;
    color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
    border-top: none;
}

.results-table td {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.char-counter {
    font-size: 0.8rem;
    color: #6c757d;
}

.query-info {
    background-color: #e7f3ff;
    border: 1px solid #b3d7ff;
    border-radius: 0.375rem;
    padding: 8px 12px;
    margin-bottom: 1rem;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
}

.nav-link:hover {
    color: white !important;
}

/* Sidebar Styles */
.table-name:hover {
    background-color: #f8f9fa;
    color: #495057 !important;
    text-decoration: none;
}

.list-group-item {
    border-left: none !important;
    border-right: none !important;
}

.list-group-item:hover {
    background-color: #f8f9fa;
}

/* Sidebar scrolling */
#tables-sidebar {
    max-height: 70vh;
    overflow-y: auto;
}

/* Mobile responsive sidebar */
@media (max-width: 768px) {
    #tables-sidebar {
        max-height: 200px;
    }
}

/* Widescreen optimizations (1920px+) */
@media (min-width: 1400px) {
    .container {
        max-width: 1600px;
    }
    
    /* SQL Editor layout for widescreen */
    .widescreen-sidebar {
        max-width: 280px;
        min-width: 280px;
    }
    
    .widescreen-main {
        flex: 1;
        max-width: calc(100% - 300px);
    }
    
    /* Expand CodeMirror for more space */
    .CodeMirror {
        height: 350px;
        font-size: 15px;
    }
    
    /* Better table columns spacing */
    .results-table td {
        max-width: 300px;
    }
    
    /* Database cards in wider layout */
    .database-card-widescreen {
        max-width: 300px;
    }
}

/* Ultra-Widescreen optimizations (2560px+) */
@media (min-width: 2000px) {
    .container {
        max-width: 2200px;
    }
    
    /* Three-column layout for ultra-wide */
    .ultrawide-sidebar {
        max-width: 320px;
        min-width: 320px;
    }
    
    .ultrawide-main {
        flex: 1;
        max-width: calc(100% - 640px);
    }
    
    .ultrawide-secondary {
        max-width: 300px;
        min-width: 300px;
    }
    
    /* Larger editor for ultra-wide */
    .CodeMirror {
        height: 400px;
        font-size: 16px;
    }
    
    /* More table columns visible */
    .results-table td {
        max-width: 400px;
    }
    
    /* Database cards in grid layout */
    .database-grid-ultrawide .col-lg-4 {
        flex: 0 0 auto;
        width: 25%;
    }
}

/* Better container fluid behavior */
.container-fluid-responsive {
    padding-left: 2rem;
    padding-right: 2rem;
}

@media (min-width: 1400px) {
    .container-fluid-responsive {
        padding-left: 4rem;
        padding-right: 4rem;
    }
}

@media (min-width: 2000px) {
    .container-fluid-responsive {
        padding-left: 6rem;
        padding-right: 6rem;
    }
}

/* SQL-Referenz spezifische Styles */
.sql-reference .code-example {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin: 0.5rem 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sql-reference .code-example:hover {
    background-color: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sql-reference .copy-code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.sql-reference .copy-code:hover {
    background-color: #e9ecef;
    border-color: #0d6efd;
}

/* Mobile responsive für SQL-Referenz */
@media (max-width: 768px) {
    .sql-reference .d-flex.flex-wrap {
        flex-direction: column;
    }
    
    .sql-reference .btn-sm {
        width: 100%;
        margin-bottom: 0.25rem;
    }
    
    .sql-reference .code-example {
        font-size: 0.875rem;
        padding: 0.5rem;
    }
    
    .sql-reference .table-responsive {
        font-size: 0.875rem;
    }
    
    .sql-reference .accordion-body {
        padding: 0.75rem;
    }
}

/* Tablet responsive */
@media (min-width: 769px) and (max-width: 991px) {
    .sql-reference .col-lg-6 {
        margin-bottom: 1rem;
    }
}