@import '~@thumbtack/thumbprint-tokens/dist/scss/_index';

.root {
    // Set 'inline-block' on the container to mimic react-day-picker's default behavior.
    display: inline-block;
}

.root :global(.rdp) {
    display: inline-block;
    text-align: left;
}

.root :global(.rdp-months) {
    display: table;
    border-collapse: collapse;
    border-spacing: 0;
    user-select: none;
}

.root :global(.rdp-caption) {
    // 24px (line-height) + 12px (margin-top/bottom) * 2 = 48px, which should match the size of
    // NavButton
    display: block;
    margin: 12px 0;
    font-size: 18px;
    line-height: 24px;
    font-weight: 700;
    position: relative;
}

.root :global(.rdp-caption_label) {
    display: inline-block;
}

.root :global(.rdp-nav) {
    display: inline;
    position: absolute;
    right: 0;
    top: -10px;
}

.root :global(.rdp-nav_button) {
    display: inline-block;
    width: 48px;
    height: 48px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 28px;
    cursor: pointer;
    -webkit-appearance: none;
    border: none;
    background-color: transparent;
}

.root :global(.rdp-head) {
    display: table-header-group;
}

.root :global(.rdp-head_row) {
    display: table-row;
}

.root :global(.rdp-head_cell) {
    display: table-cell;
    text-align: center;
    padding: 8px;
    font-size: 12px;
    line-height: 18px;
    font-weight: 700;
    color: $tp-color__black-300;
}

.root :global(.rdp-tbody) {
    display: table-row-group;
}

.root :global(.rdp-row) {
    display: table-row;
}

.root :global(.rdp-cell) {
    $cell-side: 48px;
    $line-height: 20px;
    $border-size: 1px;

    // IE11 does not seem to recognize the cell dimensions for absolutely positioning the dot
    // without the padding to fill the vertical space.
    $vertical-padding: ($cell-side - $line-height) * 0.5 - $border-size;

    display: table-cell;
    color: $tp-color__black;
    border: $border-size solid $tp-color__gray;
    text-align: center;
    cursor: pointer;
    vertical-align: middle;
    font-size: 14px;
    line-height: $line-height;
    font-weight: 400;
    height: $cell-side;
    width: $cell-side;
    min-width: 44px;
}

.root :global(.rdp-cell:has(div)) {
    border: 0;
}

.root :global(.rdp-day) {
    -webkit-appearance: none;
    border: none;
    width: 100%;
    height: 100%;
    background-color: transparent;
    color: $tp-color__black;
}

.root :global(.rdp-day_selected) {
    color: $tp-color__white;
    background-color: $tp-color__blue;
}

.root :global(.rdp-day_disabled) {
    color: $tp-color__gray !important;
    cursor: default;
}

.root :global(.rdp-day_outside) {
    cursor: default;
    border: 0;
}

.root :global(.rdp-tfoot) {
    display: table-caption;
    caption-side: bottom;
    padding-top: 8px;
}

.root :global(.DayPicker-Weekday) abbr {
    text-decoration: none;
}

.root :global(.rdp-day--theme-dot) {
    position: relative;

    &::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 4px;
        width: 6px;
        height: 6px;
        margin: 0 auto;
        display: inline-block;
        border-radius: 50%;
        background-color: $tp-color__blue;
    }
}

.root :global(.rdp-day--theme-dot.rdp-day_selected) {
    &::after {
        background-color: $tp-color__white;
    }
}

.root :global(.rdp-day--theme-strikeout) {
    text-decoration: line-through;
}
