/**
 * Agent Optimizer Styles
 * Reuses Taxonomizer color scheme (#667eea primary, #764ba2 secondary)
 */

/* Config Bar */
.opt-config-bar {
    background: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.opt-config-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: end;
    margin-bottom: 12px;
}

.opt-config-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 160px;
}

.opt-config-group label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.opt-config-group select {
    padding: 8px 10px;
    font-size: 13px;
    min-width: 180px;
}

.opt-config-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Chat Area */
.opt-chat-area {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.opt-chat-messages {
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

.opt-chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.opt-chat-welcome p {
    margin: 0;
    font-size: 14px;
}

.opt-chat-footer {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid #e8e8e8;
    background: white;
}

.opt-chat-footer input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
}

.opt-chat-footer button {
    border-radius: 20px;
    padding: 10px 20px;
}

/* Chat Bubbles */
.opt-msg-user {
    display: flex;
    justify-content: flex-end;
}

.opt-msg-user-bubble {
    background: #667eea;
    color: #fff;
    border-radius: 12px 12px 2px 12px;
    padding: 12px 16px;
    max-width: 75%;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.opt-msg-assistant {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-direction: column;
}

.opt-msg-assistant-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.opt-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.opt-msg-avatar span {
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

.opt-msg-assistant-bubble {
    background: #f0f2f5;
    border-radius: 12px 12px 12px 2px;
    padding: 12px 16px;
    max-width: 75%;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    white-space: pre-wrap;
}

/* Metrics Bar — the key new feature */
.opt-metrics {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 4px 0 0 42px;
}

.opt-metric {
    background: #f0f0f0;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    color: #888;
    white-space: nowrap;
}

.opt-metric--fast {
    background: #dcfce7;
    color: #166534;
}

.opt-metric--slow {
    background: #fef3c7;
    color: #92400e;
}

/* Typing Indicator */
.opt-typing {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.opt-typing-bubble {
    background: #f0f2f5;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    color: #999;
}

/* Collapsible Sections */
.opt-section-collapsible {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.opt-section-header {
    padding: 16px 24px;
    cursor: pointer;
    background: #fafafa;
    border-bottom: 1px solid #e8e8e8;
}

.opt-section-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.opt-section-body {
    padding: 20px 24px;
}

/* Test Manager */
.opt-test-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.opt-test-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.opt-test-item:hover {
    background: #f8f9fa;
}

.opt-test-item.selected {
    border-color: #667eea;
    background: #f0f0ff;
}

.opt-test-item-name {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.opt-test-item-meta {
    font-size: 11px;
    color: #999;
}

.opt-batch-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid #e8e8e8;
}

.opt-batch-controls label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

/* Progress Bar */
.opt-progress-bar {
    width: 150px;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.opt-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    width: 0%;
}

/* Analytics */
.opt-analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.opt-stat-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    border: 1px solid #e8e8e8;
}

.opt-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 4px;
}

.opt-stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Analytics Tables */
.opt-analytics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.opt-analytics-table th {
    text-align: left;
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 2px solid #e5e7eb;
    font-size: 11px;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 0.3px;
}

.opt-analytics-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.opt-analytics-table tr:hover {
    background: #fafafa;
}

/* Responsive */
@media (max-width: 768px) {
    .opt-config-row {
        flex-direction: column;
    }

    .opt-config-group {
        min-width: 100%;
    }

    .opt-analytics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .opt-metrics {
        padding-left: 0;
    }
}
