/* =====================================================================
   انتخابگر چرخی تاریخ و ساعت (WheelDatePicker / WheelTimePicker / WheelDateRangePicker)
   - رنگ‌ها از متغیرهای تم ادمین (--primary, --border, ...) می‌آیند و fallback دارند.
   - پنجره‌ی باز شده (.wp-overlay) به body منتقل می‌شود؛ متغیرهای تم را wheel-picker.js همراهش می‌برد.
   ===================================================================== */

/* ---------- دکمه‌ی نمایش مقدار ---------- */
.wp {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.wp-label {
    font-size: 12px;
    color: var(--text-muted, #5f7a90);
}

.wp-control {
    position: relative;
    display: flex;
    align-items: center;
}

.wp-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 6px 12px;
    border: 1.5px solid var(--border, #bcd3e0);
    border-radius: 12px;
    background: var(--bg-soft, #f4f9fc);
    color: var(--text, #0b2540);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

    .wp-trigger:hover:not(:disabled) {
        border-color: var(--accent-light, #7dd3fc);
    }

    .wp-trigger:focus-visible {
        outline: none;
        border-color: var(--primary, #0e7490);
        box-shadow: 0 0 0 4px var(--primary-light, rgba(14, 116, 144, .15));
    }

.wp.is-open .wp-trigger {
    border-color: var(--primary, #0e7490);
    box-shadow: 0 0 0 4px var(--primary-light, rgba(14, 116, 144, .15));
}

.wp.invalid .wp-trigger {
    border-color: var(--danger, #dc2626);
    background: var(--danger-light, #fef2f2);
}

.wp.is-disabled .wp-trigger {
    opacity: .6;
    cursor: not-allowed;
}

.wp-ico {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, #06b6d4, #38bdf8);
    box-shadow: 0 3px 10px rgba(6, 182, 212, .3);
}

    .wp-ico svg {
        width: 18px;
        height: 18px;
    }

.wp-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

    .wp-text.is-empty {
        font-weight: 400;
        color: var(--text-muted, #7b92a6);
    }

.wp-chev {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    color: var(--text-muted, #7b92a6);
    transition: transform .2s;
}

    .wp-chev svg {
        width: 16px;
        height: 16px;
    }

.wp.is-open .wp-chev {
    transform: rotate(180deg);
}

.wp-clear {
    position: absolute;
    inset-inline-end: 34px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--border, #dbe7ef);
    color: var(--text, #0b2540);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

    .wp-clear:hover {
        background: var(--danger-light, #fee2e2);
        color: var(--danger, #dc2626);
    }

/* نسخه‌ی فشرده (کنار هم در ردیف‌ها، مثل ساعت‌های کاری) */
.wp--time {
    width: 138px;
}

    .wp--time .wp-trigger {
        min-height: 38px;
        padding: 4px 8px;
        gap: 6px;
        border-radius: 10px;
    }

    .wp--time .wp-ico {
        width: 26px;
        height: 26px;
        border-radius: 8px;
    }

        .wp--time .wp-ico svg {
            width: 15px;
            height: 15px;
        }

    .wp--time .wp-text {
        direction: ltr;
        text-align: center;
        letter-spacing: .02em;
    }

/* ---------- پنجره ----------
   پنجره به body منتقل می‌شود (بیرون از .admin-root)، پس پالت خودش را دارد: همان شیشه‌ی تیره‌ی سرمه‌ای/فیروزه‌ای
   مودال‌ها و سایدبار پنل ادمین. اندازه‌ی آن دقیقاً به اندازه‌ی چرخ‌هاست (width: max-content). */
.wp-overlay {
    --wp-text: #e8f6ff;
    --wp-muted: #a9c9dc;
    --wp-line: rgba(255, 255, 255, .20);
    --wp-accent: #22d3ee;
    --wp-accent-soft: rgba(34, 211, 238, .16);

    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(1, 10, 28, .5);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: wp-fade .2s ease both;
    font-family: var(--font-main, Tahoma, sans-serif);
    color-scheme: dark;
}

.wp-bottom {
    align-items: flex-end;
    padding: 0;
}

.wp-sheet {
    position: relative;
    width: max-content;
    min-width: 250px;
    max-width: 100%;
    max-height: calc(100dvh - 32px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    color: var(--wp-text);
    background: radial-gradient(120% 30% at 50% 0%, rgba(255, 255, 255, .14), transparent 65%), linear-gradient(180deg, rgba(2, 26, 64, .97) 0%, rgba(5, 61, 103, .95) 55%, rgba(7, 87, 123, .94) 100%);
    border: 1px solid rgba(255, 255, 255, .22);
    box-shadow: 0 24px 60px rgba(0, 10, 30, .6), inset 0 1px 0 rgba(255, 255, 255, .2);
    animation: wp-pop .28s cubic-bezier(.22, 1, .36, 1) both;
}

    /* نوار گرادیانت بالای پنجره (مثل مودال‌های پنل) */
    .wp-sheet::before {
        content: "";
        position: absolute;
        inset-inline: 0;
        top: 0;
        height: 3px;
        background: linear-gradient(90deg, #06b6d4 0%, #38bdf8 50%, #a5f3fc 100%);
    }

.wp-bottom .wp-sheet {
    width: 100%;
    max-width: 440px;
    border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation: wp-rise .32s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes wp-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes wp-pop {
    from { opacity: 0; transform: translateY(12px) scale(.96); }
    to { opacity: 1; transform: none; }
}

@keyframes wp-rise {
    from { transform: translateY(100%); }
    to { transform: none; }
}

.wp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px 8px 12px;
}

.wp-title {
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
    color: var(--wp-text);
}

.wp-close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    color: var(--wp-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, color .15s;
}

    .wp-close:hover {
        background: rgba(255, 255, 255, .18);
        color: #fff;
    }

/* ---------- چرخ‌ها ---------- */
.wp-cols {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 0;
    padding: 4px 14px 2px;
}

.wp-col {
    flex: 0 0 86px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

    /* چرخ سال کمی پهن‌تر */
    .wp-col:last-child:not(:first-child) {
        flex-basis: 92px;
    }

.wp--time .wp-col,
.wp-colon + .wp-col {
    flex-basis: 84px;
}

.wp-col-title {
    text-align: center;
    font-size: 11px;
    color: var(--wp-muted);
    padding-bottom: 2px;
}

.wp-col-body {
    position: relative;
    height: calc(var(--wp-h, 40px) * var(--wp-n, 5));
}

/* نوار مشخص‌کننده‌ی گزینه‌ی انتخاب‌شده (وسط) */
.wp-indicator {
    position: absolute;
    inset-inline: 0;
    top: 50%;
    height: var(--wp-h, 40px);
    transform: translateY(-50%);
    background: var(--wp-accent-soft);
    border-block: 1.5px solid var(--wp-accent);
    pointer-events: none;
}

.wp-col:first-child .wp-indicator {
    border-start-start-radius: 12px;
    border-end-start-radius: 12px;
    border-inline-start: 1.5px solid var(--wp-accent);
}

.wp-col:last-child .wp-indicator {
    border-start-end-radius: 12px;
    border-end-end-radius: 12px;
    border-inline-end: 1.5px solid var(--wp-accent);
}

.wp-list {
    position: absolute;
    inset: 0;
    margin: 0;
    padding-block: calc((var(--wp-n, 5) - 1) / 2 * var(--wp-h, 40px));
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
    /* محو شدن گزینه‌های دور از مرکز */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28%, #000 72%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 28%, #000 72%, transparent 100%);
}

    .wp-list::-webkit-scrollbar {
        display: none;
    }

    .wp-list.is-dragging {
        cursor: grabbing;
    }

    .wp-list:focus-visible {
        box-shadow: inset 0 0 0 2px rgba(34, 211, 238, .35);
        border-radius: 12px;
    }

.wp-item {
    height: var(--wp-h, 40px);
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    font-size: 1rem;
    font-weight: 600;
    color: var(--wp-text);
    white-space: nowrap;
}

    .wp-item.is-disabled {
        opacity: .35;
        text-decoration: line-through;
        text-decoration-thickness: 1px;
    }

.wp-colon {
    display: grid;
    place-items: center;
    align-self: center;
    padding-inline: 4px;
    padding-top: 16px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--wp-accent);
}

.wp-preview {
    margin: 6px 14px 0;
    padding: 5px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid var(--wp-line);
    text-align: center;
    font-weight: 700;
    font-size: .85rem;
    color: #a5f3fc;
}

.wp-foot {
    display: flex;
    gap: 8px;
    padding: 10px 14px 14px;
}

.wp-btn {
    flex: 1 1 0;
    min-height: 38px;
    padding-inline: 14px;
    border: 1.5px solid transparent;
    border-radius: 11px;
    font: inherit;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s, background .15s, transform .1s;
}

    .wp-btn:active {
        transform: scale(.97);
    }

.wp-btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #0891b2 0%, #0ea5e9 100%);
    box-shadow: 0 6px 16px rgba(6, 182, 212, .35);
}

    .wp-btn-primary:hover {
        filter: brightness(1.1);
    }

.wp-btn-ghost {
    color: var(--wp-text);
    background: rgba(255, 255, 255, .08);
    border-color: var(--wp-line);
}

    .wp-btn-ghost:hover {
        background: rgba(255, 255, 255, .16);
    }

/* ---------- بازه‌ی تاریخ (دو چرخ تاریخ کنار هم) ---------- */
.wpr {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wpr-row {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

    .wpr-row > .wp {
        flex: 1 1 190px;
    }

.wpr-link {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    height: 44px;
    color: var(--text-muted, #7b92a6);
}

    .wpr-link svg {
        width: 20px;
        height: 20px;
    }

[dir="ltr"] .wpr-link svg {
    transform: scaleX(-1);
}

.wpr-days {
    flex: 0 0 auto;
    align-self: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary, #0e7490);
    background: var(--primary-light, rgba(14, 116, 144, .12));
}

.wpr-presets {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.wpr-presets-label {
    font-size: 12px;
    color: var(--text-muted, #5f7a90);
}

.wpr-chip {
    padding: 4px 12px;
    border: 1px solid var(--border, #dbe7ef);
    border-radius: 999px;
    background: var(--bg-soft, #f4f9fc);
    color: var(--text, #0b2540);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

    .wpr-chip:hover {
        border-color: var(--primary, #0e7490);
        background: var(--primary-light, rgba(14, 116, 144, .12));
    }

@media (prefers-reduced-motion: reduce) {
    .wp-overlay, .wp-sheet, .wp-bottom .wp-sheet {
        animation: none;
    }
}

/* ---------- چیدمان داخل صفحه‌های ادمین ---------- */
.apx-filters .wp {
    min-width: 170px;
}

.apx-filters .wp-trigger {
    min-height: 38px;
    padding-block: 3px;
}

.apx-filters .wp-label {
    display: block;
    margin-bottom: 0;
}

.apx-interval .wp--time {
    flex: 0 0 auto;
}

@media (max-width: 560px) {
    .wp--time {
        width: 128px;
    }
}
