.hexo-datepicker-container {
    position: relative;
    direction: rtl;
    font-family: inherit;
    box-sizing: border-box;
}

.hexo-datepicker-container *,
.hexo-datepicker-popup *,
.hexo-datepicker-container *::before,
.hexo-datepicker-popup *::before,
.hexo-datepicker-container *::after,
.hexo-datepicker-popup *::after {
    box-sizing: border-box;
}

.hexo-datepicker-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    background: #fff;
    font-family: inherit;
    direction: rtl;
}

.hexo-datepicker-input:focus {
    border-color: #4a90e2;
}

/* پاپ‌آپ */
.hexo-datepicker-popup {
    --hexo-core-datepicker-primary: #4a90e2;
    --hexo-core-datepicker-primary-light: #e8f0fe;
    --hexo-core-datepicker-border: #e0e0e0;
    --hexo-core-datepicker-text: #333;
    --hexo-core-datepicker-muted: #888;
    --hexo-core-datepicker-day-size: 40px;
    --hexo-core-datepicker-day-note-size: 9px;

    display: none;
    position: fixed;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 999999;
    padding: 16px;
    direction: rtl;
    user-select: none;
    width: max-content;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    overflow-x: auto;
    font-family: inherit;
    color: var(--hexo-core-datepicker-text);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.hexo-datepicker-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.hexo-datepicker-nav .hexo-datepicker-prev,
.hexo-datepicker-nav .hexo-datepicker-next {
    background: #fff;
    border: 1px solid var(--hexo-core-datepicker-border);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    font-size: 22px;
    line-height: 1;
    color: #444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    flex-shrink: 0;
    font-family: inherit;
    padding: 0;
    touch-action: manipulation;
}

.hexo-datepicker-nav .hexo-datepicker-prev:hover,
.hexo-datepicker-nav .hexo-datepicker-next:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

.hexo-datepicker-nav .hexo-datepicker-prev:focus-visible,
.hexo-datepicker-nav .hexo-datepicker-next:focus-visible {
    outline: 2px solid var(--hexo-core-datepicker-primary);
    outline-offset: 2px;
}

.hexo-datepicker-months {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.hexo-datepicker-month {
    text-align: center;
    flex-shrink: 0;
}

.hexo-datepicker-month-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--hexo-core-datepicker-text);
    line-height: 1.5;
}

.hexo-datepicker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, var(--hexo-core-datepicker-day-size));
    gap: 2px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--hexo-core-datepicker-muted);
}

.hexo-datepicker-weekdays div {
    width: var(--hexo-core-datepicker-day-size);
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hexo-datepicker-days {
    display: grid;
    grid-template-columns: repeat(7, var(--hexo-core-datepicker-day-size));
    gap: 2px;
}

.hexo-datepicker-days .hexo-datepicker-day {
    width: var(--hexo-core-datepicker-day-size);
    height: var(--hexo-core-datepicker-day-size);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    line-height: 1.1;
    color: var(--hexo-core-datepicker-text);
    transition: 0.15s;
    background: transparent;
    border: 1px solid transparent;
    outline: none;
    font-family: inherit;
    padding: 3px 2px;
    touch-action: manipulation;
}

.hexo-datepicker-days .hexo-datepicker-day:hover {
    background: #f0f0f0;
}

.hexo-datepicker-days .hexo-datepicker-day:focus-visible {
    outline: 2px solid var(--hexo-core-datepicker-primary);
    outline-offset: 2px;
}

.hexo-datepicker-days .hexo-datepicker-day.empty {
    cursor: default;
    pointer-events: none;
}

.hexo-datepicker-days .hexo-datepicker-day.today {
    border-color: var(--hexo-core-datepicker-primary);
    font-weight: 600;
}

.hexo-datepicker-days .hexo-datepicker-day.selected-start,
.hexo-datepicker-days .hexo-datepicker-day.selected-end {
    background: var(--hexo-core-datepicker-primary);
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
    border-color: var(--hexo-core-datepicker-primary);
}

.hexo-datepicker-days .hexo-datepicker-day.in-range {
    background: var(--hexo-core-datepicker-primary-light);
    border-radius: 0;
}

.hexo-datepicker-days .hexo-datepicker-day.disabled {
    color: #ccc;
    cursor: default;
    pointer-events: none;
    background: transparent;
}

.hexo-datepicker-days .hexo-datepicker-day.disabled.today {
    border-color: #ddd;
}

/* ---------- حالت موبایل ---------- */
@media (max-width: 600px) {
    .hexo-datepicker-popup {
        left: 8px;
        right: 8px;
        bottom: max(8px, env(safe-area-inset-bottom));
        top: auto;

        width: auto;
        max-width: none;
        max-height: min(80dvh, 520px);

        padding: 14px 12px 16px;
        border-radius: 18px 18px 14px 14px;
        overflow-y: auto;
        overflow-x: hidden;

        box-shadow: 0 -8px 35px rgba(0,0,0,0.18);
    }

    .hexo-datepicker-nav {
        width: 100%;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .hexo-datepicker-months {
        flex: 1;
        display: block;
        min-width: 0;
        gap: 0;
    }

    .hexo-datepicker-months .hexo-datepicker-month:nth-child(2) {
        display: none;
    }

    .hexo-datepicker-month {
        width: 100%;
    }

    .hexo-datepicker-month-title {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .hexo-datepicker-weekdays,
    .hexo-datepicker-days {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 3px;
        width: 100%;
    }

    .hexo-datepicker-weekdays div {
        width: auto;
        height: 26px;
        font-size: 12px;
    }

    .hexo-datepicker-days .hexo-datepicker-day {
        width: 100%;
        height: auto;
        min-height: 38px;
        aspect-ratio: 1 / 1;
        font-size: 14px;
        border-radius: 10px;
    }

    .hexo-datepicker-popup.has-day-notes .hexo-datepicker-days .hexo-datepicker-day {
        aspect-ratio: auto;
        min-height: 46px;
    }

    .hexo-datepicker-popup.has-day-notes .hexo-datepicker-days .hexo-datepicker-day.has-note {
        min-height: 50px;
        height: auto;
    }

    .hexo-datepicker-days .hexo-datepicker-day.in-range {
        border-radius: 8px;
    }

    .hexo-datepicker-nav .hexo-datepicker-prev,
    .hexo-datepicker-nav .hexo-datepicker-next {
        width: 34px;
        height: 34px;
        font-size: 20px;
    }
}

@media (max-width: 380px) {
    .hexo-datepicker-popup {
        left: 6px;
        right: 6px;
        padding: 12px 10px 14px;
    }

    .hexo-datepicker-days .hexo-datepicker-day {
        min-height: 34px;
        font-size: 13px;
    }

    .hexo-datepicker-popup.has-day-notes .hexo-datepicker-days .hexo-datepicker-day {
        min-height: 44px;
    }

    .hexo-datepicker-weekdays div {
        font-size: 11px;
    }
}
.hexo-datepicker-popup.has-day-notes {
    --hexo-core-datepicker-day-size: 54px;
}

.hexo-datepicker-days .hexo-datepicker-day.has-note {
    height: 52px;
}

.hexo-datepicker-days .hexo-datepicker-day .hexo-datepicker-day-number {
    display: block;
    line-height: 1.1;
}

.hexo-datepicker-days .hexo-datepicker-day .hexo-datepicker-day-note {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--hexo-core-datepicker-day-note-size);
    font-weight: 400;
    line-height: 1.1;
    color: inherit;
    opacity: .9;
    direction: rtl;
}

.hexo-datepicker-days .hexo-datepicker-day.selected-start .hexo-datepicker-day-note,
.hexo-datepicker-days .hexo-datepicker-day.selected-end .hexo-datepicker-day-note {
    opacity: 1;
    color: white;
}
