/* Color scale thumbnails and pickers: wwwroot/scripts/helpers/colorscale-preview */

:root {
    --cs-surface: #fff;
    --cs-text: #333;
    --cs-muted: #777;
    --cs-placeholder: #999;
    --cs-border: #ccc;
    --cs-border-hover: #adadad;
    --cs-hover: #eef5fb;
    --cs-selected: #dbeaf7;
    --cs-hatch-light: #f2f2f2;
    --cs-hatch-dark: #e0e0e0;
}

/* Matches the dark palette of GeoCloud.css (#333 body and inputs, #3b3b3b panels) */
@media (prefers-color-scheme: dark) {
    :root {
        --cs-surface: #333;
        --cs-text: #fff;
        --cs-muted: #aaa;
        --cs-placeholder: #8c8c8c;
        --cs-border: #5a5a5a;
        --cs-border-hover: #7a7a7a;
        --cs-hover: #4e4e4e;
        --cs-selected: #2b4a66;
        --cs-hatch-light: #3b3b3b;
        --cs-hatch-dark: #4a4a4a;
    }
}

/* Thumbnail: color bar with the value range below */
.cs-thumb {
    display: inline-flex;
    flex-direction: column;
    width: 120px;
    vertical-align: middle;
}

.cs-thumb-bar {
    display: block;
    height: 10px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 2px;
}

.cs-thumb-range {
    display: flex;
    justify-content: space-between;
    margin-top: 1px;
    font-size: 10px;
    font-weight: normal;
    line-height: 12px;
    color: var(--cs-muted);
    font-variant-numeric: tabular-nums;
}

.cs-thumb-empty .cs-thumb-bar {
    background: repeating-linear-gradient(45deg, var(--cs-hatch-light), var(--cs-hatch-light) 4px, var(--cs-hatch-dark) 4px, var(--cs-hatch-dark) 8px);
}

.cs-thumb-empty .cs-thumb-range {
    justify-content: center;
    font-style: italic;
}

/* Thumbnails in the color scale lists of the wizards (.color-scale-item in GeoCloud.css). Clicks go to the item,
   whose handlers only look one level up, and the item's span rules must not resize the range labels. */
.color-scale-item .cs-thumb {
    flex: 0 0 120px;
    margin-right: 10px;
    pointer-events: none;
}

.color-scale-item .cs-thumb-range,
.color-scale-item .cs-thumb-range span {
    font-size: 10px;
    color: var(--cs-muted);
}

.color-scale-item.selected .cs-thumb-range,
.color-scale-item.selected .cs-thumb-range span {
    color: rgba(255, 255, 255, 0.85);
}

.color-scale-item.selected.blur .cs-thumb-range,
.color-scale-item.selected.blur .cs-thumb-range span {
    color: #555;
}

/* Color scale chart of the file info modal */
.file-info-colorscale-chart .cs-thumb {
    width: 100%;
}

.file-info-colorscale-chart .cs-thumb-bar {
    height: 20px;
}

.file-info-colorscale-chart .cs-thumb-range {
    font-size: 12px;
    line-height: 16px;
}

/* Legend button of a symbology (ColorScaleHelper.createSymbologyChartBtn); the checkbox inside is checked while the
   legend box is open */
.cs-legend-btn {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    color: #204e75;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    background-color: #fff;
    border: 1px solid #8fb0cf;
    border-radius: 4px;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

    .cs-legend-btn:hover {
        background-color: #eef5fb;
        border-color: #204e75;
    }

    .cs-legend-btn:focus-within {
        box-shadow: 0 0 0 2px rgba(102, 175, 233, 0.6);
    }

    .cs-legend-btn.active {
        color: #fff;
        background-color: #204e75;
        border-color: #204e75;
    }

    .cs-legend-btn input {
        position: absolute;
        width: 0;
        height: 0;
        opacity: 0;
    }

/* In the color scale lists: at the right end, unaffected by the item's span colors */
.color-scale-item .cs-legend-btn {
    order: 2;
    margin-left: auto;
}

.color-scale-item .cs-legend-btn span,
.color-scale-item.selected .cs-legend-btn span {
    font-size: inherit;
    color: inherit;
}

/* Picker: trigger button */
.cs-picker {
    position: relative;
    display: block;
    width: 100%;
}

.cs-picker-trigger {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 4px 30px 4px 10px;
    text-align: left;
    color: var(--cs-text);
    background-color: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: 4px;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

    .cs-picker-trigger:hover {
        border-color: var(--cs-border-hover);
    }

    .cs-picker-trigger:focus,
    .cs-picker-open .cs-picker-trigger {
        outline: 0;
        border-color: #66afe9;
        box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px rgba(102, 175, 233, 0.6);
    }

    .cs-picker-trigger .cs-thumb {
        flex: 0 0 120px;
    }

.cs-picker-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cs-picker-placeholder {
    color: var(--cs-placeholder);
    font-style: italic;
}

.cs-picker-caret {
    position: absolute;
    top: 50%;
    right: 11px;
    margin-top: -2px;
    border-top: 5px solid var(--cs-muted);
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
}

.cs-picker-compact .cs-picker-trigger {
    min-height: 28px;
    padding: 2px 26px 2px 8px;
    font-size: 12px;
}

/* Picker: list */
.cs-picker-popup {
    position: absolute;
    z-index: 1070;
    padding: 6px;
    color: var(--cs-text);
    background-color: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: 4px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.cs-picker-search {
    margin-bottom: 6px;
}

.cs-picker-list {
    max-height: 320px;
    overflow-y: auto;
}

.cs-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 8px;
    text-align: left;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 3px;
}

    .cs-picker-item:hover,
    .cs-picker-item:focus {
        outline: 0;
        background-color: var(--cs-hover);
    }

    .cs-picker-item .cs-thumb {
        flex: 0 0 140px;
        width: 140px;
    }

.cs-picker-item-selected {
    font-weight: 600;
    background-color: var(--cs-selected);
}

.cs-picker-empty {
    padding: 8px;
    color: var(--cs-placeholder);
    font-style: italic;
    text-align: center;
}
