/* UI Dialog — نوتیف و تایید سفارشی (جایگزین alert/confirm مرورگر) */
.ui-root { position: relative; z-index: 100000; }

.ui-toast-stack {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: .55rem;
    width: min(420px, calc(100vw - 1.5rem));
    pointer-events: none;
    z-index: 100002;
}

.ui-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .85rem 1rem;
    border-radius: 14px;
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .14);
    font-family: Vazirmatn, Tahoma, sans-serif;
    font-size: .9rem;
    line-height: 1.55;
    animation: ui-toast-in .28s ease;
    direction: rtl;
}
.ui-toast.is-out { animation: ui-toast-out .22s ease forwards; }
.ui-toast__icon {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 9px;
    display: grid; place-items: center;
    font-size: .85rem;
}
.ui-toast__body { flex: 1; min-width: 0; }
.ui-toast__close {
    border: 0; background: transparent; color: #94a3b8;
    cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 .15rem;
}
.ui-toast--info .ui-toast__icon { background: #eef2ff; color: #2d5bff; }
.ui-toast--success .ui-toast__icon { background: #dcfce7; color: #15803d; }
.ui-toast--warning .ui-toast__icon { background: #fef3c7; color: #b45309; }
.ui-toast--error .ui-toast__icon { background: #fee2e2; color: #b91c1c; }

.ui-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .48);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    z-index: 100001;
    opacity: 0;
    transition: opacity .2s ease;
}
.ui-overlay.is-open { opacity: 1; }

.ui-dialog {
    width: min(420px, 100%);
    background: #fff;
    color: #1e293b;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
    padding: 1.35rem 1.35rem 1.15rem;
    font-family: Vazirmatn, Tahoma, sans-serif;
    direction: rtl;
    transform: translateY(10px) scale(.98);
    transition: transform .22s ease;
}
.ui-overlay.is-open .ui-dialog { transform: none; }

.ui-dialog__icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    display: grid; place-items: center;
    margin: 0 auto .9rem;
    font-size: 1.35rem;
}
.ui-dialog--confirm .ui-dialog__icon { background: #eef2ff; color: #2d5bff; }
.ui-dialog--danger .ui-dialog__icon { background: #fee2e2; color: #b91c1c; }
.ui-dialog--alert .ui-dialog__icon { background: #fef3c7; color: #b45309; }
.ui-dialog--success .ui-dialog__icon { background: #dcfce7; color: #15803d; }

.ui-dialog__title {
    margin: 0 0 .45rem;
    font-size: 1.05rem;
    font-weight: 800;
    text-align: center;
}
.ui-dialog__text {
    margin: 0 0 1.2rem;
    color: #64748b;
    font-size: .92rem;
    line-height: 1.7;
    text-align: center;
    white-space: pre-wrap;
}
.ui-dialog__actions {
    display: flex;
    gap: .6rem;
    justify-content: center;
    flex-wrap: wrap;
}
.ui-dialog__actions .ui-btn {
    min-width: 110px;
    padding: .65rem 1.1rem;
    border-radius: 12px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 700;
    font-size: .88rem;
    cursor: pointer;
    transition: filter .15s, background .15s;
}
.ui-btn--primary { background: #2d5bff; color: #fff; }
.ui-btn--primary:hover { filter: brightness(1.06); }
.ui-btn--danger { background: #dc2626; color: #fff; }
.ui-btn--danger:hover { filter: brightness(1.06); }
.ui-btn--ghost {
    background: #fff;
    color: #334155;
    border-color: #e2e8f0;
}
.ui-btn--ghost:hover { background: #f8fafc; }

@keyframes ui-toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}
@keyframes ui-toast-out {
    to { opacity: 0; transform: translateY(-6px); }
}

@media (max-width: 520px) {
    .ui-toast-stack { top: auto; bottom: 1rem; }
    .ui-dialog__actions { flex-direction: column-reverse; }
    .ui-dialog__actions .ui-btn { width: 100%; }
}

/* نمایش هزارگان زیر فیلدهای قیمت / مبلغ */
.money-hint {
    margin-top: .35rem;
    font-size: .8rem;
    font-weight: 600;
    color: #15803d;
    letter-spacing: .01em;
    direction: ltr;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.money-hint.is-previous {
    color: #94a3b8;
    font-weight: 500;
}
.money-hint.is-previous::before {
    content: 'قبلی: ';
    font-family: Vazirmatn, Tahoma, sans-serif;
    direction: rtl;
}

/* Language switcher */
.lang-switch {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}
.lang-switch__btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .7rem;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    font: inherit;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.lang-switch__btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.lang-switch__caret { transition: transform .15s; opacity: .7; }
.lang-switch.is-open .lang-switch__caret { transform: rotate(180deg); }
.lang-switch__menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-end: 0;
    z-index: 80;
    min-width: 140px;
    padding: .35rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .14);
}
.lang-switch__item {
    display: block;
    width: 100%;
    padding: .55rem .7rem;
    border-radius: 8px;
    color: #334155;
    text-decoration: none;
    font-size: .82rem;
    font-weight: 600;
}
.lang-switch__item:hover { background: #f1f5f9; }
.lang-switch__item.is-active {
    background: #eef2ff;
    color: #1d4ed8;
}
html[dir="ltr"] body {
    font-family: Inter, Segoe UI, Tahoma, sans-serif;
}
