:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --header-color: #2c3e50;
    --task-list-bg: #f9f9f9;
    --task-item-bg: #ffffff;
    --border-color: #dddddd;
    --adding-color: #e6ffe6;
    --removing-color: #ffe6e6;
    --notification-color: #ffff99;
    --notification-hover-color: #ffff66;
    --link-color: #0066cc;
    --link-hover-color: #004499;
    --link-visited-color: #551a8b;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --header-color: #61dafb;
    --task-list-bg: #2a2a2a;
    --task-item-bg: #333333;
    --border-color: #444444;
    --adding-color: #1a4d1a;
    --removing-color: #4d1a1a;
    --notification-color: #4d4d00;
    --notification-hover-color: #666600;
    --link-color: #61dafb;
    --link-hover-color: #2bb7da;
    --link-visited-color: #a25dbb;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar h1 {
    margin: 0;
    font-size: 1.5rem;
}

.navbar-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.navbar button {
    padding: 0.5rem 1rem;
    background-color: var(--header-color);
    color: var(--bg-color);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.navbar button:hover {
    opacity: 0.9;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
    padding-top: 80px;
}

h1,
h2 {
    color: var(--header-color);
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

a:visited {
    color: var(--link-visited-color);
}

.task-list {
    background-color: var(--task-list-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 20px;
}

.task-item {
    background-color: var(--task-item-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
}

.task-item:last-child {
    margin-bottom: 0;
}


.task-item {
    cursor: pointer;
}

.provenance-info {
    display: none;
    background-color: var(--task-list-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
}

.provenance-info h4 {
    margin-top: 0;
}

.provenance-info ul {
    padding-left: 20px;
}

.input-provenance-item {
    margin-bottom: 15px;
    border-left: 2px solid var(--border-color);
    padding-left: 10px;
}

.nested-object {
    margin-left: 20px;
}

.trace-list {
    background-color: var(--task-list-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 20px;
}

.trace-prefix {
    background-color: var(--task-item-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
}

.trace-prefix h4 {
    cursor: pointer;
    user-select: none;
}

.trace-prefix h4::before {
    content: '▶ ';
    display: inline-block;
    transition: transform 0.3s;
}

.trace-prefix.expanded h4::before {
    transform: rotate(90deg);
}

.table-wrapper {
    display: none;
}

.trace-prefix.expanded .table-wrapper {
    display: block;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.trace-prefix ul {
    padding-left: 20px;
}

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

.trace-table th,
.trace-table td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: left;
}

.trace-table th {
    position: sticky;
    top: 0;
    background-color: var(--header-color);
    color: var(--bg-color);
    z-index: 1;
}

.trace-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.trace-table .status-cell {
    max-width: 300px;
    white-space: normal;
    word-wrap: break-word;
}

.trace-table tr:nth-child(even) {
    background-color: var(--task-list-bg);
}

.trace-table tr:hover {
    background-color: var(--task-item-bg);
}

.trace-table .adding {
    background-color: var(--adding-color);
}

.trace-table .removing {
    background-color: var(--removing-color);
}

.trace-table .zero-count {
    font-weight: bold;
}

.trace-table .notification-row {
    background-color: var(--notification-color);
}

.trace-table .notification-row:hover {
    background-color: var(--notification-hover-color);
}

.table-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to top, var(--bg-color-alpha-80), transparent);
    pointer-events: none;
}

.notification-counter {
    background-color: var(--notification-color);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 10px;
    display: inline-block;
    margin-bottom: 10px;
}

.elapsed-time {
    font-weight: bold;
    color: #4a90e2;
    /* A nice blue color that stands out */
    background-color: rgba(74, 144, 226, 0.1);
    /* Light blue background */
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-left: 5px;
    transition: background-color 0.3s ease;
}

[data-theme="dark"] .elapsed-time {
    color: #61dafb;
    /* A brighter blue for dark mode */
    background-color: rgba(97, 218, 251, 0.1);
    /* Light blue background for dark mode */
}

.elapsed-time:hover {
    background-color: rgba(74, 144, 226, 0.2);
    /* Slightly darker on hover */
}

[data-theme="dark"] .elapsed-time:hover {
    background-color: rgba(97, 218, 251, 0.2);
    /* Slightly darker on hover for dark mode */
}

.user-input-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.user-request-tile {
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    padding: 10px;
    text-align: center;
    position: relative;
    transition: background-color 0.3s ease;
    background-color: var(--task-item-bg);
    color: var(--text-color);
}

.user-request-tile p {
    margin: 5px 0;
    color: var(--text-color);
}

.abort-button {
    border: none;
    background-color: #ff6666;
    color: white;
    padding: 3px 6px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 5px;
    transition: background-color 0.3s ease;
}

.user-request-tile.drag-over {
    background-color: var(--adding-color);
}

.abort-button:hover {
    background-color: #ff3333;
}

[data-theme="dark"] .abort-button {
    background-color: #b32d2d;
}

[data-theme="dark"] .abort-button:hover {
    background-color: #992626;
}

/* Worker execution status */

#worker-status {
    width: 100%;
}

.worker-row {
    display: grid;
    grid-template-columns: 15% 60% 25%;
    align-items: center;
    margin: 5px 0;
    gap: 10px;
    width: 100%;
}

.worker-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 5px;
}

.status-bars {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    height: 20px;
    width: 100%;
    margin: 0;
    justify-content: flex-start;
    overflow: hidden;
    padding: 0 5px;
}

.status-square {
    flex: 1 0 0;
    height: 100%;
    margin: 1px;
    min-width: 8px;
}

.status-square.completed {
    background: #4caf50;
}

.status-square.active {
    background: #2196f3;
}

.status-square.queued {
    background: #ff9800;
}

.status-square.failed {
    background: #f44336;
}

.worker-stats {
    text-align: right;
    white-space: nowrap;
    padding-left: 10px;
    /* Prevent overflow */
    overflow: hidden;
    /* Show ellipsis if text overflows */
    text-overflow: ellipsis;
}

/* Tabbed Display */
.tab-container {
    margin: 20px 0;
    width: 100%;
    box-sizing: border-box;
    /* Include padding in width */
}

.tab-header {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--border-color);
}

.tab-button {
    padding: 10px 20px;
    background: var(--task-list-bg);
    border: 1px solid var(--border-color);
    border-bottom: none;
    cursor: pointer;
    color: var(--text-color);
    border-radius: 4px 4px 0 0;
    box-sizing: border-box;
    flex: 1;
}

.tab-button.active {
    background: var(--bg-color);
    border-bottom: 2px solid var(--bg-color);
    margin-bottom: -2px;
    font-weight: bold;
}

.tab-content {
    display: none;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-top: none;
    background: var(--bg-color);
}

.tab-content.active {
    display: block;
}

.memory-stats {
    display: flex;
    gap: 1rem;
    color: var(--text-color);
    font-family: monospace;
    padding: 0.5rem;
    background-color: var(--task-list-bg);
    border-radius: 4px;
    margin-right: 1rem;
}

.memory-stats span {
    cursor: help;
}

/* Log Console Styles */
.worker-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 10px;
}

.log-console {
    background-color: var(--task-list-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    height: 300px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    margin-top: 20px;
}

.log-entry {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-timestamp {
    color: var(--header-color);
    white-space: nowrap;
    font-size: 0.85em;
    min-width: 80px;
}

.log-message {
    flex-grow: 1;
    word-break: break-word;
}

.log-message a {
    color: var(--link-color);
    text-decoration: underline;
}

.log-message a:hover {
    color: var(--link-hover-color);
}

.graph-selector {
    margin-right: 1rem;
}

.graph-selector select {
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--task-list-bg);
    color: var(--text-color);
    font-size: 0.9em;
    cursor: pointer;
}

.graph-selector select:hover {
    border-color: var(--header-color);
}