/* =========================================================
   JALALI VERTICAL WHEEL PICKER
   ========================================================= */

.jalali-datepicker {
    width: 270px;
    max-width: calc(100vw - 16px);

    padding: 6px;
    box-sizing: border-box;

    background: #0b0b0b;

    border: 1px solid #333;

    border-radius: 10px;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, .55);

    opacity: 0;
    visibility: hidden;

    transform:
        translateY(-6px)
        scale(.98);

    transition:
        opacity .2s ease,
        transform .2s ease,
        visibility .2s ease;

    /* IMPORTANT */
    z-index: 999999;

    direction: rtl;

    overflow: hidden;

    user-select: none;
    -webkit-user-select: none;

    /* Create a reliable stacking layer */
    isolation: isolate;
}


/* =========================================================
   SHOW
   ========================================================= */

.jalali-datepicker.show {
    opacity: 1;
    visibility: visible;

    transform:
        translateY(0)
        scale(1);

    z-index: 999999;
}


/* =========================================================
   FIELD CONTAINING OPEN PICKER
   ========================================================= */

/*
   When the picker is inside a .field, make that field
   appear above neighboring fields.
*/

.field:has(.jalali-datepicker.show) {
    position: relative;
    z-index: 1000000;
}


/* =========================================================
   COMMON FORM CONTAINERS
   ========================================================= */

/*
   Prevent parent containers from creating unnecessary
   clipping/stacking problems.
*/

.fields-grid,
.field {
    overflow: visible;
}


/* =========================================================
   HEADER
   ========================================================= */

.jalali-header {
    display: flex;
    align-items: center;
    justify-content: center;

    height: 22px;
    margin-bottom: 3px;
}


.jalali-month-year {
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 2px 5px;
}


/* =========================================================
   THREE COLUMNS
========================================================= */

.jalali-wheels {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 2px;
    width: 100%;
    height: 160px;
    position: relative;
    overflow: hidden;
}

/* =========================================================
   CENTER SELECTION LINES
========================================================= */

.jalali-wheels::before,
.jalali-wheels::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(162,28,67,.35);
    pointer-events: none;
    z-index: 10;
}

.jalali-wheels::before {
    top: 45%;
}

.jalali-wheels::after {
    top: calc(50% + 25px);
}

/* =========================================================
   COLUMN
========================================================= */

.jalali-column {
    position: relative;
    overflow: hidden;
}

/* =========================================================
   INDIVIDUAL WHEEL
========================================================= */

.jalali-wheel {
    width: 100%;
    height: 160px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
}

.jalali-wheel.dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

.jalali-wheel::-webkit-scrollbar {
    display: none;
}

/* =========================================================
   WHEEL ITEMS
========================================================= */

.jalali-wheel-item {
    width: 100%;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    color: #fdfdfd;
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
    scroll-snap-align: center;
    cursor: pointer;
    user-select: none;
    transition: 
        color .15s ease,
        font-size .15s ease,
        transform .15s ease;
}

.jalali-wheel-item:hover {
    color: #aaa;
}

/* =========================================================
   SELECTED
========================================================= */

.jalali-wheel-item.selected {
    color: #a21c43;
    font-size: 14px;
    font-weight: 700;
    transform: scale(1.03);
}

/* =========================================================
   FADE MASKS
========================================================= */

.jalali-column::before,
.jalali-column::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    height: 2px;
    z-index: 5;
    pointer-events: none;
color: #fff;
    background: #a21c43;

    border-radius: 10px;
}


/* Top underline */
.jalali-column::before {
    top: 0;
    transform: translateY(12px);
}



/* =========================================================
   SPACER CREATED BY JS
========================================================= */

.jalali-wheel-spacer {
    height: 65px;
    flex-shrink: 0;
    pointer-events: none;
}

/* =========================================================
   LABELS
========================================================= */

.jalali-wheel-label {
    text-align: center;
    margin-bottom: 2px;
    color: #fcfcfc;
    font-size: 9px;
    line-height: 1;
}

/* =========================================================
   OPEN UPWARD
========================================================= */

.jalali-datepicker.open-up {
    top: auto;
    bottom: calc(100% + 6px);
    transform: translateY(6px) scale(.98);
}

.jalali-datepicker.open-up.show {
    transform: translateY(0) scale(1);
}

/* =========================================================
   MOBILE
========================================================= */

@media(max-width: 640px) {
    .jalali-datepicker {
        width: 260px;
        max-width: calc(100vw - 12px);
        padding: 5px;
        border-radius: 9px;
    }

    .jalali-wheels {
        height: 150px;
        grid-template-columns: 1fr 1.15fr 1fr;
        gap: 1px;
    }

    .jalali-wheel {
        height: 150px;
    }

    .jalali-wheel-item {
        height: 28px;
        font-size: 11px;
    }

    .jalali-wheel-item.selected {
        font-size: 13px;
    }

    .jalali-wheel-label {
        font-size: 8px;
    }
}

/* =========================================================
   SMALL MOBILE
========================================================= */

@media(max-width: 380px) {
    .jalali-datepicker {
        width: 250px;
        max-width: calc(100vw - 10px);
        padding: 4px;
    }

    .jalali-wheels {
        height: 145px;
        grid-template-columns: 1fr 1.1fr 1fr;
    }

    .jalali-wheel {
        height: 145px;
    }

    .jalali-wheel-item {
        height: 27px;
        font-size: 10px;
    }

    .jalali-wheel-item.selected {
        font-size: 12px;
    }
}