/* Atomizer Dashboard Styles */

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

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

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

/* Header */
.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
}

.header-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.subtitle {
    opacity: 0.9;
    font-size: 0.95rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    gap: 2rem;
    padding: 2rem;
    max-width: 1800px;
    width: 100%;
    margin: 0 auto;
}

/* Sidebar */
.sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.sidebar-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.studies-list, .active-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.study-item {
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.study-item:hover {
    background: #f1f5f9;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.study-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.study-info {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.study-date {
    font-size: 0.85rem;
    color: var(--text-light);
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-secondary {
    background: var(--secondary);
    padding: 0.2rem 0.5rem;
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
}

.active-item {
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    border-left: 4px solid var(--success);
}

.active-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.active-status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.status-running {
    background: var(--success);
    color: white;
}

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

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

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--primary));
    transition: width 0.3s;
}

.active-progress {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Content Area */
.content-area {
    flex: 1;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    overflow-y: auto;
}

.welcome-screen {
    text-align: center;
    padding: 4rem 2rem;
}

.welcome-screen h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.welcome-screen p {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 3rem;
}

.quick-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Study Details */
.study-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.study-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.study-meta {
    color: var(--text-light);
    font-size: 0.9rem;
}

.study-actions {
    display: flex;
    gap: 0.75rem;
}

/* Result Cards */
.results-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.result-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.result-card h3 {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.result-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.params-list {
    font-size: 0.95rem;
}

.params-list div {
    margin-bottom: 0.5rem;
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.chart-card h3 {
    margin-bottom: 1rem;
    color: var(--text);
}

.chart-card canvas {
    max-height: 300px;
}

/* History Table */
.history-section {
    margin-top: 2rem;
}

.history-section h3 {
    margin-bottom: 1rem;
}

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: var(--bg);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    border-bottom: 2px solid var(--border);
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

tbody tr:hover {
    background: var(--bg);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

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

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-1px);
}

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

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

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-light);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.close-btn:hover {
    background: var(--bg);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

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

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

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Utility Classes */
.loading, .empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Study Configuration */
.study-config {
    display: none;
}

.config-steps {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.config-step {
    background: var(--bg);
    border-radius: 12px;
    padding: 1.5rem;
    border-left: 4px solid var(--primary);
}

.config-step h3 {
    color: var(--text);
    margin-bottom: 1rem;
}

.step-description {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.step-content {
    margin-top: 1rem;
}

.file-info {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.files-list {
    margin: 1rem 0;
    max-height: 200px;
    overflow-y: auto;
}

.file-item {
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-item .file-name {
    font-weight: 600;
}

.file-item .file-meta {
    font-size: 0.85rem;
    color: var(--text-light);
}

.expressions-list {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    max-height: 300px;
    overflow-y: auto;
}

.expression-item {
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

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

.expression-item.selected {
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
    border-color: var(--primary);
}

.expression-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.expression-meta {
    font-size: 0.85rem;
    color: var(--text-light);
}

.variables-config, .objectives-config, .constraints-config {
    margin: 1rem 0;
}

.config-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.config-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.config-item-title {
    font-weight: 600;
    color: var(--text);
}

.config-item-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.2rem;
}

.config-item-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.field-inline {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .charts-container {
        grid-template-columns: 1fr;
    }

    .config-item-fields {
        grid-template-columns: 1fr;
    }
}
