/* QAI Control Center Styles */

:root {
    --primary: #0f9d89;
    --primary-dark: #5568d3;
    --secondary: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --info: #4299e1;
    --dark: #2d3748;
    --light: #f7fafc;
    --border: #e2e8f0;
    --text: #2d3748;
    --text-light: #718096;
    --success: #48bb78;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0f9d89 0%, #0a7a6d 100%);
    color: var(--text);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #0f9d89 0%, #0a7a6d 100%);
    color: white;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: var(--success);
}

.status-dot.offline {
    background: var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--light);
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    min-width: 150px;
    padding: 16px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: white;
    color: var(--primary);
}

.tab-btn.active {
    background: white;
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.full-width {
    grid-column: 1 / -1;
}

/* Cards */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.card h2 {
    font-size: 20px;
    margin-bottom: 16px;
    color: var(--dark);
}

.card h3 {
    font-size: 16px;
    margin: 16px 0 12px;
    color: var(--text);
}

.card hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-inline {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.form-inline select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--text-light);
    color: white;
}

.btn-secondary:hover {
    background: var(--text);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

/* Status Items */
.status-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: var(--light);
    border-radius: 6px;
    margin-bottom: 8px;
}

.status-label {
    font-weight: 500;
    color: var(--text);
}

.status-value {
    color: var(--text-light);
}

.status-value.success {
    color: var(--success);
    font-weight: 600;
}

.status-value.error {
    color: var(--danger);
    font-weight: 600;
}

/* Chat Interface */
.chat-card {
    display: flex;
    flex-direction: column;
    height: 600px;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.chat-header .form-group {
    margin: 0;
    flex: 1;
    max-width: 200px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    background: var(--light);
    margin-bottom: 16px;
}

.chat-message {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-message.user {
    background: var(--primary);
    color: white;
    margin-left: auto;
}

.chat-message.assistant {
    background: white;
    border: 1px solid var(--border);
}

.chat-message.system {
    background: var(--info);
    color: white;
    text-align: center;
    max-width: 100%;
}

.chat-input-form {
    display: flex;
    gap: 10px;
}

.chat-input-form input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

/* Results List */
.result-item {
    padding: 12px;
    background: var(--light);
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 4px solid var(--primary);
}

.result-item strong {
    color: var(--text);
}

.result-item .accuracy {
    color: var(--success);
    font-weight: 600;
    font-size: 18px;
}

/* Job List */
.job-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--light);
    border-radius: 6px;
    margin-bottom: 8px;
}

.job-item button {
    margin-left: 8px;
}

/* Dataset Grid */
.dataset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.dataset-item {
    padding: 12px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
}

.dataset-item.quantum { border-left: 4px solid var(--primary); }
.dataset-item.chat { border-left: 4px solid var(--success); }
.dataset-item.vision { border-left: 4px solid var(--warning); }

/* Logs */
.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.log-output {
    background: var(--dark);
    color: #00ff00;
    padding: 16px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    max-height: 500px;
    overflow-y: auto;
}

.log-entry {
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry.info { color: #00ff00; }
.log-entry.warning { color: #ffa500; }
.log-entry.error { color: #ff0000; }
.log-entry.success { color: #00ffff; }

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge.success { background: var(--success); color: white; }
.badge.error { background: var(--danger); color: white; }
.badge.warning { background: var(--warning); color: white; }
.badge.info { background: var(--info); color: white; }

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

    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }
}
