/* === Calendar === */

.picker-calendar {
    background: #fff;
    height: 300px;
    width: 100%;
    overflow: hidden;
    @media (orientation: landscape) and (max-height: 415px) {
        &:not(.picker-modal-inline) {
            height: 220px;
        }
    }
    .picker-modal-inner {
        overflow: hidden;
    }
}

.picker-calendar-week-days {
    height: 18px;
    background: #f7f7f8;
    .flexbox();
    .hairline(bottom, #c4c4c4);
    font-size: 11px;
    box-sizing: border-box;
    position: relative;
    .picker-calendar-week-day {
        .flex-shrink(1);
        width: 100% / 7;
        width: ~"-webkit-calc(100% / 7)";
        width: ~"-moz-calc(100% / 7)";
        width: ~"calc(100% / 7)";
        line-height: 17px;
        text-align: center;
    }
    + .picker-calendar-months {
        height: ~"-webkit-calc(100% - 18px)";
        height: ~"-moz-calc(100% - 18px)";
        height: ~"calc(100% - 18px)";
    }
}

.picker-calendar-months {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.picker-calendar-months-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    transition: 300ms;
}

.picker-calendar-month {
    .flexbox();
    -webkit-box-orient: vertical;
    -moz-box-orient: vertical;
    -ms-flex-direction: column;
    -webkit-flex-direction: column;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
}

.picker-calendar-row {
    height: 100% / 6;
    height: ~"-webkit-calc(100% / 6)";
    height: ~"-moz-calc(100% / 6)";
    height: ~"calc(100% / 6)";
    .flexbox();
    .flex-shrink(1);
    width: 100%;
    position: relative;
    .hairline(bottom, #ccc);
    &:last-child {
        .hairline-remove(bottom);
    }
}

.picker-calendar-day {
    .flex-shrink(1);
    .flexbox();
    .justify-content(center);
    .align-items(center);
    box-sizing: border-box;
    width: 100% / 7;
    width: ~"-webkit-calc(100% / 7)";
    width: ~"-moz-calc(100% / 7)";
    width: ~"calc(100% / 7)";
    text-align: center;
    color: @color-text;
    font-size: 15px;
    cursor: pointer;
    &.picker-calendar-day-weekend {}
    &.picker-calendar-day-prev,
    &.picker-calendar-day-next {
        color: @color-text-gray-light;
    }
    .picker-calendar-month-prev &,
    .picker-calendar-month-next & {}
    &.picker-calendar-day-disabled {
        color: #d4d4d4;
        cursor: auto;
    }
    &.picker-calendar-day-today span {
        background: #e3e3e3;
    }
    &.picker-calendar-day-selected span {
        background: @color-primary;
        color: #fff;
    }
    span {
        display: inline-block;
        border-radius: 100%;
        width: 30px;
        height: 30px;
        line-height: 30px;
    }
}

.picker-calendar-month-picker,
.picker-calendar-year-picker {
    .flexbox();
    .align-items(center);
    .justify-content(space-between);
    width: 50%;
    max-width: 200px;
    .flex-shrink(10);
    a.icon-only {
        min-width: 36px;
    }
    span {
        .flex-shrink(1);
        position: relative;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

//
// 年份和月份选择器
// ===================================================================================
.picker-calendar-years-picker,
.picker-calendar-months-picker {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 15;
    transition-property: transform;
    transition-duration: .3s;
    transform: translate3d(0, 100%, 0);
    .hairline(top, @color-text-gray);
}

// 年份选择器
.picker-calendar-years-picker {
    .picker-calendar-years-picker-wrapper {
        position: relative;
        width: 100%;
        height: 100%;
        transition-property: transform;
        transition-duration: .3s;
    }
    .picker-calendar-years-group {
        position: absolute;
        top: 0;
        width: 100%;
        height: 100%;
    }
    .picker-calendar-row {
        height: 100% / 5;
        height: ~"-webkit-calc(100% / 5)";
        height: ~"-moz-calc(100% / 5)";
        height: ~"calc(100% / 5)";
    }
    .picker-calendar-year-unit {
        .flexbox();
        .align-items(center);
        flex: 1;
        text-align: center;
        span {
            display: block;
            width: 100%;
        }
        &.current-calendar-year-unit {
            background: #e3e3e3;
        }
        &.picker-calendar-year-unit-selected {
            color: #fff;
            background: @color-primary;
        }
    }
}

// 月份选择器
.picker-calendar-months-picker {
    .picker-calendar-months-picker-wrapper {
        position: relative;
        width: 100%;
        height: 100%;
        transition-property: transform;
        transition-duration: .3s;
    }
    .picker-calendar-months-group {
        position: absolute;
        top: 0;
        width: 100%;
        height: 100%;
    }
    .picker-calendar-row {
        height: 100% / 3;
        height: ~"-webkit-calc(100% / 3)";
        height: ~"-moz-calc(100% / 3)";
        height: ~"calc(100% / 3)";
    }
    .picker-calendar-month-unit {
        .flexbox();
        .align-items(center);
        flex: 1;
        text-align: center;
        span {
            display: block;
            width: 100%;
        }
        &.current-calendar-month-unit {
            background: #e3e3e3;
        }
        &.picker-calendar-month-unit-selected {
            color: #fff;
            background: @color-primary;
        }
    }
}

@media only screen and (-webkit-min-device-pixel-ratio: 2) {
    .picker-calendar-years-picker:before,
    .picker-calendar-months-picker:before {
        transform: scaleY(0.5);
    }
}

@media only screen and (-webkit-min-device-pixel-ratio: 3) {
    .picker-calendar-years-picker:before,
    .picker-calendar-months-picker:before {
        transform: scaleY(0.33);
    }
}

//修复toolbar
.picker-modal .toolbar-inner {
    height: 2.2rem;
    .flexbox();
    text-align: center;
}

//修复Android 4.1 上 toolbar元素宽度错误
//因为它不能对 inline 的元素设置宽度
.picker-calendar-month-picker,
.picker-calendar-year-picker {
    display: block;
    line-height: 2.2rem;
    a.icon-only {
        float: left;
        width: 25%;
        height: 2.2rem;
        line-height: 2rem; //不知道为什么 2.2rem 无法上下对齐；
    }
    .current-month-value,
    .current-year-value {
        float: left;
        width: 50%;
        height: 2.2rem;
    }
}
