/* Evolution UI - Modern Dark Theme */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-card: #1c2128;
    --border-color: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-primary: #58a6ff;
    --accent-success: #3fb950;
    --accent-warning: #d29922;
    --accent-danger: #f85149;
    --accent-purple: #a371f7;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.5);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.project-selector {
    display: flex;
    gap: 8px;
}

.project-selector select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 200px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

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

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

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

.btn-primary:hover {
    background: #4c9aed;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

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

.btn-success:hover {
    background: #2ea043;
}

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

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

.btn-danger:hover {
    background: #da3633;
}

/* Main Content */
.main {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    text-align: center;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.empty-state h2 {
    font-size: 24px;
    margin-bottom: 12px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Project View */
.project-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Project Header */
.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.project-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.project-name {
    font-size: 24px;
    font-weight: 600;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.IDLE { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge.ANALYZE { background: rgba(163, 113, 247, 0.2); color: var(--accent-purple); }
.badge.PLAN { background: rgba(210, 153, 34, 0.2); color: var(--accent-warning); }
.badge.EXECUTE { background: rgba(88, 166, 255, 0.2); color: var(--accent-primary); }
.badge.REVIEW { background: rgba(63, 185, 80, 0.2); color: var(--accent-success); }
.badge.PAUSED { background: rgba(210, 153, 34, 0.2); color: var(--accent-warning); }
.badge.FINAL_REPORT { background: rgba(63, 185, 80, 0.2); color: var(--accent-success); }
.badge.ASK_USER { background: rgba(248, 81, 73, 0.2); color: var(--accent-danger); }

.project-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Status Info */
.status-info {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    align-items: center;
    flex-wrap: wrap;
}

.status-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-icon {
    font-size: 20px;
}

.status-message {
    font-size: 14px;
}

.status-message .highlight {
    color: var(--accent-primary);
    font-weight: 500;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
}

.progress-bar {
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-fill {
    height: 100%;
    background: var(--accent-success);
    transition: width 0.3s;
}

.progress-fill.warning {
    background: var(--accent-warning);
}

.progress-fill.danger {
    background: var(--accent-danger);
}

/* Current Activity */
.current-activity {
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.1), rgba(163, 113, 247, 0.1));
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.current-activity h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--accent-primary);
}

.activity-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.activity-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.step-icon {
    font-size: 20px;
}

.step-text {
    flex: 1;
}

.step-time {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

/* Two Column Layout */
.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.column {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px;
}

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

.section-header h3 {
    font-size: 14px;
    font-weight: 600;
}

/* Tasks Summary */
.tasks-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.task-group {
    margin-bottom: 12px;
}

.task-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.task-group-title {
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.task-group-count {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 6px;
}

.task-item:hover {
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.task-item.in-progress {
    border-left: 3px solid var(--accent-primary);
    background: rgba(88, 166, 255, 0.05);
}

.task-item.done {
    opacity: 0.6;
}

.task-item.blocked {
    border-left: 3px solid var(--accent-danger);
    background: rgba(248, 81, 73, 0.05);
}

.task-icon {
    font-size: 16px;
}

.task-content {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-meta {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.task-priority {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-tertiary);
}

.priority-high { color: var(--accent-danger); }
.priority-medium { color: var(--accent-warning); }
.priority-low { color: var(--accent-success); }

/* Activity Feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.empty-activity {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    font-size: 13px;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    font-size: 13px;
    border-left: 3px solid var(--border-color);
}

.activity-item.info { border-left-color: var(--accent-primary); }
.activity-item.success { border-left-color: var(--accent-success); }
.activity-item.warning { border-left-color: var(--accent-warning); }
.activity-item.error { border-left-color: var(--accent-danger); }

.activity-time {
    color: var(--text-muted);
    font-family: monospace;
    font-size: 11px;
    min-width: 60px;
}

.activity-text {
    flex: 1;
    line-height: 1.4;
}

/* Metrics Section */
.metrics-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px;
}

.metrics-section h3 {
    font-size: 14px;
    margin-bottom: 12px;
}

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

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-primary);
}

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 4px;
}

.metric-delta {
    font-size: 12px;
    margin-top: 4px;
}

.metric-delta.positive { color: var(--accent-success); }
.metric-delta.negative { color: var(--accent-danger); }
.metric-delta.neutral { color: var(--text-muted); }

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* Markdown */
.markdown-body {
    font-size: 14px;
    line-height: 1.6;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin-top: 24px;
    margin-bottom: 16px;
}

.markdown-body ul {
    padding-left: 24px;
}

.markdown-body code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.markdown-body pre {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-md);
    overflow-x: auto;
}

/* Debug Info */
.debug-info {
    background: linear-gradient(135deg, rgba(248, 81, 73, 0.1), rgba(210, 153, 34, 0.1));
    border: 1px solid var(--accent-warning);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-top: 16px;
}

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

.debug-header h4 {
    font-size: 14px;
    color: var(--accent-warning);
}

.debug-time {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

.debug-section {
    margin-bottom: 12px;
}

.debug-section h5 {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.debug-processes {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.debug-process {
    font-family: monospace;
    font-size: 11px;
    background: var(--bg-primary);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: nowrap;
}

.debug-log {
    margin-bottom: 8px;
}

.debug-log-file {
    font-size: 11px;
    color: var(--accent-primary);
    margin-bottom: 4px;
}

.debug-log-content {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.log-line {
    font-family: monospace;
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-secondary);
    padding: 2px 0;
}

/* Force Action Section */
.force-action-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* Cron Section */
.cron-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px;
    margin-top: 16px;
}

.cron-content {
    margin-top: 12px;
}

.cron-loading, .cron-empty, .cron-error {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.cron-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.cron-icon {
    font-size: 32px;
    opacity: 0.5;
}

.cron-jobs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cron-job {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.cron-job-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cron-project {
    font-weight: 600;
    font-size: 14px;
}

.cron-schedule {
    font-size: 12px;
    color: var(--text-muted);
}

.cron-job-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cron-badge {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
}

.cron-badge.enabled {
    background: rgba(63, 185, 80, 0.2);
    color: var(--accent-success);
}

.cron-badge.disabled {
    background: rgba(139, 148, 158, 0.2);
    color: var(--text-muted);
}

.cron-info {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
}

.cron-info p {
    margin-bottom: 8px;
}

.cron-info code {
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: monospace;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    z-index: 2000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success { border-left: 3px solid var(--accent-success); }
.toast-error { border-left: 3px solid var(--accent-danger); }
.toast-warning { border-left: 3px solid var(--accent-warning); }
.toast-info { border-left: 3px solid var(--accent-primary); }

/* Responsive */
@media (max-width: 1024px) {
    .two-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .header {
        flex-direction: column;
        gap: 12px;
    }
    
    .project-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .project-controls {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}
