/* Global 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: #f5f5f5;
}

/* Schema banner */
.schema-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffe69c;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.schema-banner.ok {
    background: #e6ffed;
    color: #0a6b2a;
    border-color: #b2f5bf;
}
.schema-banner.danger {
    background: #fde8e8;
    color: #c53030;
    border-color: #fbb6b6;
}
.schema-banner.readonly {
    background: #edf2f7;
    color: #2d3748;
    border-color: #cbd5e0;
    font-style: italic;
}
.schema-banner .schema-banner-actions {
    display: flex;
    gap: 0.5rem;
}
.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}
/* Database URI input layout */
.input-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.input-row input[type="text"] {
    flex: 1;
    min-width: 300px;
}

.input-row select {
    flex: 1;
    min-width: 240px;
}

.input-row .btn-test {
    margin-left: 0;
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Model selection styling */
.model-selection {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.model-selection select {
    flex: 1;
}

.btn-refresh {
    background-color: #6c757d;
    color: white;
    padding: 8px 12px;
    font-size: 0.9rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-refresh:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.btn-refresh:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Model optgroup styling */
select optgroup {
    font-weight: bold;
    font-style: normal;
}

select optgroup option {
    font-weight: normal;
    padding-left: 20px;
}

/* Model selection layout */
.model-selection {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.model-selection select {
    flex: 1;
}

.btn-refresh {
    background-color: #6c757d;
    color: white;
    padding: 8px 12px;
    font-size: 0.9rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-refresh:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.btn-refresh:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Optgroup styling */
select optgroup {
    font-weight: bold;
    font-style: italic;
}

select option {
    font-weight: normal;
    font-style: normal;
    padding: 5px;
}
header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Section Styles */
section {
    background: white;
    margin-bottom: 2rem;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

section h2 {
    color: #667eea;
    margin-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.5rem;
}

/* Input Styles */
.input-group {
    margin-bottom: 1.5rem;
}

.form-hint {
    margin-top: 0.5rem;
    color: #6b7280;
    font-size: 0.9rem;
}

.sample-questions-panel {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

.sample-questions-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.sample-questions-header span:first-child {
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    text-transform: capitalize;
}

.sample-questions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.sample-question-chip {
    border: 1px solid #cbd5e1;
    background: white;
    color: #1e293b;
    border-radius: 999px;
    padding: 0.65rem 0.9rem;
    font-size: 0.92rem;
    line-height: 1.35;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.sample-question-chip:hover {
    border-color: #667eea;
    color: #4457c4;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(102, 126, 234, 0.12);
}

.advanced-db-panel {
    margin-top: -0.25rem;
    margin-bottom: 1rem;
}

.advanced-db-panel summary {
    cursor: pointer;
    color: #4b5563;
    font-weight: 600;
    user-select: none;
}

.advanced-db-input {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #555;
}

input[type="text"], textarea, select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Button Styles */
.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Tab Styles */
.tabs {
    display: flex;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 1rem;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

.tab-btn:hover {
    color: #667eea;
    background-color: #f8f9fa;
}

.tab-content {
    min-height: 200px;
}

.tab-pane {
    display: none;
}

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

.tab-pane h3 {
    color: #555;
    margin-bottom: 1rem;
}

/* Code Block Styles */
pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 1rem;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

code {
    color: #e83e8c;
}

/* Chart Container */
#chart-output {
    min-height: 400px;
    border: 2px dashed #e1e5e9;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-style: italic;
}

#chart-output.has-chart {
    border: none;
    display: block;
}

/* Loading and Error Styles */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #667eea;
    font-weight: 600;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 5px;
    border: 1px solid #f5c6cb;
    margin-top: 1rem;
}

.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    .button-group {
        flex-direction: column;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        min-width: 100px;
    }

    .sample-question-chip {
        width: 100%;
        border-radius: 14px;
    }
}

/* Test Connection Button and Status */
.input-group {
    position: relative;
}

.btn-test {
    background-color: #28a745;
    color: white;
    margin-left: 10px;
    padding: 8px 16px;
    font-size: 0.9rem;
    display: inline-block;
    vertical-align: top;
    margin-top: 0;
}

.btn-test:hover {
    background-color: #218838;
}

.connection-status {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
}

.connection-status .success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 8px 12px;
    border-radius: 4px;
    display: inline-block;
}

.connection-status .error {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 8px 12px;
    border-radius: 4px;
    display: inline-block;
}

/* Toolbar additions */
.toolbar { display:flex; justify-content:space-between; align-items:center; gap:.75rem; margin-bottom:.75rem; flex-wrap:wrap; }
.toolbar .left { display:flex; gap:.5rem; flex-wrap:wrap; }
#result-meta { font-size:.7rem; opacity:.75; }
.chart-info { font-size:.75rem; margin-bottom:.5rem; color:#555; }
.btn-small { padding:.35rem .55rem; font-size:.7rem; }

.connection-status .loading {
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 8px 12px;
    border-radius: 4px;
    display: inline-block;
}

/* Sadece genişliği sabitlemek */
.input-group:has(#db-uri) input[type="text"] {
    flex: 0 0 280px;   /* grow=0, shrink=0, basis=280 px  ⇒  280 px genişlikte kalır */
}

/* Hem genişlik sınırı hem de esneklik */
.input-group:has(#db-uri) input[type="text"] {
    flex: 1 0 300px;   /* boşluk varsa büyür, yoksa 300 px taban genişlik */
    max-width: 500px;  /* hiçbir zaman 500 px’i aşma */
}

/* Yüksekliği değiştirmek */
.input-group:has(#db-uri) input[type="text"] {
    height: 40px;      /* kutunun yüksekliği */
    padding: 8px 12px; /* iç boşluk; yazı alanını büyütür */
    line-height: 1.4;  /* yazının dikey hizasını dengeler */
}
