/* Query Builder Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header i {
    margin-right: 15px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Aggregate Function Rows */
.aggregate-function-row {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #e1e5e9;
    border-radius: 5px;
    background-color: #f8f9fa;
}

.alias-input, .function-field {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.function-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
}

/* Output sections styling */
.section#fieldSelectionDiv,
.section#singleAggregateDiv,
.section#multipleAggregatesDiv,
.section#groupByDiv,
.section#debugDiv {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #007bff;
}

/* Grid layout for examples - updated for more cards */
.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Panels */
.panel {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e8ed;
}

.panel h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.4rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.panel h2 i {
    margin-right: 10px;
    color: #3498db;
}

/* Sections */
.section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fc;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.section h3 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.section h3 i {
    margin-right: 8px;
    color: #3498db;
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #7f8c8d;
    font-size: 12px;
}

/* Condition Rows */
.condition-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e1e8ed;
}

.field-input,
.operator-select,
.value-input {
    flex: 1;
    min-width: 0;
}

.operator-select {
    flex: 0 0 180px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn i {
    font-size: 12px;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-test {
    background: #27ae60;
    color: white;
    font-size: 16px;
    padding: 12px 30px;
}

.btn-test:hover {
    background: #219a52;
    transform: translateY(-1px);
}

.btn-add {
    background: #f39c12;
    color: white;
}

.btn-add:hover {
    background: #e67e22;
}

.btn-remove {
    background: #e74c3c;
    color: white;
    padding: 8px;
    flex: 0 0 auto;
}

.btn-remove:hover {
    background: #c0392b;
}

.btn-copy {
    background: #9b59b6;
    color: white;
    padding: 8px 12px;
}

.btn-copy:hover {
    background: #8e44ad;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.tab-button {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: #7f8c8d;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.tab-button.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-button:hover {
    color: #3498db;
    background: #f8f9fc;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Code Display */
pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* URL Display */
.url-display {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.url-display input {
    flex: 1;
    font-family: monospace;
    font-size: 12px;
}

/* Results */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: #f8f9fc;
    border-radius: 6px;
    border: 1px solid #e1e8ed;
}

#resultsCount {
    font-weight: 600;
    color: #2c3e50;
}

#executionTime {
    color: #7f8c8d;
    font-size: 12px;
}

/* Examples Grid */
.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.example-card {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.example-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.example-card h4 {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.example-card p {
    opacity: 0.9;
    font-size: 0.9rem;
}

/* Documentation Grid */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.doc-section {
    padding: 20px;
    background: #f8f9fc;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.doc-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1rem;
}

.doc-section ul {
    list-style: none;
}

.doc-section li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.doc-section li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: #3498db;
    font-weight: bold;
}

.doc-section code {
    background: #e8f5e8;
    color: #27ae60;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
}

/* Test Section */
.test-section {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e1e8ed;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: #7f8c8d;
    font-size: 14px;
}

.footer a {
    color: #3498db;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .condition-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .operator-select {
        flex: 1;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .docs-grid {
        grid-template-columns: 1fr;
    }
    
    .url-display {
        flex-direction: column;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-button {
        flex: 1;
        min-width: 120px;
    }
}

/* Loading and Status Indicators */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.success {
    border-left-color: #27ae60 !important;
    background-color: #f8fff9 !important;
}

.error {
    border-left-color: #e74c3c !important;
    background-color: #fff8f8 !important;
}

/* Animation for smooth transitions */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Syntax highlighting for JSON */
.json-key {
    color: #8be9fd;
}

.json-string {
    color: #f1fa8c;
}

.json-number {
    color: #bd93f9;
}

.json-boolean {
    color: #ff79c6;
}

.json-null {
    color: #6272a4;
}