/* Enhanced styles for Phase 4 & 5 features */

/* Context and memory indicators */
.message.context-aware {
    position: relative;
}

.message-context,
.message-cached {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.context-indicator,
.cached-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 12px;
    font-size: 11px;
    color: #6366f1;
}

.cached-indicator {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.message-indicators {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

/* Follow-up query styling */
.message.follow-up .message-bubble::before {
    content: '↳';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    color: #6366f1;
    font-size: 18px;
}

/* Status history (processing steps) */
.status-history {
    margin-bottom: 12px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
}

.status-history details {
    cursor: pointer;
}

.status-history summary {
    font-size: 12px;
    color: #666;
    user-select: none;
    padding: 4px;
}

.status-history summary:hover {
    color: #333;
}

.status-items {
    margin-top: 8px;
    padding-left: 16px;
}

.status-item {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-message {
    flex: 1;
}

/* Ultra-Compact Progress Display */
.progress-container {
    margin: 2px 0;
    padding: 0;
    background: transparent;
    border: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.progress-timing {
    text-align: right;
    margin-bottom: 1px;
    font-size: 9px;
    color: #999;
    font-weight: normal;
}

.progress-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid #f0f0f0;
}

.progress-message {
    flex: 1;
    font-size: 12px;
    color: #333;
    font-weight: normal;
    line-height: 1.3;
}

.progress-tokens {
    font-size: 10px;
    color: #666;
    background: transparent;
    padding: 0;
    border: none;
    font-weight: normal;
}





/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .progress-row {
        background: #1e293b;
        border-color: #334155;
        color: #f1f5f9;
    }
    
    .progress-message {
        color: #f1f5f9;
    }
    
    .progress-timing {
        color: #64748b;
    }
}

/* Structured response styling */
.structured-response {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.response-block {
    border-radius: 8px;
    overflow: hidden;
}

/* Summary block */
.summary-block {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 16px;
    border: 1px solid #bae6fd;
}

.summary-content {
    font-size: 16px;
    color: #0c4a6e;
    font-weight: 500;
}

/* Table block */
.table-container {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.table-title {
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    color: #374151;
}

.response-table {
    width: 100%;
    border-collapse: collapse;
}

.response-table th {
    background: #f9fafb;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.response-table td {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.response-table tr:hover {
    background: #f9fafb;
}

.response-table tr:last-child td {
    border-bottom: none;
}

/* Actions block */
.actions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.action-button {
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.action-button:hover {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Alert block */
.alert {
    padding: 16px;
    border-radius: 8px;
    border: 1px solid;
}

.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.alert-medium {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.alert-high {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-content {
    font-size: 14px;
}

/* Metrics block */
.metrics-container {
    background: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.metrics-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: #374151;
}

.metrics-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.metric-item {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.metric-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
}

.metric-trend {
    font-size: 14px;
}

.trend-up {
    color: #10b981;
}

.trend-down {
    color: #ef4444;
}

.trend-neutral {
    color: #6b7280;
}

/* Recommendations block */
.recommendations-container {
    background: #f0fdf4;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #bbf7d0;
}

.recommendations-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: #14532d;
}

.recommendations-list {
    margin: 0;
    padding-left: 20px;
}

.recommendations-list li {
    color: #166534;
    margin-bottom: 8px;
}

/* Chart placeholder */
.chart-container {
    background: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.chart-placeholder {
    text-align: center;
    padding: 32px;
}

.chart-title {
    font-weight: 600;
    margin-bottom: 16px;
    color: #374151;
}

.chart-message {
    color: #6b7280;
    margin-bottom: 16px;
}

.chart-placeholder pre {
    text-align: left;
    background: #fff;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    font-size: 12px;
    overflow-x: auto;
}

/* Markdown fallback toggle */
.markdown-fallback {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.markdown-fallback summary {
    cursor: pointer;
    color: #6366f1;
    font-size: 14px;
}

.markdown-content {
    margin-top: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
}

/* Enhanced streaming status */
.streaming-status-simple {
    padding: 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
    border-radius: 8px;
    animation: pulse 2s ease-in-out infinite;
}

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

.status-text {
    color: #1e40af;
    font-size: 14px;
}

/* Conversation info styling */
.conversation-info {
    background: #f0f9ff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: #0369a1;
    margin-top: 8px;
}

/* Platform change notification */
.platform-change-notification {
    animation: slideIn 0.3s ease-out;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .metrics-items {
        grid-template-columns: 1fr;
    }
    
    .response-table {
        font-size: 14px;
    }
    
    .response-table th,
    .response-table td {
        padding: 8px;
    }
    
    .actions-container {
        justify-content: stretch;
    }
    
    .action-button {
        flex: 1;
        text-align: center;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .structured-response {
        color: #e5e7eb;
    }
    
    .table-container,
    .metrics-container,
    .chart-container {
        background: #1f2937;
        border-color: #374151;
    }
    
    .response-table th,
    .table-title,
    .metrics-title,
    .chart-title {
        background: #111827;
        color: #f3f4f6;
    }
    
    .response-table td {
        border-color: #374151;
        color: #e5e7eb;
    }
    
    .response-table tr:hover {
        background: #111827;
    }
    
    .action-button {
        background: #1f2937;
        color: #e5e7eb;
        border-color: #374151;
    }
    
    .action-button:hover {
        background: #6366f1;
        color: white;
        border-color: #6366f1;
    }
    
    .metric-item {
        background: #111827;
        border-color: #374151;
    }
    
    .metric-label {
        color: #9ca3af;
    }
    
    .metric-value {
        color: #f3f4f6;
    }
}
