/**
 * Styles for Multi-Agent Research & Report Generator
 * Clean, modern, responsive design
 */

/* CSS Variables for theming */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --background: #f8fafc;
    --surface: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
    font-size: 16px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Section */
.section {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* Concept Section */
.concept-box p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.workflow-diagram {
    background: var(--background);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 2rem 0;
    overflow-x: auto;
}

.agent-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    min-width: 800px;
}

.agent-step {
    background: var(--surface);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    min-width: 120px;
    box-shadow: var(--shadow-sm);
}

.agent-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.agent-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.agent-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.arrow {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: bold;
}

.agent-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.agent-detail-card {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.agent-detail-card strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.5rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

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

.required {
    color: var(--error-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--surface);
}

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

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #475569;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

/* Status Messages */
.status-message {
    display: inline-block;
    margin-left: 1rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
}

.status-success {
    background: #d1fae5;
    color: #065f46;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}

.status-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Progress Section */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--background);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    width: 0%;
    transition: width 0.5s ease;
}

.current-agent {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 1rem;
    background: var(--background);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    text-align: center;
}

.current-agent.active {
    background: #dbeafe;
    color: var(--info-color);
    animation: pulse 2s infinite;
}

.current-agent.completed {
    background: #d1fae5;
    color: var(--success-color);
}

.current-agent.error {
    background: #fee2e2;
    color: var(--error-color);
}

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

.progress-log {
    max-height: 400px;
    overflow-y: auto;
    background: var(--background);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.log-entry {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    border-left: 3px solid var(--info-color);
    background: var(--surface);
}

.log-working {
    border-left-color: var(--info-color);
}

.log-completed {
    border-left-color: var(--success-color);
}

.log-error {
    border-left-color: var(--error-color);
    background: #fef2f2;
}

/* Output Section */
.output-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.final-report {
    background: var(--background);
    padding: 2rem;
    border-radius: var(--border-radius);
    line-height: 1.8;
    max-height: 600px;
    overflow-y: auto;
}

.final-report h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.final-report h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.final-report h3 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.final-report p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.final-report ul,
.final-report ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.final-report li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.final-report code {
    background: var(--surface);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.final-report pre {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin-bottom: 1rem;
}

/* Execution Graph */
.execution-graph {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.execution-graph-empty {
    color: var(--text-secondary);
    font-style: italic;
    padding: 1rem;
}

.execution-steps {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem;
}

.execution-step {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    min-width: 180px;
    max-width: 320px;
}

.execution-step-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.execution-step-number {
    background: var(--primary-color);
    color: white;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.execution-step-emoji {
    font-size: 1.2rem;
}

.execution-step-agent {
    flex: 1;
}

.execution-output {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    max-height: 4em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.execution-arrow {
    color: var(--secondary-color);
    font-size: 1.25rem;
    align-self: center;
    flex-shrink: 0;
}

/* API Output */
.api-output-actions {
    margin-bottom: 0.75rem;
}

.api-output {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: white;
    margin-top: 1rem;
    font-size: 1.125rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

    .header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .section {
        padding: 1.5rem;
    }

    .section h2 {
        font-size: 1.5rem;
    }

    .agent-flow {
        flex-direction: column;
        min-width: auto;
    }

    .arrow {
        transform: rotate(90deg);
    }

    .agent-details {
        grid-template-columns: 1fr;
    }

    .output-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .final-report {
        padding: 1rem;
    }
}

/* Print Styles */
@media print {
    .header,
    .section:not(#output-section),
    .output-actions,
    .footer {
        display: none;
    }

    .final-report {
        max-height: none;
        box-shadow: none;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}
