﻿/* =========================================================
   Date picker for V2 pages (pio-date directive)
   Plugin: Content/plugins/bootstrap-datetimepicker (Eonasdan v4, made for
   Bootstrap 3). This file is the whole look - it does not need the
   plugin's own css - and it is in the ~/Content/css/templateV2/main bundle,
   so every V2 page gets the same picker.
   Wrap the input in <div class="pio-date">.
   Used by: signup birthday (pio-date="birthday") and the schedule date
   filters (desktop dropdown + mobile filter panel).
   ========================================================= */

.pio-date {
    --pdp-bg: #fff;
    --pdp-ink: #0a1525;
    --pdp-muted: #8a93a3;
    --pdp-line: #e8ebf0;
    --pdp-soft: #f3f5f8;
    --pdp-hover: rgba(5, 83, 134, .08);
    --pdp-accent: var(--pio-blue-color, #055386);
    --pdp-accent-2: #0a6aa8;
    --pdp-today: var(--pio-primary-color, #FFA000);
    --pdp-shadow: 0 18px 40px -16px rgba(10, 21, 37, .28), 0 2px 6px rgba(10, 21, 37, .06);
    position: relative;
}

body[data-bs-theme="dark"] .pio-date {
    --pdp-bg: #15181d;
    --pdp-ink: #f3f4f6;
    --pdp-muted: rgba(255, 255, 255, .45);
    --pdp-line: rgba(255, 255, 255, .1);
    --pdp-soft: rgba(255, 255, 255, .06);
    --pdp-hover: rgba(255, 255, 255, .08);
    --pdp-accent: #1f7fc0;
    --pdp-accent-2: #2b93d8;
    --pdp-shadow: 0 18px 40px -16px rgba(0, 0, 0, .7);
}

/* ---------- the field ---------- */

.pio-date .form-control,
.pio-date .form-control[readonly] {
    cursor: pointer;
    background-color: var(--pio-auth-field, #fff);
}

body[data-bs-theme="dark"] .pio-date .form-control,
body[data-bs-theme="dark"] .pio-date .form-control[readonly] {
    background-color: var(--pio-auth-field, transparent);
}

/* calendar icon at the end of the field (the signup field already has its
   own <i> icon, see .pio-auth-input-icon) */
.pio-date:not(.pio-auth-input-icon) > .form-control {
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a93a3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4.5' width='18' height='16' rx='3'/%3E%3Cpath d='M3 9.5h18M8 2.5v4M16 2.5v4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .85rem center;
    background-size: 18px 18px;
}

.pio-date .form-control:focus {
    border-color: var(--pdp-accent);
    box-shadow: 0 0 0 .2rem rgba(5, 83, 134, .15);
}

/* ---------- the popup card ---------- */

.pio-date .bootstrap-datetimepicker-widget {
    list-style: none;
}

.pio-date .bootstrap-datetimepicker-widget.dropdown-menu {
    display: block;
    width: 304px;
    min-width: 304px; /* filter menus set min-width:100% on every .dropdown-menu */
    max-width: 304px;
    margin: 8px 0;
    padding: 14px;
    border: 1px solid var(--pdp-line);
    border-radius: 18px;
    background: var(--pdp-bg);
    box-shadow: var(--pdp-shadow);
    font-family: inherit;
    font-size: .875rem;
    color: var(--pdp-ink);
    white-space: normal;
    text-overflow: clip;
    text-align: center;
    z-index: 1060;
    animation: pdpIn .16s ease-out;
}

@keyframes pdpIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pio-date .bootstrap-datetimepicker-widget.dropdown-menu {
        animation: none;
    }
}

/* the plugin draws little arrows for Bootstrap 3 - not needed here */
.pio-date .bootstrap-datetimepicker-widget.dropdown-menu::before,
.pio-date .bootstrap-datetimepicker-widget.dropdown-menu::after {
    display: none;
}

/* menus around the picker (e.g. the schedule filter) style their own
   li / hover - keep that out of the card */
.pio-date .bootstrap-datetimepicker-widget ul,
.pio-date .bootstrap-datetimepicker-widget li {
    margin: 0;
    padding: 0;
    list-style: none;
    background: none;
    border: 0;
}

/* screen-reader labels the plugin adds with ::after (Bootstrap 3 css) */
.pio-date .bootstrap-datetimepicker-widget .sr-only,
.pio-date .bootstrap-datetimepicker-widget th.prev::after,
.pio-date .bootstrap-datetimepicker-widget th.next::after,
.pio-date .bootstrap-datetimepicker-widget .picker-switch::after {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.pio-date .bootstrap-datetimepicker-widget table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0 2px;
    table-layout: fixed;
}

    .pio-date .bootstrap-datetimepicker-widget table th,
    .pio-date .bootstrap-datetimepicker-widget table td {
        width: auto;
        height: 38px;
        padding: 0;
        border: 0;
        border-radius: 12px;
        background: none;
        text-align: center;
        vertical-align: middle;
        line-height: 38px;
        color: inherit;
        text-shadow: none;
    }

/* ---------- header: < Month Year > ---------- */

.pio-date .bootstrap-datetimepicker-widget thead tr:first-child th {
    height: 36px;
    line-height: 36px;
    cursor: pointer;
}

/* a little air between the header and the grid */
.pio-date .bootstrap-datetimepicker-widget thead tr:first-child + tr th,
.pio-date .bootstrap-datetimepicker-widget .datepicker-months tbody tr:first-child td,
.pio-date .bootstrap-datetimepicker-widget .datepicker-years tbody tr:first-child td,
.pio-date .bootstrap-datetimepicker-widget .datepicker-decades tbody tr:first-child td {
    padding-top: 8px;
}

    /* the arrows: round buttons (styled on the th itself - font-awesome's js
       may swap the icon <span> for an <svg>) */
    .pio-date .bootstrap-datetimepicker-widget thead tr:first-child th.prev,
    .pio-date .bootstrap-datetimepicker-widget thead tr:first-child th.next {
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: 50%;
        background: var(--pdp-soft);
        color: var(--pdp-ink);
        font-size: .75rem;
        line-height: 36px;
        transition: background-color .15s ease, color .15s ease;
    }

        .pio-date .bootstrap-datetimepicker-widget thead tr:first-child th.prev:hover,
        .pio-date .bootstrap-datetimepicker-widget thead tr:first-child th.next:hover {
            background: var(--pdp-accent);
            color: #fff;
        }

    .pio-date .bootstrap-datetimepicker-widget thead tr:first-child th.picker-switch {
        width: auto;
        font-size: .9375rem;
        font-weight: 700;
        letter-spacing: .01em;
        color: var(--pdp-ink);
        transition: background-color .15s ease;
    }

        .pio-date .bootstrap-datetimepicker-widget thead tr:first-child th.picker-switch:hover {
            background: var(--pdp-hover);
        }

    .pio-date .bootstrap-datetimepicker-widget thead tr:first-child th.disabled,
    .pio-date .bootstrap-datetimepicker-widget thead tr:first-child th.disabled:hover {
        background: var(--pdp-soft);
        color: var(--pdp-ink);
        opacity: .3;
        cursor: default;
    }

/* styleRTL.css flips every FontAwesome chevron in RTL, and the pio-date
   directive already picks the RTL-correct chevrons - undo the flip here
   or the arrows point inwards */
body[dir="rtl"] .pio-date .bootstrap-datetimepicker-widget svg[class*="fa-chevron-"] {
    transform: none;
}

/* weekday names */
.pio-date .bootstrap-datetimepicker-widget table th.dow {
    height: 28px;
    line-height: 28px;
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--pdp-muted);
    cursor: default;
}

/* ---------- days ---------- */

.pio-date .bootstrap-datetimepicker-widget table td.day {
    position: relative;
    height: 38px;
    line-height: 38px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

    .pio-date .bootstrap-datetimepicker-widget table td.day:hover {
        background: var(--pdp-hover);
    }

    .pio-date .bootstrap-datetimepicker-widget table td.day.old,
    .pio-date .bootstrap-datetimepicker-widget table td.day.new {
        color: var(--pdp-muted);
        opacity: .5;
    }

    .pio-date .bootstrap-datetimepicker-widget table td.day.weekend:not(.active):not(.old):not(.new) {
        color: var(--pdp-ink);
    }

    /* today: small orange dot under the number (replaces the plugin's corner triangle) */
    .pio-date .bootstrap-datetimepicker-widget table td.today {
        font-weight: 700;
        color: var(--pdp-accent);
    }

        .pio-date .bootstrap-datetimepicker-widget table td.today::before {
            content: '';
            position: absolute;
            left: 50%;
            right: auto;
            bottom: 5px;
            width: 5px;
            height: 5px;
            margin-left: -2.5px;
            border: 0;
            border-radius: 50%;
            background: var(--pdp-today);
        }

    /* selected day */
    .pio-date .bootstrap-datetimepicker-widget table td.active,
    .pio-date .bootstrap-datetimepicker-widget table td.active:hover {
        background: linear-gradient(135deg, var(--pdp-accent), var(--pdp-accent-2));
        color: #fff;
        font-weight: 700;
        opacity: 1;
        box-shadow: 0 6px 14px -6px rgba(5, 83, 134, .6);
    }

        .pio-date .bootstrap-datetimepicker-widget table td.active.today::before {
            background: #fff;
        }

    .pio-date .bootstrap-datetimepicker-widget table td.disabled,
    .pio-date .bootstrap-datetimepicker-widget table td.disabled:hover {
        background: none;
        color: var(--pdp-muted);
        opacity: .3;
        box-shadow: none;
        cursor: not-allowed;
    }

/* ---------- month / year grids ---------- */

.pio-date .bootstrap-datetimepicker-widget .datepicker-months td,
.pio-date .bootstrap-datetimepicker-widget .datepicker-years td,
.pio-date .bootstrap-datetimepicker-widget .datepicker-decades td {
    height: auto;
    padding-top: 4px;
    line-height: normal;
}

    .pio-date .bootstrap-datetimepicker-widget .datepicker-months td:hover,
    .pio-date .bootstrap-datetimepicker-widget .datepicker-years td:hover,
    .pio-date .bootstrap-datetimepicker-widget .datepicker-decades td:hover {
        background: none;
    }

.pio-date .bootstrap-datetimepicker-widget table td span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(33.333% - 8px);
    height: 46px;
    margin: 4px;
    border: 1px solid var(--pdp-line);
    border-radius: 12px;
    background: none;
    font-weight: 600;
    line-height: 1.2;
    color: var(--pdp-ink);
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

    .pio-date .bootstrap-datetimepicker-widget table td span:hover {
        border-color: var(--pdp-accent);
        background: var(--pdp-hover);
    }

    .pio-date .bootstrap-datetimepicker-widget table td span.old {
        color: var(--pdp-muted);
        opacity: .55;
    }

    .pio-date .bootstrap-datetimepicker-widget table td span.active,
    .pio-date .bootstrap-datetimepicker-widget table td span.active:hover {
        border-color: transparent;
        background: linear-gradient(135deg, var(--pdp-accent), var(--pdp-accent-2));
        color: #fff;
        opacity: 1;
        box-shadow: 0 6px 14px -6px rgba(5, 83, 134, .6);
    }

    .pio-date .bootstrap-datetimepicker-widget table td span.disabled,
    .pio-date .bootstrap-datetimepicker-widget table td span.disabled:hover {
        border-color: var(--pdp-line);
        background: none;
        color: var(--pdp-muted);
        opacity: .35;
        box-shadow: none;
        cursor: not-allowed;
    }

.pio-date .bootstrap-datetimepicker-widget .datepicker-decades .decade {
    font-size: .75rem;
    line-height: 1.3 !important;
}

/* stop at the years view: the plugin's decades view (2000-2107 style
   ranges) is no use for these fields - years are paged with the arrows */
.pio-date .bootstrap-datetimepicker-widget .datepicker-years .picker-switch {
    pointer-events: none;
    cursor: default;
}

    .pio-date .bootstrap-datetimepicker-widget .datepicker-years .picker-switch:hover {
        background: none;
    }

/* filter menus (e.g. the schedule date filter) clip their items with
   overflow:hidden - let the item that holds a picker show it */
.dropdown-menu .dropdown-item:has(> .pio-date) {
    overflow: visible;
}

    .dropdown-menu .dropdown-item:has(> .pio-date):hover,
    .dropdown-menu .dropdown-item:has(> .pio-date):active {
        background: none;
        color: inherit;
    }

/* ---------- mobile filter panel ----------
   inside .pio-fab-filter-panel there is no room for a floating popup:
   show the calendar inline, full width, under the field (position:static
   also ignores the plugin's inline top/left) */
.pio-fab-filter-panel .pio-date .bootstrap-datetimepicker-widget.dropdown-menu {
    position: static !important;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: .5rem 0 0;
    padding: 10px;
    box-shadow: none;
    animation: none;
}

    .pio-fab-filter-panel .pio-date .bootstrap-datetimepicker-widget table td.day {
        height: 36px;
        line-height: 36px;
    }

/* small phones: keep the popup inside the screen */
@media (max-width: 360px) {
    .pio-date .bootstrap-datetimepicker-widget.dropdown-menu {
        width: 280px;
        min-width: 280px;
        max-width: 280px;
        padding: 10px;
    }
}

/* the field is read-only, and the browser skips read-only fields when it
   checks "required" - so mark an empty required picker from angular's state */
.was-validated .pio-date .form-control.ng-invalid {
    border-color: var(--bs-form-invalid-border-color, #dc3545);
}
