@import '../../style/themes/index';
@import '../../style/mixins/index';
@import '../../input/style/mixin';

@picker-prefix-cls: ~'@{acud-prefix}-picker';

.@{picker-prefix-cls} {
    @arrow-size: 10px;
    
    input {
        font-family: @font-family;
    }

    .reset-component();
    height: @date-picker-height;
    padding: 0 3*@P;
    position: relative;
    display: inline-flex;
    align-items: center;
    .basic-p-config(@date-picker-default-p);
    border-width: 1px;
    border-style: solid;
    border-radius: @R3;
    transition: border @animation-duration-slow, box-shadow @animation-duration-slow;

    &-focused {
        border-color: @B6;
    }

    &&-disabled {
        background: @G10;
        border-color: @G8;
        cursor: not-allowed;

        &.@{picker-prefix-cls}-range-has-value:hover, .@{picker-prefix-cls}-input-has-value:hover {
            .@{picker-prefix-cls}-suffix {
                opacity: 1;
            }
        }
    }

    &-status-error {
        border-color: @E6;

        &:hover {
            border-color: @E6;
        }
    }

    &&-disabled &-suffix {
        .property-setting(@date-picker-suffix-tp, 'disabled', color);
    }

    &&-borderless {
        background-color: transparent !important;
        border-color: transparent !important;
        box-shadow: none !important;
    }

    // ======================== Input =========================
    &-input {
        position: relative;
        display: inline-flex;
        align-items: center;
        width: 100%;
        height: @date-picker-height;

        >input {
            .input();
            flex: auto;
            min-width: 1px;
            font-size: @date-picker-font-size;
            font-weight: @date-picker-font-weight;
            height: 100%;
            padding: 0;
            background: transparent;
            border: 0;
            // max-width: 130px;
            .basic-tp-config(@date-picker-default-tp);

            &::-webkit-input-placeholder {
                .basic-tp-config(@date-picker-placeholder-tp);
            }
        
            &:-moz-placeholder {
                .basic-tp-config(@date-picker-placeholder-tp);
            }
        
            &::-moz-placeholder {
                .basic-tp-config(@date-picker-placeholder-tp);
            }
        
            &:-ms-input-placeholder {
                .basic-tp-config(@date-picker-placeholder-tp);
            }

            &[disabled] {
                color: @G4;

                &::placeholder {
                    color: @G4;
                }
            }
        }

        &:hover {
            .@{picker-prefix-cls}-clear {
                opacity: 1;
            }
        }

        &-has-value:not(.@{picker-prefix-cls}-clear-disabled) {
            &:hover {
                .@{picker-prefix-cls}-clear + .@{picker-prefix-cls}-suffix {
                    opacity: 0;
                }
            }
        }

        &-placeholder {
            >input {
                // color: @input-placeholder-color;
            }
        }
    }

    &-suffix {
        align-self: center;
        margin-left: (@padding-xs / 2);
        .basic-tp-config(@date-picker-suffix-tp);
        line-height: 1;
        pointer-events: none;

        >* {
            vertical-align: top;
        }

        > .@{iconfont-css-prefix} {
            width: 16px;
            height: 16px;

            svg {
                width: 100%;
            }
        }
    }

    &-clear {
        position: absolute;
        top: 49%;
        right: 0;
        // color: @disabled-color;
        line-height: 1;
        // background: @component-background;
        transform: translateY(-50%);
        cursor: pointer;
        opacity: 0;
        transition: opacity @animation-duration-slow, color @animation-duration-slow;

        >* {
            vertical-align: top;
        }

        &:hover {
            color: @text-color-secondary;
        }

        > .@{iconfont-css-prefix} {
            width: 4*@P;
            height: 4*@P;

            svg {
                width: 100%;
            }
        }
    }

    &-separator {
        position: relative;
        display: inline-block;
        width: 1em;
        height: @font-size-lg;
        // color: @disabled-color;
        font-size: @font-size-lg;
        vertical-align: top;
        cursor: default;

        .@{picker-prefix-cls}-focused & {
            color: @text-color-secondary;
        }

        .@{picker-prefix-cls}-range-separator & {
            color: @G6;
            .@{picker-prefix-cls}-disabled & {
                cursor: not-allowed;
            }
        }
    }

    // ======================== Range =========================
    &-range {
        position: relative;
        display: inline-flex;

        // Clear
        .@{picker-prefix-cls}-clear {
            // right: @input-padding-horizontal-base;
        }

        &:hover {
            .@{picker-prefix-cls}-clear {
                opacity: 1;
            }
        }

        .@{picker-prefix-cls}-clear {
            right: 3*@P;
        }



        // Active bar
        .@{picker-prefix-cls}-active-bar {
            bottom: -@border-width-base;
            height: 2px;
            // margin-left: @input-padding-horizontal-base;
            // background: @primary-color;
            opacity: 0;
            transition: all @animation-duration-slow ease-out;
            pointer-events: none;
        }

        &.@{picker-prefix-cls}-focused {
            .@{picker-prefix-cls}-active-bar {
                opacity: 1;
            }
        }

        &-separator {
            align-items: center;
            padding: 0 3*@P;
            line-height: 1;
        }

        &.@{picker-prefix-cls}-small {
            .@{picker-prefix-cls}-clear {
                // right: @input-padding-horizontal-sm;
            }

            .@{picker-prefix-cls}-active-bar {
                // margin-left: @input-padding-horizontal-sm;
            }
        }
    }

    &-range-has-value:not(&-clear-disabled) {
        &:hover {
            .@{picker-prefix-cls}-clear + .@{picker-prefix-cls}-suffix {
                opacity: 0;
            }
        }
    }

    // ======================= Dropdown =======================
    &-dropdown {
        .reset-component();
        position: absolute;
        position: absolute;
        z-index: @zindex-dropdown;

        &-hidden {
            display: none;
        }

        &-placement-bottomLeft {
            .@{picker-prefix-cls}-range-arrow {
                top: (@arrow-size / 2) - (@arrow-size / 3);
                display: block;
                transform: rotate(-45deg);
            }
        }

        &-placement-topLeft {
            .@{picker-prefix-cls}-range-arrow {
                bottom: (@arrow-size / 2) - (@arrow-size / 3);
                display: block;
                transform: rotate(135deg);
            }
        }

        &.slide-up-enter.slide-up-enter-active&-placement-topLeft,
        &.slide-up-enter.slide-up-enter-active&-placement-topRight,
        &.slide-up-appear.slide-up-appear-active&-placement-topLeft,
        &.slide-up-appear.slide-up-appear-active&-placement-topRight {
            animation-name: antSlideDownIn;
        }

        &.slide-up-enter.slide-up-enter-active&-placement-bottomLeft,
        &.slide-up-enter.slide-up-enter-active&-placement-bottomRight,
        &.slide-up-appear.slide-up-appear-active&-placement-bottomLeft,
        &.slide-up-appear.slide-up-appear-active&-placement-bottomRight {
            animation-name: antSlideUpIn;
        }

        &.slide-up-leave.slide-up-leave-active&-placement-topLeft,
        &.slide-up-leave.slide-up-leave-active&-placement-topRight {
            animation-name: antSlideDownOut;
        }

        &.slide-up-leave.slide-up-leave-active&-placement-bottomLeft,
        &.slide-up-leave.slide-up-leave-active&-placement-bottomRight {
            animation-name: antSlideUpOut;
        }
    }

    &-dropdown-range {
        padding: @P 0;

        &-hidden {
            display: none;
        }
    }

    // Time picker with additional style
    &-dropdown &-panel>&-time-panel {
        padding-top: (@padding-xs / 2);
    }

    // ======================== Ranges ========================
    &-ranges {
        margin-bottom: 0;
        padding: 0 3*@P 2*@P;
        overflow: hidden;
        // line-height: @picker-text-height - 2 * @border-width-base - (@padding-xs / 2);
        text-align: left;
        list-style: none;

        >li {
            display: inline-block;
        }
        .@{picker-prefix-cls}-preset>.@{acud-prefix}-tag-blue {
            // color: @primary-color;
            // background: @primary-1;
            // border-color: @primary-3;
            cursor: pointer;
        }

        .@{picker-prefix-cls}-now {
            float: left;
            cursor: pointer;
            margin-top: 10px;

            a {
                .basic-tp-config(tp2);
            }
        }

        .@{picker-prefix-cls}-ok {
            float: right;
            margin-left: @padding-xs;
            margin-top: 2*@P;
        }

        .acud-btn-sm-text-limited {
            min-width: 12*@P;
        }
    }

    &-range-wrapper {
        display: flex;
    }

    &-panel-container {
        overflow: hidden;
        vertical-align: top;
        background: #FFF;
        border-radius: @R4;
        box-shadow: @date-picker-shadow;
        transition: margin @animation-duration-slow;

        .@{picker-prefix-cls}-panels {
            display: inline-flex;
            flex-wrap: nowrap;
            direction: ltr;

            .@{picker-prefix-cls}-panel {
                .@{picker-prefix-cls}-header, .@{picker-prefix-cls}-body {
                    padding-right: 3*(@P/2);
                }

                &:last-child {
                    .@{picker-prefix-cls}-year-panel, .@{picker-prefix-cls}-month-panel {
                        .@{picker-prefix-cls}-header, .@{picker-prefix-cls}-body {
                            padding-right: 3*@P;
                        }
                    }
                }

                &:not(:first-child) {
                    .@{picker-prefix-cls}-header, .@{picker-prefix-cls}-body {
                        padding-left: 3*(@P/2);
                        padding-right: 3*@P;
                    }
                }
            }
        }

        .@{picker-prefix-cls}-panel {
            vertical-align: top;
            background: transparent;
            border-width: 0 0 @border-width-base 0;
            border-radius: 0;

            &-focused {
                // border-color: @border-color-split;
            }
        }
    }
}

@import './panel';
@import './rtl';
