/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Header styles */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Tab navigation */
.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tab-btn {
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.7rem 1.2rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover {
    background-color: #e9ecef;
}

.tab-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* Inner tabs */
.tabs-inner {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #dee2e6;
}

.tab-inner-btn {
    background: none;
    border: none;
    padding: 0.7rem 1.2rem;
    font-size: 1rem;
    cursor: pointer;
    color: #6c757d;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-inner-btn:hover {
    color: #495057;
}

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

/* Tab content */
.tab-content {
    display: none;
}

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

.inner-tab-content {
    display: none;
}

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

/* Section headings */
h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.4rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

/* Form styles */
.api-form {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #495057;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.settings-input {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: border-color 0.3s;
}

.form-group textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: border-color 0.3s;
    min-height: 100px;
    resize: vertical;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus,
.form-group textarea:focus,
.settings-input:focus {
    outline: none;
    border-color: #3498db;
}

.form-group input[type="range"] {
    width: 70%;
    vertical-align: middle;
}

.form-group span {
    display: inline-block;
    margin-left: 1rem;
    color: #6c757d;
    font-weight: 500;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.checkbox-group label {
    margin-bottom: 0;
}

.form-options {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.form-options .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.primary-btn:hover {
    background-color: #2980b9;
}

.small-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    background-color: #e9ecef;
    color: #495057;
}

.small-btn:hover {
    background-color: #dee2e6;
}

.send-btn {
    background-color: #3498db;
    color: white;
    border-radius: 0 0 4px 0;
    height: 100%;
}

.send-btn:hover {
    background-color: #2980b9;
}

/* Results container */
.results-section {
    min-height: 200px;
    position: relative;
}

.results-container {
    position: relative;
}

.results-placeholder {
    text-align: center;
    color: #95a5a6;
    padding: 3rem 0;
}

.api-result {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.api-result.hidden {
    display: none !important;
}

.result-item {
    background-color: white;
    border-radius: 8px;
    padding: 1.2rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.result-title {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.result-title a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s;
}

.result-title a:hover {
    color: #3498db;
}

.result-content {
    color: #555;
    margin-bottom: 0.8rem;
}

.result-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.result-meta-item {
    display: flex;
    justify-content: space-between;
}

.result-score {
    font-weight: bold;
}

.result-uri {
    font-size: 0.85rem;
    color: #5d6d7e;
    word-break: break-all;
    padding: 0.3rem 0.5rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.result-uri .uri-link {
    color: #2980b9;
    text-decoration: none;
    transition: color 0.2s;
}

.result-uri .uri-link:hover {
    color: #1a5276;
    text-decoration: underline;
}

.result-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
}

/* Chat specific styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.chat-welcome {
    text-align: center;
    padding: 2rem 0;
    color: #95a5a6;
}

.chat-message {
    margin-bottom: 1rem;
    max-width: 80%;
}

.chat-message.user {
    margin-left: auto;
    background-color: #3498db;
    color: white;
    border-radius: 8px 8px 0 8px;
    padding: 0.8rem 1rem;
}

.chat-message.assistant {
    margin-right: auto;
    background-color: #f8f9fa;
    border-radius: 8px 8px 8px 0;
    padding: 0.8rem 1rem;
}

.chat-input-form {
    border-top: 1px solid #dee2e6;
    padding: 1rem;
    background-color: white;
}

.chat-input-container {
    display: flex;
    position: relative;
}

.chat-input-container textarea {
    flex: 1;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 4px 0 0 4px;
    resize: none;
    min-height: 60px;
    max-height: 120px;
}

.chat-input-container textarea:focus {
    outline: none;
    border-color: #3498db;
}

.chat-options {
    margin-bottom: 1rem;
}

/* Concept list */
.concepts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.concept-tag {
    background-color: #e9ecef;
    color: #495057;
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    font-size: 0.9rem;
}

/* Embedding preview */
.embedding-preview {
    margin-top: 1rem;
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.embedding-preview code {
    display: block;
    margin: 0.5rem 0;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    white-space: pre-wrap;
    word-break: break-all;
}

.embedding-preview button {
    margin-top: 0.5rem;
}

/* Loading indicator */
#loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease-out;
    opacity: 1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(52, 152, 219, 0.2);
    border-radius: 50%;
    border-top-color: #3498db;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Error message */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* Footer styles */
footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    color: #95a5a6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ffc107; /* yellow = connecting */
}

.status-indicator.connected {
    background-color: #28a745; /* green = connected */
}

.status-indicator.disconnected {
    background-color: #dc3545; /* red = disconnected */
}

/* Responsive styles */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .tab-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .form-options {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-options .form-group {
        width: 100%;
    }
    
    .chat-container {
        height: 400px;
    }
    
    .chat-message {
        max-width: 90%;
    }
    
    footer {
        flex-direction: column;
        gap: 1rem;
    }
}