/* ------------
   Variables
   ------------ */

// $dayCellSize: 32px;
$timepickerWidth: 170px;
// $datepickerMinBodyHeight: 170px;
$timepickerBorderRadius: 4px;
$timepickerPadding: 4px;
$timepickerZIndex: 100;

$fontFamily: Tahoma;
$fontSize: 14px;

// $yearsPerRow: 4;

$textColor: (
//   button: #5cc4ef,
//   otherMonth: #dedede,
//   otherMonthInRange: #ccc,
//   disabled: #aeaeae,
  currentDate: #4EB5E6,
  common: #4a4a4a,
//   dayNames: #FF9A19,
//   navArrows: #9c9c9c
);

$bg: (
//   selected: #5cc4ef,
//   selectedHover: darken(#5cc4ef, 5),
//   inRange: rgba(#5cc4ef, .1),
  hover: #f0f0f0
);

$borderColor: (
  nav: #efefef,
  inline: #d7d7d7,
  default: #DBDBDB
);

// $navigationHeight: 32px;
// $navigationButtonsOffset: 2px;

$pointerSize: 10px;
$pointerOffset: 10px;

// // Transitions
$transitionSpeed: .3s;
$transitionEase: ease;
$transitionOffset: 8px;



/* -------------------------------------------------
    Timepicker
   ------------------------------------------------- */

.timepickers-container {
    position: absolute;
    left: 0;
    top: 0;
}

.timepicker {
    background: #FFFFFF;
    border: 1px solid map_get($borderColor, default);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    border-radius: $timepickerBorderRadius;
    box-sizing: content-box;
    font-family: $fontFamily, sans-serif;
    font-size: $fontSize;
    color: map_get($textColor, common);
    width: $timepickerWidth;
    position: absolute;
    left: -100000px;
    opacity: 0;
    transition: opacity $transitionSpeed $transitionEase,
                transform $transitionSpeed $transitionEase,
                left 0s $transitionSpeed;
    z-index: $timepickerZIndex;

    &.-from-top- {
        transform: translateY(-$transitionOffset);
    }
    &.-from-right- {
        transform: translateX($transitionOffset);
    }
    &.-from-bottom- {
        transform: translateY($transitionOffset);
    }
    &.-from-left- {
        transform: translateX(-$transitionOffset);
    }


    &.active {
        opacity: 1;
        transform: translate(0);
        transition: opacity $transitionSpeed $transitionEase, transform $transitionSpeed $transitionEase, left 0s 0s;
    }
}

.timepicker-inline {
    .timepicker {
        border-color: map-get($borderColor, inline);
        box-shadow: none;
        position: static;
        left: auto;
        right: auto;
        opacity: 1;
        transform: none;
    }

    .timepicker--pointer {
        display: none;
    }
}

.timepicker--content {
    box-sizing: content-box;
    padding: $timepickerPadding;
}

//  Pointer
// -------------------------------------------------
$pointerHalfSize: $pointerSize / 2 - 1;

.timepicker--pointer {
    position: absolute;
    background: #fff;
    border-top: 1px solid map-get($borderColor, default);
    border-right: 1px solid map-get($borderColor, default);
    width: $pointerSize;
    height: $pointerSize;
    z-index: -1;

    //  Main axis
    // -------------------------

    .-top-left- &, .-top-center- &, .-top-right- & {
        top: calc(100% - #{$pointerHalfSize});
        transform: rotate(135deg);
    }

    .-right-top- &, .-right-center- &, .-right-bottom- & {
        right: calc(100% - #{$pointerHalfSize});
        transform: rotate(225deg);
    }

    .-bottom-left- &, .-bottom-center- &, .-bottom-right- & {
        bottom: calc(100% - #{$pointerHalfSize});
        transform: rotate(315deg);
    }

    .-left-top- &, .-left-center- &, .-left-bottom- & {
        left: calc(100% - #{$pointerHalfSize});
        transform: rotate(45deg);
    }

  //  Secondary axis
  // -------------------------

    .-top-left- &, .-bottom-left- & {
        left: $pointerOffset;
    }
    .-top-right- &, .-bottom-right- & {
        right: $pointerOffset;
    }
    .-top-center- &, .-bottom-center- & {
        left: calc(50% - #{$pointerSize} / 2);
    }

    .-left-top- &, .-right-top- & {
        top: $pointerOffset;
    }
    .-left-bottom- &, .-right-bottom- & {
        bottom: $pointerOffset;
    }
    .-left-center- &, .-right-center- & {
        top: calc(50% - #{$pointerSize} / 2);
    }

}

//  Body
// -------------------------------------------------

.timepicker--body {
    display: none;

    &.active {
        display: block;
    }

    .timepicker--clearer {
        clear: both;
        display: block;
    }

    .timepicker--component-input {
        box-sizing: border-box;
        font-size: 1rem;
        float: left;
        height: 2rem;
        line-height: 1rem;
        padding: 0.5rem 0.25rem;
        text-align: center;

        &.timepicker--active-component-input {
            border: 1px solid #8A8A8A;
            background-color: #FEFEFE;
            /* outline: none; */
            box-shadow: 0 0 5px #CACACA;
            transition: box-shadow 0.5s,border-color 0.25s ease-in-out;
        }
    }

    .timepicker--time-separator,
    .timepicker--spacer {
        display: block;
        float: left;
        height: 2rem;
        line-height: 1.9rem;
        text-align: center;
    }

    &.timepicker--12h {
        .timepicker--component-input {
            margin: 2%;
            width: 26%;
        }

        .timepicker--time-separator,
        .timepicker--spacer {
            margin: 2% 0;
            width: 5%;
        }
    }
    &.timepicker--12h-seconds {}
    &.timepicker--24h {}
    &.timepicker--24h-seconds {}
}


//  Buttons
// -------------------------------------------------

.timepicker--buttons {
    display: flex;
    padding: $timepickerPadding;
    border-top: 1px solid map_get($borderColor, nav);
}

.timepicker--button {
    color: map_get($textColor, currentDate);
    cursor: pointer;
    border-radius: $timepickerBorderRadius;
    flex: 1;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    height: 32px;

    &:hover {
        color: map_get($textColor, common);
        background: map_get($bg, hover);
    }
}
