/* Job Runner Dashboard Styles */

:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #a0aec0;
    --border-color: #e2e8f0;
    --primary: #3182ce;
    --primary-hover: #2b6cb0;
    --success: #38a169;
    --warning: #d69e2e;
    --danger: #e53e3e;
    --info: #00b5d8;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-sm: 4px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

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

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
}

.header-stats {
    display: flex;
    gap: 1.5rem;
    margin-left: auto;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.connection-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
}

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

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

/* Main Layout */
.main {
    display: grid;
    grid-template-columns: 280px 1fr 350px;
    gap: 1.5rem;
    padding: 1.5rem;
    flex: 1;
    overflow: hidden;
}

/* Panels */
.panel {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.panel-left {
    padding: 1rem;
}

.panel-section {
    margin-bottom: 1.5rem;
}

.panel-section:last-child {
    margin-bottom: 0;
}

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

.panel-header h2 {
    margin-bottom: 0;
}

.panel-center {
    overflow: hidden;
}

.panel-right {
    padding: 1rem;
    overflow-y: auto;
}

/* Job Types */
.job-types {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.job-type-btn {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.job-type-btn:hover {
    border-color: var(--primary);
    background: #f7fafc;
}

.job-type-btn.active {
    border-color: var(--primary);
    background: #ebf8ff;
}

.job-type-btn .job-type-name {
    font-weight: 500;
    display: block;
}

.job-type-btn .job-type-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Job Form */
.job-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.form-group .hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

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

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

.btn-danger:hover:not(:disabled) {
    background: #c53030;
}

/* Job List */
.job-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.job-card {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.job-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.job-card.selected {
    border-color: var(--primary);
    background: #ebf8ff;
}

.job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.job-id {
    font-weight: 600;
    color: var(--text-secondary);
}

.job-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.job-status {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

.job-status.pending {
    background: #edf2f7;
    color: var(--text-secondary);
}

.job-status.running {
    background: #bee3f8;
    color: #2b6cb0;
}

.job-status.completed {
    background: #c6f6d5;
    color: #276749;
}

.job-status.failed {
    background: #fed7d7;
    color: #c53030;
}

.job-status.cancelled {
    background: #feebc8;
    color: #c05621;
}

/* Progress Bar */
.progress-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}

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

.progress-fill.completed {
    background: var(--success);
}

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

.progress-message {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Job Details */
.job-details {
    font-size: 0.875rem;
}

.job-details .detail-section {
    margin-bottom: 1.5rem;
}

.job-details .detail-section h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.job-details .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.job-details .detail-label {
    color: var(--text-secondary);
}

.job-details .detail-value {
    font-weight: 500;
}

.job-details .progress-large {
    height: 24px;
    border-radius: 12px;
    margin: 1rem 0;
}

.job-details .progress-large .progress-fill {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.job-details .result-box {
    background: var(--bg-primary);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.job-details .error-box {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    color: var(--danger);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
}

/* Worker Info */
.worker-info {
    font-size: 0.875rem;
}

.worker-stat {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    color: var(--text-secondary);
}

/* Placeholder Text */
.placeholder-text {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: 2rem;
}

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

.job-status.running {
    animation: pulse 2s infinite;
}

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

    .panel-right {
        display: none;
    }
}

@media (max-width: 768px) {
    .main {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .header {
        flex-wrap: wrap;
    }

    .header-stats {
        width: 100%;
        justify-content: space-around;
        margin-top: 1rem;
    }
}
