/* ===== تأكيدات داخل العالم + إشعارات التراجع (.ac-*) =====
   لغة موحّدة مع قائمة الحالة الزجاجية (.oc-status-menu/.oc-menu-backdrop):
   أسطح صلبة بحدود التوكنات وظلّ Modernize، تعتمد توكنز base.css فتتكيّف مع
   الوضع الليلي وهويّة المتجر تلقائياً. تُحمّل مرّة واحدة بعد بقية الأنماط. */

/* ---------- خلفية التأكيد ---------- */
/* #appConfirmRoot يتحكّم به JS: display:block عند الفتح، none عند الإغلاق.
   لا نضع display:none هنا كي لا يلغي override الـ inline عند الفتح. */
.ac-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-popover-top);
    background: color-mix(in srgb, var(--ink-2, #2A3547) 38%, transparent);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity .18s ease;
}
#appConfirmRoot.is-open .ac-backdrop { opacity: 1; }

/* ---------- لوحة التأكيد ---------- */
.ac-sheet {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -48%) scale(.96);
    transform-origin: center top;
    z-index: var(--z-popover-top);
    width: calc(100% - 32px);
    max-width: 360px;
    background: var(--surface-solid);
    border: 1px solid var(--border-main);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 22px 22px 18px;
    text-align: center;
    opacity: 0;
    transition: opacity .18s ease, transform .18s cubic-bezier(.2, .8, .2, 1);
}
#appConfirmRoot.is-open .ac-sheet {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
/* التمركز أفقيّاً عبر left:50% + translateX(-50%) صحيح في الاتجاهَين؛ ومحتوى
   اللوحة dir="rtl" يبقى عربيّاً. */

.ac-ico {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ac-ico[data-tone="primary"] {
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    color: var(--primary);
}
.ac-ico[data-tone="danger"] {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    color: var(--danger);
}
.ac-title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-title);
}
.ac-msg {
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.ac-msg strong { color: var(--text-title); font-weight: 800; }

.ac-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}
.ac-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: 999px;
    font: inherit;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: background .14s ease, color .14s ease, border-color .14s ease, transform .14s ease;
}
.ac-btn:active { transform: scale(.98); }
.ac-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: 2px; }
.ac-cancel {
    background: var(--surface-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-main);
}
.ac-cancel:hover { background: var(--border-light); color: var(--text-title); }
.ac-confirm {
    background: var(--primary);
    color: var(--text-light);
    border: 1px solid var(--primary);
}
.ac-confirm:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
/* الإجراء الخطر: زر التأكيد بـdanger بدل الأساسي */
.ac-sheet.is-danger .ac-confirm {
    background: var(--danger);
    border-color: var(--danger);
}
.ac-sheet.is-danger .ac-confirm:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

@media (prefers-reduced-motion: reduce) {
    .ac-sheet, .ac-backdrop, .ac-toast, .ac-toast-bar { transition: none !important; animation: none !important; }
}

/* ---------- إشعارات التراجع (toast) ---------- */
.ac-toast-wrap {
    position: fixed;
    bottom: 16px;
    inset-inline: 0;
    z-index: var(--z-popover-top);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.ac-toast {
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 92vw;
    padding: 12px 14px;
    background: var(--surface-solid);
    border: 1px solid var(--border-main);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .2s ease, transform .2s cubic-bezier(.2, .8, .2, 1);
}
.ac-toast.is-open { opacity: 1; transform: translateY(0); }
.ac-toast-msg {
    flex: 1;
    min-width: 0;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-title);
}
.ac-toast-action {
    flex-shrink: 0;
    padding: 6px 14px;
    border: none;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    color: var(--primary);
    font: inherit;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: background .14s ease;
}
.ac-toast-action:hover { background: color-mix(in srgb, var(--primary) 24%, transparent); }
/* شريط تقدّم يُظهر الوقت المتبقّي قبل اختفاء الإشعار */
.ac-toast-bar {
    position: absolute;
    bottom: 0;
    inset-inline: 0;
    height: 3px;
    background: var(--primary);
    transform-origin: right; /* بداية RTL */
    animation-name: acBarShrink;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}
@keyframes acBarShrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }
