body {
    background-color: #f4f4f4;
    font-family: Arial, sans-serif;
}

.sidebar {
    background-color: white;
    border-right: 1px solid #e0e0e0;
    height: 100vh;
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

#LINE {
    line-height: 1;
    text-align: center;
    white-space: pre;
    overflow: hidden;
    margin: 0;
}

.main-content {
    padding: 20px;
    background-color: #f9f9f9;
}

.grid-wrapper {
    display: flex;
    align-items: flex-start;
}

.grid-container-wrapper {
    display: flex;
    align-items: flex-start;
    max-width: 100%;
    overflow-x: auto;
}

.y-axis {
    display: flex;
    flex-direction: column;
    margin-right: 0;
}

.x-axis {
    margin-left: 0;
}

.x-axis-container {
    display: flex;
}

.y-axis {
    display: flex;
    flex-direction: column;
}

.grid-container {
    display: grid;
    gap: 0;
    background-color: #e0e0e0;
    border: 1px solid #ddd;
    margin-left: 0;
}

.grid-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    font-size: 0.8rem;
    border: 1px solid #e0e0e0;
    box-sizing: border-box;
}

.grid-item.active {
    background-color: #007bff;
    color: white;
}

.axis-label {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    font-weight: bold;
    font-size: 0.8rem;
    border: 1px solid #e0e0e0;
    box-sizing: border-box;
}

.nav-tabs .nav-link {
    color: #495057;
}

.nav-tabs .nav-link.active {
    background-color: #f9f9f9;
    border-color: #dee2e6 #dee2e6 #f9f9f9;
}

.steps-container {
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.initial-calc-container table {
    background-color: white;
    margin-top: 20px;
}

#mainIterationTableContent .table {
    font-size: 0.9rem;
    background-color: white;
}

#mainIterationTableContent .table thead {
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 1;
}

#mainIterationTableContent .table-container {
    max-height: 400px;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .sidebar {
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .row {
        flex-wrap: wrap;
    }
    
    .col-md-6 {
        width: 100%;
        margin-bottom: 20px;
    }
    
    .grid-wrapper {
        max-width: 100%;
        overflow-x: auto;
    }
}

#mainGridModeContent .row {
    margin: 0;
    max-width: 100%;
}

#mainGridModeContent .col-md-6 {
    padding: 10px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.grid-wrapper::after {
    content: '⇄';
    position: absolute;
    bottom: -20px;
    right: 10px;
    color: #888;
    font-size: 1.2rem;
    opacity: 0.5;
    pointer-events: none;
}

.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0069d9;
    border-color: #0062cc;
}

.table {
    margin-bottom: 0;
}

.table td, .table th {
    padding: 0.75rem;
    vertical-align: middle;
}

.tab-content {
    padding: 20px 0;
}

.tab-pane {
    padding: 15px 0;
}