/**
 * Copyright (c) Enalean, 2018-Present. All Rights Reserved.
 *
 * This file is a part of Tuleap.
 *
 * Tuleap is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Tuleap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
 */

@use "sass:color";
@use "sass:map";
@use "pkg:@tuleap/tlp-swatch-colors";
@use "pkg:@tuleap/plugin-tracker-static-list-colors";

.tracker-colorpicker {
    cursor: pointer;
}

.old-color-picker-preview {
    width: 16px;
    height: 16px;
    border: 0;
    vertical-align: middle;
}

.colorpicker-row {
    line-height: 0;
    text-align: center;

    > .colorpicker-circular-color:first-child {
        margin: 12px 12px 14px 0;
    }

    > .colorpicker-circular-color:last-child {
        margin: 12px 0 14px 12px;
    }
}

.colorpicker-row-no-color {
    display: flex;
    align-items: center;
    padding: 0 0 0 12px;

    > .colorpicker-circular-no-color {
        margin-bottom: 12px;
        border: 3px solid #d8d8d8;
        background: linear-gradient(135deg, #ffffff 44%, #d8d8d8 45%, #d8d8d8 55%, #ffffff 56%);

        &.colorpicker-no-color-selected {
            background: linear-gradient(135deg, #ffffff 50%, #ffffff 50%);
            color: #d8d8d8;
        }
    }

    > .colorpicker-row-no-color-label {
        display: inline-block;
        position: relative;
        top: 1px;
        color: #787878;
        font-size: 12px;
        cursor: pointer;

        &:hover {
            color: color.adjust(#787878, $lightness: - 20%);
        }
    }
}

.colorpicker-circular-color {
    display: inline-block;
    width: 15px;
    height: 15px;
    margin: 12px 12px 14px;
    border-radius: 50%;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
}

.colorpicker-circular-color::before {
    display: inline-block;
    position: relative;
    top: 1px;
}

.color-picker-preview {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin: 0;
    border: 1px solid #e3e5ed;
    vertical-align: middle;
}

@each $color-name, $colors in tlp-swatch-colors.$color-map {
    .colorpicker-circular-color-#{$color-name} {
        border: 3px solid map.get($colors, "primary");
        background-color: map.get($colors, "secondary");
        color: map.get($colors, "primary");
    }

    .color-picker-preview-#{$color-name} {
        border: 0;
        background-color: map.get($colors, "primary");
    }
}
