table {
    margin: 0 0 20px;
}

#cwt-update-button, #cwt-update-button:focus {
    background: #42abae;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
}

#cwt-update-button:hover {
    background: #0c9399;
}

#cwt-reset-button, #cwt-toggle-controls-button {
    border-color: #42abae;
    color: #42abae;
    padding: 10px;
    background-color: white;
}

#cwt-reset-button:focus, #cwt-toggle-controls-button:focus {
    background: white;
    border-color: #42abae;
    color: #42abae;
}
#cwt-reset-button:hover, #cwt-toggle-controls-button:hover {
    background-color: #42abae;
    color: #fff;
}

#cwt-table-display {
    border-collapse: separate;
}

#cwt-table-display thead th {
    position: sticky;
    top: 0;
    background-color: #fff;
    z-index: 10;
    padding: 8px;
    border-bottom: 2px solid #ccc;
    color: #333;
    cursor: pointer;
    backface-visibility: hidden; /* Helps with re-painting issues */
    transform: translateZ(0); /* Force GPU acceleration */
    will-change: transform; /* Hints to the browser for smoother changes */
}

#toggleLabel {
    display: flex;
    align-items: center;
}

#toggleDisplayText {
    padding-left: 10px;
}

.cwt-controls {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
}

#toggleDisplayRaw {
    height: 20px;
    width: 20px;
    margin-left: 20px;
}

.cwt-table * {
    font-family: "Open Sans", sans-serif;
}

.cwt-table {
    max-width: 1200px;
    margin: 0 auto;
}

.cwt-slider {
    margin: 10px;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.slider-label {
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 10px;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
}

.cwt-slider input[type="range"] {
    width: 200px;
}

.cwt-weights {
    display: flex;
    flex-wrap: wrap;
}

.cwt-slider {
    width: calc(20% - 20px);
}

.table-container {
    max-height: 600px;
    overflow-y: auto;
    position: relative;
}

.sorted {
    background-color: #42abae;
    font-weight: bold;
    color: white;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    cursor: pointer;
    outline: none;
    overflow: hidden;
    border-radius: 16px;
}

/* Track: webkit browsers */
input[type="range"]::-webkit-slider-runnable-track {
    height: 15px;
    background: #ccc;
    border-radius: 16px;
}

/* Track: Mozilla Firefox */
input[type="range"]::-moz-range-track {
    height: 15px;
    background: #ccc;
    border-radius: 16px;
}

/* Thumb: webkit */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 15px;
    width: 15px;
    background-color: #fff;
    border-radius: 50%;
    border: 2px solid #42abae;
    box-shadow: -407px 0 0 400px #42abae;
}


/* Thumb: Firefox */
input[type="range"]::-moz-range-thumb {
    height: 15px;
    width: 15px;
    background-color: #fff;
    border-radius: 50%;
    border: 1px solid #42abae;
    box-shadow: -407px 0 0 400px #42abae;
}

/* Make the table horizontally scrollable */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Prevent line-wrapping inside the table so columns don't stack vertically */
.table-container table {
    white-space: nowrap;
}

/* Hide the "Raw Value" toggle */
#toggleLabel {
    display: none;
}


@media only screen and (max-width: 1200px) {
    .cwt-weights {
        flex-wrap: wrap;
    }

    .cwt-slider {
        width: 30%;
    }

    .cwt-slider input[type="range"] {
        width: 100%;
    }
}

@media only screen and (max-width: 768px) {
    .cwt-slider {
        width: 100%;
        margin: 10px 0;
    }
}

@media screen and (max-width: 768px) {
    .cwt-weights,
    .cwt-controls {
        display: none;
    }
    .cwt-table.show-controls .cwt-weights,
    .cwt-table.show-controls .cwt-controls {
        display: flex;
    }

    .cwt-toggle-controls-button {
        margin-bottom: 1em;
    }

    input[type="range"] {
        height: 23px;
        background-color: #ccc;
    }

    /* Thumb: webkit */
    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        /* Increase height and width for a larger thumb */
        height: 25px;
        width: 25px;
        background-color: #fff;
        border-radius: 50%;
        border: 3px solid #42abae;
        box-shadow: -407px 0 0 400px #42abae;
        /* Add margin-top to vertically center the larger thumb on the track */
        margin-top: -5px; /* (track_height - thumb_height) / 2 = (15 - 25) / 2 = -5 */
    }


    /* Thumb: Firefox */
    input[type="range"]::-moz-range-thumb {
        /* Increase height and width for a larger thumb */
        height: 25px;
        width: 25px;
        background-color: #fff;
        border-radius: 50%;
        border: 3px solid #42abae;
        box-shadow: -407px 0 0 400px #42abae;
        /* Firefox doesn't need the margin adjustment like webkit */
    }

}

@media only screen and (min-width: 769px) {
    #cwt-toggle-controls-button {
        display: none;
    }
}