/**
 * Shaaf UI - استایل های مشترک کل سایت
 * مسیر فایل: wp-content/plugins/shaaf/assets/css/shaaf-ui.css
 *
 * ۱. متغیرهای رنگ
 * ۲. منوی بازشونده سفارشی (جایگزین ظاهری select)
 * ۳. صفحه بندی لیست ها
 */

/* ---------------------------------------------------------
 * ۱. متغیرها
 * --------------------------------------------------------- */
:root {
    --shaaf-green: #00a651;
    --shaaf-green-dark: #058a4b;
    --shaaf-green-soft: #e9f8ef;
    --shaaf-red: #ed1b35;
    --shaaf-red-soft: #fdecee;
    --shaaf-ink: #172033;
    --shaaf-muted: #6b7789;
    --shaaf-line: #e3e9ee;
    --shaaf-surface: #ffffff;
    --shaaf-surface-2: #f7f9fb;
    --shaaf-radius: 14px;
    --shaaf-shadow: 0 10px 30px rgba(17, 38, 60, .08);
}

/* ---------------------------------------------------------
 * ۲. منوی بازشونده سفارشی
 * --------------------------------------------------------- */
.shaaf-select {
    position: relative;
    display: block;
    width: 100%;
    font-family: inherit;
    text-align: right;
}

/* select اصلی برای ارسال فرم و اعتبارسنجی مرورگر باقی می ماند ولی دیده نمی شود */
.shaaf-select > select.shaaf-select-native {
    position: absolute !important;
    inset: auto 0 0 auto !important;
    width: 100% !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

.shaaf-select-trigger {
    all: unset;
    box-sizing: border-box;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    padding: 10px 52px;
    background: var(--shaaf-surface);
    border: 1.5px solid var(--shaaf-line);
    border-radius: var(--shaaf-radius);
    color: var(--shaaf-ink);
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.8;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.shaaf-select-trigger:hover {
    border-color: #b8d9c7;
}

.shaaf-select-trigger:focus-visible,
.shaaf-select.is-open .shaaf-select-trigger {
    border-color: var(--shaaf-green);
    box-shadow: 0 0 0 4px rgba(0, 166, 81, .12);
    outline: none;
}

.shaaf-select.is-placeholder .shaaf-select-value {
    color: #97a3b2;
    font-weight: 500;
}

.shaaf-select.is-invalid .shaaf-select-trigger {
    border-color: var(--shaaf-red);
    box-shadow: 0 0 0 4px rgba(237, 27, 53, .1);
}

.shaaf-select.is-disabled .shaaf-select-trigger {
    background: var(--shaaf-surface-2);
    color: #9aa5b3;
    cursor: not-allowed;
}

.shaaf-select-value {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.shaaf-select-chevron {
    position: absolute;
    top: 50%;
    left: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-top: -15px;
    border-radius: 10px;
    background: var(--shaaf-green-soft);
    color: var(--shaaf-green);
    transition: transform .25s ease;
}

.shaaf-select[dir="ltr"] .shaaf-select-chevron { left: auto; right: 10px; }

.shaaf-select.is-open .shaaf-select-chevron {
    transform: rotate(180deg);
}

/* لیست گزینه ها: با اسکریپت به body منتقل و ثابت کنار فیلد قرار می گیرد */
.shaaf-select-list {
    position: absolute;
    z-index: 100050;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    max-height: 320px;
    margin: 0 !important;
    padding: 6px !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none !important;
    background: var(--shaaf-surface);
    border: 1px solid var(--shaaf-line);
    border-radius: 16px;
    box-shadow: 0 18px 44px rgba(17, 38, 60, .18);
    outline: none;
    font-family: inherit;
    direction: rtl;
    box-sizing: border-box;
    animation: shaafSelectIn .16s ease-out;
    scrollbar-width: thin;
    scrollbar-color: #cfd8e0 transparent;
}

.shaaf-select-list.is-floating {
    position: fixed;
    right: auto;
}

.shaaf-select-list.is-up { animation-name: shaafSelectInUp; }

.shaaf-select-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: 2px 0 !important;
    padding: 9px 40px !important;
    border-radius: 12px;
    color: var(--shaaf-ink);
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.8;
    text-align: center;
    cursor: pointer;
    list-style: none !important;
    transition: background-color .15s ease;
}

.shaaf-select-option::before,
.shaaf-select-option::marker {
    content: none !important;
}

.shaaf-select-option + .shaaf-select-option::after {
    content: "";
    position: absolute;
    top: -2px;
    right: 18px;
    left: 18px;
    height: 1px;
    background: #f0f3f6;
}

.shaaf-select-option.is-active {
    background: var(--shaaf-surface-2);
}

.shaaf-select-option.is-selected {
    background: var(--shaaf-green-soft);
    color: var(--shaaf-green-dark);
    font-weight: 800;
}

.shaaf-select-option.is-selected::after,
.shaaf-select-option.is-selected + .shaaf-select-option::after,
.shaaf-select-option.is-active::after,
.shaaf-select-option.is-active + .shaaf-select-option::after { opacity: 0; }

.shaaf-select-option.is-placeholder {
    color: #97a3b2;
}

.shaaf-select-option.is-disabled {
    opacity: .45;
    cursor: not-allowed;
}

.shaaf-select-check {
    position: absolute;
    top: 50%;
    left: 14px;
    display: inline-flex;
    margin-top: -8px;
    visibility: hidden;
    color: var(--shaaf-green);
}

.shaaf-select-option.is-selected .shaaf-select-check {
    visibility: visible;
}

.shaaf-select-group {
    padding: 10px 12px 4px !important;
    color: var(--shaaf-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    list-style: none !important;
}

@keyframes shaafSelectIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes shaafSelectInUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .shaaf-select-list { animation: none; }
    .shaaf-select-chevron { transition: none; }
}

/* ---------------------------------------------------------
 * انتخابگر ساعت
 * --------------------------------------------------------- */
.shaaf-time-picker {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    direction: ltr;
    width: 100%;
}

.shaaf-time-part {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    direction: rtl;
}

.shaaf-time-part label {
    margin: 0 !important;
    color: var(--shaaf-muted) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-align: center;
}

.shaaf-time-sep {
    padding-bottom: 12px;
    color: var(--shaaf-ink);
    font-size: 22px;
    font-weight: 900;
}

.shaaf-time-picker .shaaf-select-trigger { font-size: 17px; font-weight: 800; letter-spacing: .5px; }

/* ---------------------------------------------------------
 * ۳. صفحه بندی
 * --------------------------------------------------------- */
.shaaf-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 12px;
    direction: rtl;
    font-family: inherit;
}

.shaaf-pager-numbers {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.shaaf-pager-num,
.shaaf-pager-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--shaaf-line);
    border-radius: 12px;
    background: var(--shaaf-surface);
    color: var(--shaaf-ink) !important;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.shaaf-pager-num:hover,
.shaaf-pager-btn:hover {
    border-color: #b8e3c9;
    background: var(--shaaf-green-soft);
    color: var(--shaaf-green-dark) !important;
}

.shaaf-pager-num.is-current {
    border-color: var(--shaaf-green);
    background: var(--shaaf-green);
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(0, 166, 81, .25);
}

.shaaf-pager-btn.is-disabled {
    opacity: .4;
    pointer-events: none;
}

.shaaf-pager-gap {
    color: var(--shaaf-muted);
    padding: 0 2px;
}

.shaaf-pager-status {
    display: none;
    color: var(--shaaf-muted);
    font-size: 12px;
}

@media (max-width: 560px) {
    .shaaf-pager-numbers { display: none; }
    .shaaf-pager-status { display: inline-block; padding: 0 6px; }
    .shaaf-pager-btn { flex: 1 1 0; }
}

/* ---------------------------------------------------------
 * ۴. آیکون های منوی کاربر در هدر سایت ([user_login_btn])
 * --------------------------------------------------------- */
.dropdown-item-link .shaaf-dropdown-icon,
.logout-link .shaaf-dropdown-icon {
    display: inline-flex;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: #f3f6f8;
    color: #7a8696;
    transition: background-color .2s ease, color .2s ease;
}

.dropdown-item-link:hover .shaaf-dropdown-icon {
    background: var(--shaaf-green-soft);
    color: var(--shaaf-green);
}

.logout-link .shaaf-dropdown-icon {
    background: var(--shaaf-red-soft);
    color: #dc2626;
}

/* ---------------------------------------------------------
 * فرم شارژ کیف پول (گراویتی فرم ۳۰): دکمه های مبلغ تمام عرض و وسط چین
 * --------------------------------------------------------- */
#gform_wrapper_30 .gfield_radio {
    width: 100% !important;
    max-width: none !important;
    justify-items: stretch !important;
    margin: 0 !important;
    padding: 0 !important;
}

#gform_wrapper_30 .gfield_radio .gchoice,
#gform_wrapper_30 .gfield_radio > li {
    justify-content: center !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

#gform_wrapper_30 .gfield_radio .gchoice label,
#gform_wrapper_30 .gfield_radio > li label {
    width: 100% !important;
    max-width: none !important;
    min-height: 46px;
    margin: 0 !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1.6 !important;
}

#gform_wrapper_30 legend.gfield_label,
#gform_wrapper_30 label.gfield_label { text-align: center !important; width: 100%; }

/* ---------------------------------------------------------
 * منوی کاربر در موبایل: پنجره کامل وسط صفحه با پس زمینه محو
 * (assets/js/shaaf-ui.js منو را به body منتقل می کند تا بالاتر از منوی پایین قرار بگیرد)
 * --------------------------------------------------------- */
@media (max-width: 768px) {
    .menu-backdrop.shaaf-um-portal {
        position: fixed !important;
        inset: 0 !important;
        width: auto !important;
        height: auto !important;
        z-index: 100040 !important;
        background: rgba(15, 23, 42, .45) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        backdrop-filter: blur(8px) !important;
        visibility: hidden;
        opacity: 0;
        transition: opacity .25s ease, visibility .25s ease;
    }

    .user-dropdown-box.shaaf-um-portal {
        position: fixed !important;
        top: 50% !important;
        right: auto !important;
        bottom: auto !important;
        left: 50% !important;
        z-index: 100041 !important;
        box-sizing: border-box;
        width: min(420px, calc(100vw - 28px)) !important;
        max-height: calc(100dvh - 40px) !important;
        overflow-y: auto !important;
        overscroll-behavior: contain;
        padding: 16px !important;
        border-radius: 24px !important;
        background: #fff !important;
        box-shadow: 0 30px 80px rgba(15, 23, 42, .35) !important;
        direction: rtl;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translate(-50%, -46%) scale(.97) !important;
        transition: opacity .25s cubic-bezier(.16, 1, .3, 1), transform .25s cubic-bezier(.16, 1, .3, 1), visibility .25s ease;
    }

    .shaaf-um-portal.is-open { opacity: 1 !important; visibility: visible !important; pointer-events: auto !important; }
    .user-dropdown-box.shaaf-um-portal.is-open { transform: translate(-50%, -50%) scale(1) !important; }

    .shaaf-um-head {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0 0 12px;
        padding: 0 2px 12px;
        border-bottom: 1px solid #f1f5f9;
    }

    .shaaf-um-avatar {
        display: inline-flex;
        flex: 0 0 42px;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border-radius: 14px;
        background: #ecfdf5;
        color: #059669;
    }

    .shaaf-um-title { flex: 1 1 auto; min-width: 0; font-size: 15px; font-weight: 900; color: #172033; }

    .shaaf-um-close {
        all: unset;
        display: inline-flex;
        flex: 0 0 38px;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: 12px;
        background: #f4f6f8;
        color: #475569;
        cursor: pointer;
    }

    .shaaf-um-close:focus-visible { outline: 2px solid #059669; outline-offset: 2px; }

    .user-dropdown-box.shaaf-um-portal .wallet-box-item { margin-bottom: 10px; padding: 14px 16px; border-radius: 16px; }
    .user-dropdown-box.shaaf-um-portal .dropdown-links-list { gap: 4px; }
    .user-dropdown-box.shaaf-um-portal .dropdown-item-link,
    .user-dropdown-box.shaaf-um-portal .logout-link { min-height: 48px; padding: 8px 12px; font-size: 14px; font-weight: 700; border-radius: 14px; }
    .user-dropdown-box.shaaf-um-portal .dropdown-item-link:active { background: #f1f5f9; }

    body.shaaf-um-locked { overflow: hidden !important; }
}
