@import './ca-input.colors.scss';
// -------------------- Input Clear --------------------
.input-clear {
    position: absolute;
    right: 4px;
    top: 47%;
    transform: translateY(-50%);
    border-radius: 1px;
    display: none;
    z-index: 10;
    cursor: pointer;
    transition: 0.3s ease-in-out;

    .input-clear-x {
        svg {
            width: 18px !important;
            height: 18px !important;
            overflow: visible;

            path {
                fill: $default-path-clear;
            }

            rect {
                fill: $default-rect-clear;
                transition: transform 0.3s;
                transform: scale(1);
                transform-origin: center;
            }
        }

        &:hover {
            svg {
                overflow: visible;
                rect {
                    transform: scale(1.2);
                    transform-origin: center;
                    transition: transform 0.3s;
                    fill: $default-on-rect-clear-hover;
                }
            }
        }
    }

    &.datetimeclass {
        z-index: 22 !important;
    }

    &.focus {
        display: inline-block;
        .input-clear-x {
            svg {
                path {
                    fill: $default-focus-path-clear;
                }
                rect {
                    fill: $default-focus-rect-clear;
                }
            }

            &:hover {
                svg {
                    rect {
                        fill: $default-focus-on-rect-clear;
                    }
                }
            }
        }
    }

    &.valid-focus-in {
        display: inline-block;
        .input-clear-x {
            svg {
                path {
                    fill: $valid-focus-path-clear;
                }
                rect {
                    fill: $valid-focus-rect-clear;
                }
            }

            &:hover {
                svg {
                    rect {
                        fill: $valid-focus-on-rect-clear-hover;
                    }
                }
            }
        }
    }

    &.valid-focus-out {
        .input-clear-x {
            svg {
                path {
                    fill: $valid-path-clear;
                }
                rect {
                    fill: $valid-rect-clear;
                }
            }

            &:hover {
                svg {
                    rect {
                        fill: $valid-on-rect-clear-hover;
                    }
                }
            }
        }
    }

    &.invalid-focus-in {
        display: inline-block;
        .input-clear-x {
            svg {
                path {
                    fill: $invalid-focus-path-clear;
                }
                rect {
                    fill: $invalid-focus-rect-clear;
                }
            }
            &:hover {
                svg {
                    rect {
                        fill: $invalid-focus-on-rect-clear-hover;
                    }
                }
            }
        }
    }

    &.invalid-focus-out {
        .input-clear-x {
            svg {
                path {
                    fill: $invalid-path-clear;
                }
                rect {
                    fill: $invalid-rect-clear;
                }
            }
            &:hover {
                svg {
                    rect {
                        fill: $invalid-on-rect-clear-hover;
                    }
                }
            }
        }
    }

    &.incorrect-input {
        display: none;

        .input-clear-x {
            svg {
                path {
                    fill: $invalid-on-rect-clear-hover !important;
                }
                rect {
                    fill: $input-transparent-color !important;
                }
            }
            &:hover {
                display: inline-block;

                svg {
                    path {
                        fill: $default-path-clear !important;
                    }
                    rect {
                        fill: $invalid-on-rect-clear-hover !important;
                    }
                }
            }
        }
    }

    &.incorrect-input-on {
        display: inline-block;
        .input-clear-x {
            svg {
                path {
                    fill: $default-path-clear !important;
                }
                rect {
                    fill: $invalid-rect-clear !important;
                }
            }

            &:hover {
                svg {
                    path {
                        fill: $default-path-clear !important;
                    }
                    rect {
                        fill: $invalid-on-rect-clear-hover !important;
                    }
                }
            }
        }
    }

    // If dropdown
    &.dropdown-on {
        right: 27px !important;
        top: 50%;
        transform: translateY(-50%);

        svg-icon {
            display: flex;
        }
    }

    &.hidden {
        display: none;
    }

    // In Load MOdal Only For Now
    &.trash-can-svg {
        .input-clear-x {
            svg {
                width: 20px !important;
                height: 20px !important;
                position: relative;
                left: 1px;
                path {
                    fill: $default-trash-can;
                }
                rect {
                    fill: $default-trash-can;
                }
            }
            &:hover {
                svg {
                    path {
                        fill: $default-trash-can-hover;
                    }
                    rect {
                        fill: $default-trash-can-hover;
                    }
                }
            }
        }

        &::before {
            content: '';
            display: block;
            height: 16px;
            width: 1px;
            border-radius: 3px;
            background-color: $default-placeholderIcon-pipe;
            position: absolute;
            right: 22px;
            top: 56%;
            transform: translateY(-50%);
        }

        &.valid-focus-in {
            display: none;
            .input-clear-x {
                svg {
                    path {
                        fill: $valid-focus-trash-can;
                    }
                    rect {
                        fill: $valid-focus-trash-can;
                    }
                }
                &:hover {
                    svg {
                        path {
                            fill: $valid-focus-trash-can-hover;
                        }
                        rect {
                            fill: $valid-focus-trash-can-hover;
                        }
                    }
                }
            }

            &::before {
                background-color: $valid-focus-placeholderIcon-pipe;
            }
        }

        &.valid-focus-out {
            .input-clear-x {
                svg {
                    path {
                        fill: $valid-trash-can;
                    }
                    rect {
                        fill: $valid-trash-can;
                    }
                }
                &:hover {
                    svg {
                        path {
                            fill: $valid-trash-can-hover;
                        }
                        rect {
                            fill: $valid-trash-can-hover;
                        }
                    }
                }
            }

            &::before {
                background-color: $valid-placeholderIcon-pipe;
            }
        }
    }
}

.input-clear-dispatch {
    position: absolute;
    right: 0px;
    top: 47%;
    display: flex;
    justify-content: center;
    align-items: center;

    width: 26px;
    height: 26px;

    transform: translateY(-50%);
    border-radius: 2px;
    z-index: 10;
    cursor: pointer;
    transition: background 0.3s ease-in-out;

    svg-icon {
        svg {
            display: flex;
            width: 12px !important;
            height: 12px !important;

            path {
                fill: $default-placeholderIcon;
                transition: fill 0.3s ease-in-out;
            }
        }
    }

    &:hover {
        background-color: $input-clear-dispatch-hover;

        svg-icon {
            svg {
                path {
                    fill: $default-on-input-hover;
                }
            }
        }
    }
}
