:root {
    --bth-cal-accent: #3374db; /* azul Betha */
    --bth-cal-accent-soft: #dfe9fb;
    --bth-cal-text: #242424;
    --bth-cal-muted: #9a9a9a;
    --bth-cal-hover: #f1f1f2;
    --bth-cal-success: #2e9d5b;
    --bth-cal-spring: cubic-bezier(.22, 1.2, .36, 1);
}

/* Campo  */
.bth-date {
    position: relative;
    width: 100%;
}

    .bth-date > input[type="date"] {
        padding-right: 36px !important;
    }

        /* esconde o ícone e o picker nativos (Chrome/Edge/Safari) */
        .bth-date > input[type="date"]::-webkit-calendar-picker-indicator {
            display: none;
            -webkit-appearance: none;
        }

.bth-date-btn {
    position: absolute;
    top: 50%;
    right: 5px;
    width: 26px;
    height: 26px;
    margin-top: -13px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #757576;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

    .bth-date-btn:hover:not([disabled]):not(.is-readonly),
    .bth-date.is-open .bth-date-btn {
        background: var(--bth-cal-accent-soft);
        color: var(--bth-cal-accent);
    }

    .bth-date-btn:focus-visible {
        outline: 0;
        box-shadow: 0 0 0 2px var(--bth-cal-accent);
    }

    .bth-date-btn[disabled],
    .bth-date-btn.is-readonly {
        cursor: not-allowed;
        opacity: .5;
    }

.bth-date-icon,
.bth-date-confirm {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    pointer-events: none;
}

.bth-date-icon {
    transition: transform .25s var(--bth-cal-spring), opacity .15s ease;
}

.bth-date-confirm {
    color: var(--bth-cal-success);
    opacity: 0;
    transition: opacity .2s ease;
}

    .bth-date-confirm path {
        stroke-dasharray: 24;
        stroke-dashoffset: 24;
    }

.bth-date.is-confirmed .bth-date-icon {
    opacity: 0;
    transform: scale(.4);
}

.bth-date.is-confirmed .bth-date-confirm {
    opacity: 1;
    animation: bth-date-pop .45s var(--bth-cal-spring) .1s both;
}

    .bth-date.is-confirmed .bth-date-confirm path {
        animation: bth-date-draw .35s cubic-bezier(.65, 0, .35, 1) .1s forwards;
    }

/* Popover */
.bth-cal {
    position: fixed;
    z-index: 999999;
    box-sizing: border-box;
    padding: 12px 12px 8px;
    background: #fff;
    border: 1px solid #ececed;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 14px;
    color: var(--bth-cal-text);
    outline: 0;
    transform-origin: top left;
    opacity: 0;
    transform: translateY(-4px) scale(.96);
}

    .bth-cal *,
    .bth-cal *::before,
    .bth-cal *::after {
        box-sizing: border-box;
    }

    .bth-cal.is-up {
        transform-origin: bottom left;
        transform: translateY(4px) scale(.96);
    }

    .bth-cal.is-open {
        opacity: 1;
        transform: translateY(0) scale(1);
        transition: opacity .2s ease-out, transform .25s var(--bth-cal-spring);
    }

    .bth-cal.is-closing {
        opacity: 0;
        transform: translateY(-4px) scale(.96);
        transition: opacity .15s ease-in, transform .15s ease-in;
    }

        .bth-cal.is-up.is-closing {
            transform: translateY(4px) scale(.96);
        }

    .bth-cal button {
        font-family: inherit;
        color: inherit;
        background: transparent;
        border: 0;
        padding: 0;
        margin: 0;
        cursor: pointer;
    }

        .bth-cal button:focus-visible {
            outline: 2px solid var(--bth-cal-accent);
            outline-offset: 1px;
        }

/* Cabeçalho */
.bth-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 0 2px 0 4px;
}

.bth-cal .bth-cal-title {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 30px;
    padding: 0 6px;
    margin-left: -6px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    transition: background-color .15s ease;
}

    .bth-cal .bth-cal-title:hover {
        background: var(--bth-cal-hover);
    }

.bth-cal-title-chevron {
    color: var(--bth-cal-accent);
    transition: transform .25s var(--bth-cal-spring);
}

.bth-cal[data-mode="years"] .bth-cal-title-chevron,
.bth-cal[data-mode="months"] .bth-cal-title-chevron {
    transform: rotate(90deg);
}

.bth-cal-nav {
    display: flex;
    gap: 2px;
}

    .bth-cal-nav button {
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        color: var(--bth-cal-accent) !important;
        transition: background-color .15s ease;
    }

        .bth-cal-nav button:hover:not([disabled]) {
            background: var(--bth-cal-accent-soft);
        }

        .bth-cal-nav button[disabled] {
            opacity: .3;
            cursor: default;
        }

.bth-cal[data-mode="years"] .bth-cal-nav {
    visibility: hidden;
}

/* Corpo */
.bth-cal-body {
    overflow: hidden;
}

.bth-cal-view.is-from-right {
    animation: bth-cal-from-right .28s cubic-bezier(.22, 1, .36, 1);
}

.bth-cal-view.is-from-left {
    animation: bth-cal-from-left .28s cubic-bezier(.22, 1, .36, 1);
}

.bth-cal-view.is-zoom {
    animation: bth-cal-zoom .22s cubic-bezier(.22, 1, .36, 1);
}

/* Grade de dias */
.bth-cal-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.bth-cal-wd {
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #757576;
}

.bth-cal .bth-cal-day {
    position: relative;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

    .bth-cal-day span {
        position: relative;
        z-index: 1;
        width: 34px;
        height: 34px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: background-color .15s ease, color .15s ease;
    }

    .bth-cal-day::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 34px;
        height: 34px;
        margin: -17px 0 0 -17px;
        border-radius: 50%;
        background: var(--bth-cal-accent);
        transform: scale(0);
    }

    .bth-cal-day:hover:not([disabled]) span {
        background: var(--bth-cal-hover);
    }

    .bth-cal-day.is-outside span {
        color: #b5b5b6;
    }

    .bth-cal-day.is-today span {
        background: var(--bth-cal-accent-soft);
        color: var(--bth-cal-accent);
        font-weight: 600;
    }

    .bth-cal-day.is-selected::before {
        transform: scale(1);
        transition: transform .24s var(--bth-cal-spring);
    }

    .bth-cal-day.is-selected span,
    .bth-cal-day.is-selected:hover span {
        background: transparent;
        color: #fff;
        font-weight: 600;
    }

.bth-cal:focus-visible .bth-cal-day.is-focus span {
    box-shadow: 0 0 0 2px var(--bth-cal-accent);
}

.bth-cal .bth-cal-day[disabled] {
    cursor: default;
}

    .bth-cal .bth-cal-day[disabled] span {
        color: #d2d2d3;
        text-decoration: line-through;
    }

/* Grade de meses / anos */
.bth-cal-grid3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px 0;
}

.bth-cal-years {
    max-height: 236px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.bth-cal .bth-cal-cell {
    height: 44px;
    border-radius: 10px;
    font-size: 14px;
    text-transform: capitalize;
    transition: background-color .15s ease, color .15s ease;
}

    .bth-cal .bth-cal-cell:hover:not([disabled]) {
        background: var(--bth-cal-hover);
    }

    .bth-cal .bth-cal-cell.is-today {
        color: var(--bth-cal-accent);
        font-weight: 600;
    }

    .bth-cal .bth-cal-cell.is-selected {
        background: var(--bth-cal-accent);
        color: #fff;
        font-weight: 600;
    }

    .bth-cal .bth-cal-cell[disabled] {
        color: #d2d2d3;
        cursor: default;
    }

/* Rodapé */
.bth-cal-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #f0f0f1;
}

.bth-cal .bth-cal-link {
    height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--bth-cal-accent);
    transition: background-color .15s ease;
}

    .bth-cal .bth-cal-link:hover {
        background: var(--bth-cal-accent-soft);
    }

    .bth-cal .bth-cal-link[data-act="clear"] {
        color: #757576;
    }

        .bth-cal .bth-cal-link[data-act="clear"]:hover {
            background: var(--bth-cal-hover);
        }

/* Keyframes */
@keyframes bth-cal-from-right {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes bth-cal-from-left {
    from { opacity: 0; transform: translateX(-24px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes bth-cal-zoom {
    from { opacity: 0; transform: scale(.94); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes bth-date-draw {
    to { stroke-dashoffset: 0; }
}

@keyframes bth-date-pop {
    0% { transform: scale(.6); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .bth-cal,
    .bth-cal *,
    .bth-cal *::before,
    .bth-date-icon,
    .bth-date-confirm,
    .bth-date-confirm path {
        transition: none !important;
        animation: none !important;
    }

    .bth-date.is-confirmed .bth-date-confirm path {
        stroke-dashoffset: 0;
    }
}
