/* =========================================
   Karen Jalali Datepicker
========================================= */

.karen-jalali-datepicker {
    position: absolute;
    z-index: 999999;

    width: 320px;
    max-width: calc(100vw - 20px);

    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 16px;

    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);

    padding: 14px;

    direction: rtl;

    font-family: "Yekan Bakh", Tahoma, Arial, sans-serif;

    opacity: 0;
    visibility: hidden;

    transform: translateY(-5px);

    transition:
        opacity 0.18s ease,
        transform 0.18s ease,
        visibility 0.18s ease;
}

.karen-jalali-datepicker.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}


/* Header */

.karen-jalali-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 14px;
}


.karen-jalali-title {
    flex: 1;

    text-align: center;

    color: #155568;

    font-size: 17px;
    font-weight: 700;
}


.karen-jalali-nav {
    width: 36px;
    height: 36px;

    display: flex;

    align-items: center;
    justify-content: center;

    border: 0;

    border-radius: 10px;

    background: #f1f7f6;

    color: #155568;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}


.karen-jalali-nav:hover {
    background: #e1f0ed;
    transform: scale(1.05);
}


.karen-jalali-nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}


/* Weekdays */

.karen-jalali-weekdays {
    display: grid;

    grid-template-columns:
        repeat(7, 1fr);

    gap: 4px;

    margin-bottom: 6px;
}


.karen-jalali-weekday {
    height: 32px;

    display: flex;

    align-items: center;
    justify-content: center;

    color: #7b8794;

    font-size: 12px;

    font-weight: 600;
}


/* Days */

.karen-jalali-days {
    display: grid;

    grid-template-columns:
        repeat(7, 1fr);

    gap: 5px;
}


.karen-jalali-day {
    aspect-ratio: 1 / 1;

    min-width: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid transparent;

    border-radius: 10px;

    background: transparent;

    color: #263238;

    font-family: inherit;

    font-size: 14px;

    cursor: pointer;

    transition:
        background 0.18s ease,
        color 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}


button.karen-jalali-day:hover:not(:disabled) {
    background: #e9f7f5;

    color: #155568;

    border-color: #d5efe9;

    transform: translateY(-1px);
}


.karen-jalali-day.today {
    border-color: #1dba9f;

    color: #155568;

    font-weight: 700;
}


.karen-jalali-day.selected {
    background: #1dba9f;

    color: #ffffff;

    border-color: #1dba9f;

    font-weight: 700;
}


.karen-jalali-day.today.selected {
    background: #155568;

    border-color: #155568;

    color: #ffffff;
}


.karen-jalali-day.disabled {
    color: #c5cbd1;

    background: transparent;

    cursor: not-allowed;
}


.karen-jalali-day.empty {
    pointer-events: none;
}


/* Input */

#customDate {
    cursor: pointer;
    background: #ffffff;
}


#customDate::placeholder {
    color: #9ca3af;
}


#customDate:focus {
    border-color: #1dba9f;
    box-shadow: 0 0 0 3px rgba(29, 186, 159, 0.12);
}


/* Mobile */

@media (max-width: 600px) {

    .karen-jalali-datepicker {
        position: fixed;

        top: 50% !important;
        left: 50% !important;
        right: auto !important;

        width: calc(100vw - 30px);

        max-width: 360px;

        transform:
            translate(-50%, -48%);

        padding: 16px;
    }

    .karen-jalali-datepicker.is-open {
        transform:
            translate(-50%, -50%);
    }

    .karen-jalali-day {
        font-size: 14px;
    }

}