/* ==========================================================================
   پایش صنعت | پیام‌های سفارشی (توست، پاپ‌آپ، تأیید، خطای فیلد)
   ========================================================================== */

#ui-host {
    font-family: 'IRANSans', Tahoma, system-ui, sans-serif;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10050;
    pointer-events: none;
}

.ui-toast-stack {
    position: absolute;
    z-index: 10050;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(420px, calc(100vw - 24px));
    pointer-events: none;
}

.ui-toast {
    pointer-events: auto;
    display: grid;
    grid-template-columns: 28px 1fr 28px;
    gap: 10px;
    align-items: center;
    padding: 12px 12px 12px 14px;
    border-radius: 14px;
    background: #0f172a;
    color: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ui-toast.is-in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ui-toast.is-out {
    opacity: 0;
    transform: translateY(-8px);
}

.ui-toast--success { background: linear-gradient(180deg, #166534 0%, #15803d 100%); }
.ui-toast--error { background: linear-gradient(180deg, #b91c1c 0%, #991b1b 100%); }
.ui-toast--info { background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%); }

.ui-toast__icon svg,
.ui-dialog__icon svg {
    width: 24px;
    height: 24px;
    display: block;
}

.ui-toast__icon circle {
    fill: rgba(255, 255, 255, 0.16);
    stroke: none;
}

.ui-toast__icon path {
    fill: none;
    stroke: #fff;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ui-toast__text {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.7;
}

.ui-toast__close {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
    padding: 0;
}

.ui-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.46);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: auto;
}

.ui-overlay.is-in { opacity: 1; }

.ui-dialog {
    width: min(420px, 100%);
    background: #fff;
    color: #1e293b;
    border-radius: 20px;
    padding: 28px 24px 22px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.2s ease;
}

.ui-overlay.is-in .ui-dialog {
    transform: translateY(0) scale(1);
}

.ui-dialog h3 {
    margin: 12px 0 8px;
    font-size: 1.15rem;
}

.ui-dialog p {
    margin: 0 0 18px;
    color: #64748b;
    line-height: 1.8;
    font-size: 0.95rem;
}

.ui-dialog__icon {
    width: 58px;
    height: 58px;
    margin: 0 auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.ui-dialog--success .ui-dialog__icon { background: #dcfce7; color: #166534; }
.ui-dialog--error .ui-dialog__icon { background: #fee2e2; color: #b91c1c; }
.ui-dialog--confirm .ui-dialog__icon { background: #ffedd5; color: #c2410c; }

.ui-dialog__icon svg { width: 30px; height: 30px; }
.ui-dialog__icon circle { fill: currentColor; opacity: 0.12; }
.ui-dialog__icon path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ui-dialog__actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ui-btn,
.ui-btn--ghost,
.ui-btn--danger {
    font: inherit;
    border: 0;
    border-radius: 12px;
    padding: 10px 18px;
    cursor: pointer;
    min-width: 108px;
}

.ui-btn { background: #f97316; color: #fff; }
.ui-btn--ghost { background: #e2e8f0; color: #0f172a; }
.ui-btn--danger { background: #b91c1c; color: #fff; }

input.is-invalid,
select.is-invalid,
textarea.is-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

html.ui-lock,
body.ui-lock {
    overflow: hidden;
}
body.ui-lock .main-header,
body.ui-lock .pdp-sticky-cta,
body.ui-lock .nav-backdrop,
body.ui-lock .skip-link {
    visibility: hidden !important;
    pointer-events: none !important;
}

.ui-field-error {
    display: block;
    margin-top: 6px;
    color: #b91c1c;
    font-size: 0.82rem;
}

input:invalid,
select:invalid,
textarea:invalid {
    box-shadow: none;
}

.nav-badge {
    display: inline-flex;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 6px;
    margin-right: 8px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #f97316;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    animation: nav-badge-pulse 1.7s ease-in-out infinite;
}

@keyframes nav-badge-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.45); }
    50% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(249, 115, 22, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .ui-toast,
    .ui-overlay,
    .ui-dialog,
    .nav-badge {
        animation: none;
        transition: none;
    }
}

@media (max-width: 640px) {
    .ui-toast-stack { top: auto; bottom: 16px; }
}
