:root {
    --level-1-bg: #ffffff;
    --level-2-bg: #ffffff;
    --level-3-bg: #ffffff;
    --level-4-bg: #ffffff;
    --level-1-header: #012f5d;
    --level-2-header: #135da8;
    --level-3-header: #2778c7;
    --level-4-header: #4fa7ff;
}

.abs-scale-page {
    padding: 20px;
    max-width: 100%;
}

.abs-scale-page h2 {
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}

.search-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.search-form .form-group {
    flex: 1;
    min-width: 200px;
}

.search-form .form-group label {
    font-weight: 500;
    margin-bottom: 5px;
    display: block;
    color: #555;
}

.search-form .form-control {
    width: 100%;
}

.search-form .btn {
    white-space: nowrap;
}

.table-section {
    margin-bottom: 30px;
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.redox-table, .solvent-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
}

.redox-table thead th,
.solvent-table thead th {
    background: var(--level-1-header);
    color: white;
    padding: 12px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
}

.redox-table tbody tr,
.solvent-table tbody tr {
    border-bottom: 1px solid #ddd;
    transition: background-color 0.2s;
}

.redox-table tbody tr:hover,
.solvent-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.redox-table td,
.solvent-table td {
    padding: 10px;
    vertical-align: middle;
}

.level-1 {
    background: var(--level-1-bg);
    color: #212529;
    font-weight: 500;
}

.level-2 {
    background: var(--level-2-bg);
    color: #212529;
    padding-left: 20px;
}

.level-3 {
    background: var(--level-3-bg);
    color: #212529;
    padding-left: 40px;
}

.level-4 {
    background: var(--level-4-bg);
    color: #212529;
    padding-left: 60px;
    font-size: 0.9em;
}

.hidden {
    display: none;
}

.btn-expand {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    padding: 5px 10px;
    transition: transform 0.2s;
    color: inherit;
}

.btn-expand:hover {
    transform: scale(1.2);
}

.substance-hover {
    cursor: help;
    position: relative;
    color: #3498db;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.substance-tooltip {
    position: absolute;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    pointer-events: none;
    max-width: 300px;
}

.substance-tooltip img {
    max-width: 100%;
    height: auto;
    display: block;
}

.plot-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.plot-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-weight: 500;
}

.plot-section canvas {
    max-width: 100%;
    height: auto;
}

input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

@media (max-width: 768px) {
    .search-form {
        flex-direction: column;
    }

    .search-form .form-group {
        width: 100%;
    }

    .table-section {
        font-size: 0.9em;
    }

    .redox-table td,
    .solvent-table td {
        padding: 8px;
    }
}

/* Nested wrappers (moved from inline styles) */
.nested {
    padding: 10px;
}
.level-2-wrap {
    padding: 15px;
    background: var(--level-2-bg);
}
.level-3-wrap {
    padding: 10px;
    background: var(--level-3-bg);
}
.level-4-wrap {
    padding: 10px;
    background: var(--level-4-bg);
}

/* Distinct header colors for nested tables */
.level-2-wrap thead th {
    background: var(--level-2-header); /* Bootstrap primary */
    color: #fff;
}
.level-3-wrap thead th {
    background: var(--level-3-header); /* Purple */
    color: #fff;
}
.level-4-wrap thead th {
    background: var(--level-4-header); /* Teal */
    color: #fff;
}

/* Small spacing for bulk action buttons */
.bulk-actions .btn {
    margin-right: 6px;
}