@calendarMinWidth : 240px;

mor-calendar{
    display: block;
    user-select: none;

    header{
        .topbar{
            width: 100%;
            padding: 0.5em 0;
            position: relative;

            .prev-box,
            .next-box{
                position: absolute;
                top: 0.5em;
            }

            .prev,
            .next,
            .prev-year,
            .next-year{
                font-size: @fontSize*0.875;
                color: @colorNeutral8;

                &:hover{
                    cursor: pointer;
                    color: @colorNeutral10;
                }
            }

            .prev-box{
                left: 0.5em;
            }

            .next-box{
                right: 0.5em;
            }

            .yearmonth{
                text-align: center;

                .year,
                .month{
                    color: @colorNeutral8;
                    display: inline-block;

                    &:hover{
                        cursor: pointer;
                        color: @colorNeutral10;
                    }
                }

                .year{
                    margin-right: @fontSize*0.2;
                }
            }
        }

        .titlebar{
            .weekday,
            .title{
                border-top: 1px @colorComponentItemBorder solid;
                // border-bottom: 1px @colorComponentItemBorder solid;
                padding: @fontSize @fontSize*0.5;
            }

            .weekday{
                list-style: none;
                display: flex;
                justify-content: space-around;
                margin: 0;

                li{
                    display: inline-block;
                    font-size: @fontSize*0.75;
                    margin: 0;
                    color: @colorNeutral8;
                }
            }

            .title{
                text-align: center;
                font-size: @fontSize*0.75;
                color: @colorNeutral8;
            }
        }
    }

    .calendar{
        // padding-top: 0.5em;
        min-width: @calendarMinWidth;
    }

    .pick-day{
        display: flex;
        justify-content: space-around;
        flex-wrap: wrap;
        padding: 0 @fontSize*0.5 @fontSize*0.5 @fontSize*0.5;
    }

    .select-layer{
        display: inline-block;
        padding: 1px;
        width: 100%;
        font-size: 0;//@fontSize;
        box-sizing: border-box;
        vertical-align: top;
    }

    .inner-layer{
        display: inline-block;
        width: @fontSize*1.625;
        height: @fontSize*1.5;
        line-height: @fontSize*1.5;
        border-radius: @borderRadius;
        padding: 0;
        font-size: @fontSize*0.75;
        vertical-align: top;
        white-space: nowrap;
    }

    .day{
        width: calc(100% / 7);
        text-align: center;
        color: @colorNeutral11;
        margin: 1px 0;

        &.no-curt-m{
            color: @colorNeutral5;
            // background-color: @colorComponentItemBg;
        }
    }

    .p-mark-s::after{
        background: @colorSuccess;
    }

    .p-mark-w::after{
        background: @colorWarning;
    }

    .p-mark-d::after{
        background: @colorDanger;
    }

    .p-mark-p::after{
        background: @colorPrimary;
    }

    .p-mark-m::after{
        background: @colorMinor;
    }

    .p-mark-i::after{
        background: @colorInfo;
    }

    .p-mark-bk::after{
        background: @colorBlack;
    }

    each(range(11), {
        @colorName : 'colorNeutral@{value}';

        .p-mark-n@{value}::after{
            background: @@colorName;
        }
    });

    .p-mark-wh::after{
        background: @colorWhite;
    }

    .pick-month,
    .pick-year{
        display: flex;
        justify-content: space-around;
        flex-wrap: wrap;
    }

    .pick-month .month,
    .pick-year .year{
        display: flex;
        align-items: center;

        .inner-layer{
            display: flex;
            justify-content: center;
            width: 100%;
            height: 100%;
        }
    }

    .pick-month .month{
        width: calc(100% / 3);
        padding: 0;
        height: @fontSize*2.625;
        line-height: @fontSize*2.625;
        text-align: center;
        color: @colorNeutral10;

        &:hover{
            color: @colorBlack;
            background-color: @colorComponentItemBgHover;
            cursor: pointer;
        }
    }

    .pick-year .year{
        width: calc(100% / 5);
        padding: 0;
        height: @fontSize*2.125;
        line-height: @fontSize*2.125;
        text-align: center;
        color: @colorNeutral10;

        &:hover{
            color: @colorBlack;
            background-color: @colorComponentItemBgHover;
            cursor: pointer;
        }
    }

    .day{
        &.now{
            margin-bottom: 0;

            .inner-layer{
                color: @colorDarkTheme;
                border: 1px @colorDarkTheme solid;
                line-height: calc(@fontSize*1.5 - 2px);
                box-sizing: border-box;
            }
        }
    }

    .pick-month .month,
    .pick-year .year{
        &.now{
            margin-bottom: 0;

            .inner-layer{
                color: @colorDarkTheme;
                border: 1px @colorDarkTheme solid;
                line-height: calc(@fontSize*1.5 - 2px);
                box-sizing: border-box;
            }
        }
    }

    .day,
    .pick-month .month,
    .pick-year .year{
        &.highlight{
            margin-bottom: 0;

            .inner-layer{
                background-color: @colorTheme;
                color: @colorWhite;
            }
        }

        &.middle{
            .select-layer{
                background-color: lighten(@colorLightTheme, 25%);
            }

            &.bg-mark-disabled{
                .select-layer{
                    background-color: @colorComponentItemBg;
                }
            }
        }

        &.start{
            text-align: right;

            .inner-layer{
                background-color: @colorTheme;
                color: @colorWhite;
            }

            .select-layer{
                text-align: center;
                padding-right: calc(50% - 13px);
                background-color: lighten(@colorLightTheme, 25%);
                border-radius: @borderRadius 0 0 @borderRadius;
                width: auto;
            }
        }

        &.end{
            text-align: left;

            .inner-layer{
                background-color: @colorTheme;
                color: @colorWhite;
            }

            .select-layer{
                text-align: center;
                padding-left: calc(50% - 13px);
                background-color: lighten(@colorLightTheme, 25%);
                border-radius: 0 @borderRadius @borderRadius 0;
                width: auto;
            }
        }

        &.start.bg-mark-disabled,
        &.end.bg-mark-disabled{
            .inner-layer{
                background-color: @colorNeutral8;
            }

            .select-layer{
                background-color: @colorNeutral6;
            }
        }

        &.p-mark{
            position: relative;

            &::after{
                width: 4px;
                height: 4px;
                margin-left: -2px;
                border-radius: 4px;
                bottom: 1px;
                display: block;
                position: absolute;
                content: '';
                left: 50%;
            }
        }

        &.bg-mark-s{
            background: @colorSuccess !important;
            color: @colorWhite !important;

            &.no-curt-m{
                background: darken(@colorSuccess, 8%);
                color: fade(@colorWhite, 50%);
            }
        }

        &.bg-mark-w{
            background: @colorWarning !important;
            color: @colorWhite !important;

            &.no-curt-m{
                background: darken(@colorWarning, 8%);
                color: fade(@colorWhite, 50%);
            }
        }

        &.bg-mark-d{
            background: @colorDanger !important;
            color: @colorWhite !important;

            &.no-curt-m{
                background: darken(@colorDanger, 8%);
                color: fade(@colorWhite, 50%);
            }
        }

        &.bg-mark-p{
            background: @colorPrimary !important;
            color: @colorWhite !important;

            &.no-curt-m{
                background: darken(@colorPrimary, 8%);
                color: fade(@colorWhite, 50%);
            }
        }

        &.bg-mark-m{
            background: @colorMinor !important;
            color: @colorWhite !important;

            &.no-curt-m{
                background: darken(@colorMinor, 8%);
                color: fade(@colorWhite, 50%);
            }
        }

        &.bg-mark-i{
            background: @colorInfo !important;
            color: @colorWhite !important;

            &.no-curt-m{
                background: darken(@colorInfo, 8%);
                color: fade(@colorWhite, 50%);
            }
        }

        &.bg-mark-bk{
            background: @colorBlack !important;
            color: @colorWhite !important;

            &.no-curt-m{
                background: lighten(@colorBlack, 8%);
                color: fade(@colorWhite, 50%);
            }
        }

        each(range(11), {
            @colorName : 'colorNeutral@{value}';

            &.bg-mark-n@{value}{
                background: @@colorName !important;
                color: if((@value > 5), @colorWhite, @colorBlack) !important;

                &.no-curt-m{
                    background: lighten(@@colorName, 8%);
                    color: if((@value > 5), fade(@colorWhite, 50%), fade(@colorBlack, 50%));
                }
            }

        });

        &.bg-mark-wh{
            background: @colorWhite !important;
            color: @colorBlack !important;

            &.no-curt-m{
                background: lighten(@colorWhite, 8%);
                color: fade(@colorBlack, 50%);
            }
        }

        &.bg-mark-disabled {
            background: @colorNeutral3;
            cursor: default;
            color: fade(@colorBlack, 50%);

            &.no-curt-m{
                background: darken(@colorNeutral3, 8%);
                color: fade(@colorNeutral8, 40%);

                &:hover{
                    color: fade(@colorNeutral8, 40%) !important;
                }
            }

            &:hover{
                color: fade(@colorBlack, 50%) !important;
            }
        }
    }

    .pick-month .month,
    .pick-year .year{
        &.start{
            .select-layer{
                padding-right: 0;
                width: 100%;
            }
        }

        &.end{
            text-align: left;

            .inner-layer{
                background-color: @colorTheme;
                color: @colorWhite;
            }

            .select-layer{
                width: 100%;
                padding-left: 0;
            }
        }
    }

    &.mode-month{
        .pick-month .month{
            &:hover{
                color: @colorNeutral10;
                background-color: inherit;
                cursor: default;
            }
        }

        &.highlight-hover{
            .month{
                &:hover{
                    color: @colorDarkTheme;
                    font-weight: 700;
                }

                &.bg-mark-disabled:hover{
                    font-weight: 400;
                }
            }
        }
    }

    &.mode-year{
        .pick-year .year{
            &:hover{
                color: @colorNeutral10;
                background-color: inherit;
                cursor: default;
            }
        }

        &.highlight-hover{
            .year{
                &:hover{
                    color: @colorDarkTheme;
                    font-weight: 700;
                }

                &.bg-mark-disabled:hover{
                    font-weight: 400;
                }
            }
        }
    }

    &.mode-month,
    &.mode-year{
        .month,
        .year{
            .select-layer{
                display: inline-block;
                width: 100%;
                height: 100%;
                box-sizing: border-box;
                padding: 0;
                font-size: inherit;
            }

            .inner-layer{
                line-height: inherit !important;
                height: inherit !important;
                width: inherit !important;
            }
        }
    }

    &.highlight-hover{
        .calendar {
            .pick-day .day{
                &:hover{
                    color: @colorDarkTheme;
                    font-weight: 700;
                }

                &.bg-mark-disabled:hover{
                    font-weight: 400;
                }
            }
        }
    }

    // default status
    &{}
}
