body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.panel {
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 350px;
    background: #f0f2f5;
    border-right: 1px solid #ddd;
    z-index: 20;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

#sidebar.collapsed {
    transform: translateX(-100%);
}

#main-content {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

.icon-btn {
    position: absolute;
    top: 10px;
    right: -40px;
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

#sidebar.collapsed .icon-btn {
    transform: rotate(180deg);
}

.tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: #333;
    border-bottom-color: #333;
}

.tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    padding-right: 5px; /* Prevent scrollbar overlapping content too much */
}

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

h2 {
    margin-top: 0;
    font-size: 18px;
    color: #333;
}

#code-editor {
    height: 300px;
    font-family: 'Consolas', monospace;
    font-size: 14px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    margin-bottom: 10px;
}

#error-log {
    color: #d32f2f;
    font-size: 13px;
    min-height: 20px;
    margin-top: 10px;
    font-family: monospace;
}

#graph-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    cursor: grab;
}

#graph-container:active {
    cursor: grabbing;
}

.sidebar-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 10px;
    align-items: center;
    margin-bottom: 20px;
}

.sidebar-grid label {
    font-size: 13px;
    color: #555;
    text-align: right;
}

.sidebar-grid input {
    width: 100%;
    box-sizing: border-box;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.action-butt.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.preset-section h5 {
    margin-bottom: .5rem;
    color: #666;
}

.button-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.primary-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.secondary-btn {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.log-output {
    margin-top: 10px;
    font-family: 'Consolas', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    background: #f9f9f9;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #eee;
    min-height: 20px;
    max-height: 150px;
    overflow-y: auto;
}

.info-text {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    text-align: left;
    line-height: 1.4;
}

.control-group {
    margin-bottom: 15px;
}

.btn {
    flex: 1;
    padding: 6px;
    cursor: pointer;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.btn:hover {
    background: #f0f0f0;
}

#overlay-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 2rem;
    z-index: 100;
}

.button-group {
    display: flex;
    gap: .5rem;
}

#overlay-controls .btn-icon {
    position: static;
    width: 40px;
    aspect-ratio: 1;
    border-radius: 50%;
    font-size: 18px;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
    display: grid;
    place-items: center;
}

#overlay-controls .btn-icon:hover {
    background: #f0f0f0;
}

.toggle-wrapper {
    position: relative;
    cursor: pointer;
    margin: 0 2px;
}

.toggle-wrapper input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.toggle-wrapper .toggle-icon {
    display: grid;
    place-items: center;
    color: #999;
}

.toggle-wrapper:has(input:not(:checked)) .toggle-icon::after {
    content: '';
    position: absolute;
    width: 60%;
    height: 2px;
    background: #888;
    top: 50%;
    left: 20%;
    transform: rotate(-45deg);
}

.presets-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    margin-bottom: 10px;
}

.preset-btn, .structure-btn {
    background: #eef;
    border: 1px solid #ccd;
    color: #446;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
}

.preset-btn:hover, .structure-btn:hover {
    background: #dde;
}
#training-data-section {
    margin-top: 15px;
    border-top: 1px solid #ddd;
    padding-top: 10px;
}

#training-data-section h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
}

.data-row {
    display: flex;
    gap: 5px;
    align-items: center;
    margin-bottom: 8px;
}

.data-row input {
    font-family: monospace;
    font-size: 11px;
    padding: 3px 5px;
}

.data-row .btn-remove {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    color: #c62828;
    cursor: pointer;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

.data-row .btn-remove:hover {
    background: #ffcdd2;
    border-color: #ef9a9a;
}

.training-params-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px 0;
}

.param-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.param-group.full-width {
    grid-column: span 2;
}

.param-group label {
    font-size: 11px;
        font-weight: 600;
        color: #555;
    text-transform: uppercase;
}

.param-group input:not([type="checkbox"]), .param-group select {
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
}

.param-group input:focus, .param-group select:focus {
    border-color: #4a90e2;
    outline: none;
}

.data-section {
    margin-bottom: 15px;
    border-top: 1px solid #ddd;
    padding-top: 15px;
}

.section-header {
    padding: 0 0 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
}

.text-btn {
    background: none;
    border: none;
    color: #d32f2f;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
}
.text-btn:hover { text-decoration: underline; }

.data-list {
    background: white;
    margin-bottom: 10px;
    border-bottom: 1px solid #ddd;
    background: white;
    margin-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem;
    border-bottom: 1px solid #e0e0e0;
    font-size: 12px;
    font-family: monospace;
}

.data-item:last-child { border-bottom: none; }

.remove-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
}
.remove-btn:hover { color: #d32f2f; }

.add-data-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
}

.add-data-grid input {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px;
    font-family: monospace;
    font-size: 12px;
    outline: none;
}

.add-data-grid input:focus {
    border-color: #4a90e2;
    background: rgba(255, 255, 255, 0.5);
}

.empty-data-msg {
    padding: .5rem;
    text-align: left;
    color: #888;
    font-size: 12px;
    font-style: italic;
}

.overlay-back-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    border: 1px solid #ccc;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 100;
}

.overlay-back-btn:hover {
    background: #f0f0f0;
}

.train-results-container {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.status-header {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 13px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.status-header.waiting {
    border-bottom: none;
    text-align: center;
    color: #888;
    font-weight: 500;
    padding: 20px 0;
    margin: 0;
    font-size: 14px;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: .25rempx;
}

.data-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .5rem;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    font-family: monospace;
    background: #fdfdfd;
}

.data-item:hover {
    background: #f5f5f5;
}

.data-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.data-label {
    color: #888;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 600;

}

.card-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #555;
    font-family: monospace;
}

.progress-container {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

details.data-section {
    border: none;
    padding-block: 0;
    transition: padding 0.2s ease;
}

details.data-section:not([open]) {
    padding-bottom: 0;
    margin-bottom: 0;
}

details.data-section summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

details.data-section summary::-webkit-details-marker {
    display: none;
}

summary span {
    margin-bottom: 0rem;
}

.model-report {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
    font-family: monospace;
    font-size: 11px;
    white-space: pre-wrap;
    max-height: 250px;
    overflow-y: auto;
    color: #333;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
