/* ═══════════════════════════════════════════════════════════════════════════
   SetadYar — Unified Toast Notification System   [PREMIUM-STYLES]
   ───────────────────────────────────────────────────────────────────────────
   یک منبع واحد برای «کانتینر نوتیفیکیشن» در همهٔ صفحات (کاربر + ادمین، از لاگین
   تا داشبورد). قبلاً این استایل در main.css / signin.css / responsive.css /
   admin-notifications.css / admin-login.css پخش و تکراری بود؛ اینجا یکپارچه،
   ماژولار و مستقل از بقیهٔ فایل‌ها تعریف شده. رفتار ریسپانسیو قبلی عیناً حفظ شده.

   Markup مورد انتظار (توسط showNotification / showAdminToast ساخته می‌شود):
     <div id="notificationContainer">
       <div class="notification success|error|warning|info [show|fade-out]">
         [<div class="notif-icon">…</div>]        ← اختیاری (سمت ادمین)؛ آیکون از CSS می‌آید
         <div class="notif-content"> پیام </div>
         <div class="notif-close"><i class="fas fa-times"></i></div>
         <div class="notif-progress"></div>
       </div>
     </div>
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --ntf-radius: 18px;
  --ntf-gap: 12px;
  --ntf-success: #10b981;
  --ntf-error: #ef4444;
  --ntf-warning: #f59e0b;
  --ntf-info: #3b82f6;
  --ntf-shadow:
    0 18px 40px -12px rgba(15, 23, 42, 0.28),
    0 6px 14px -6px rgba(15, 23, 42, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

:root[data-theme="dark"],
[data-theme="dark"] {
  --ntf-shadow:
    0 20px 44px -12px rgba(0, 0, 0, 0.55),
    0 6px 16px -6px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ── Container ─────────────────────────────────────────────────────────────── */
#notificationContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  left: auto;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--ntf-gap);
  padding: 0;
  margin: 0;
  max-width: min(92vw, 420px);
  pointer-events: none;
  font-size: 0.9rem;
}

/* ── Toast card ────────────────────────────────────────────────────────────── */
.notification {
  --ntf-accent: var(--ntf-info);
  --ntf-accent-rgb: 59, 130, 246;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
  min-width: 288px;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 15px;
  border-radius: var(--ntf-radius);
  border: 1px solid rgba(var(--ntf-accent-rgb), 0.32);
  color: var(--text-primary, #1f2937);
  font-weight: 600;
  line-height: 1.6;
  pointer-events: auto;
  background:
    radial-gradient(120% 140% at 6% 0%, rgba(var(--ntf-accent-rgb), 0.16), transparent 42%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.74));
  box-shadow: var(--ntf-shadow);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  opacity: 0;
  transform: translateX(115%);
  max-height: 320px;
  transition:
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.32s ease,
    max-height 0.38s ease,
    padding 0.38s ease,
    margin 0.38s ease,
    border-width 0.38s ease;
  will-change: transform, opacity;
}

[data-theme="dark"] .notification {
  color: #e8edf6;
  border-color: rgba(var(--ntf-accent-rgb), 0.4);
  background:
    radial-gradient(120% 140% at 6% 0%, rgba(var(--ntf-accent-rgb), 0.22), transparent 45%),
    linear-gradient(135deg, rgba(24, 32, 44, 0.92), rgba(18, 24, 34, 0.8));
}

/* لبهٔ رنگیِ نازک سمت شروع (RTL: راست) */
.notification::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 4px;
  background: var(--ntf-accent);
}

/* ── Icon badge (از CSS می‌آید — چه markup آیکون داشته باشد چه نه) ──────────── */
.notif-icon { display: none; }

.notif-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  word-break: break-word;
}

.notif-content::before {
  content: '\f05a';
  font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free', 'FontAwesome';
  font-weight: 900;
  font-size: 0.92rem;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: rgba(var(--ntf-accent-rgb), 0.16);
  color: var(--ntf-accent);
  box-shadow: inset 0 0 0 1px rgba(var(--ntf-accent-rgb), 0.2);
}

/* ── Close button ─────────────────────────────────────────────────────────── */
.notif-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  cursor: pointer;
  color: var(--text-secondary, #64748b);
  background: transparent;
  opacity: 0.7;
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.notif-close i {
  font-size: 0.82rem;
  line-height: 1;
}

.notif-close:hover {
  opacity: 1;
  background: rgba(var(--ntf-accent-rgb), 0.14);
}

.notif-close:active {
  transform: scale(0.9);
}

/* ── Progress bar (+ track) ───────────────────────────────────────────────── */
.notification::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 3px;
  background: rgba(var(--ntf-accent-rgb), 0.14);
}

.notif-progress {
  position: absolute;
  inset-inline-start: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  transform-origin: left;
  z-index: 2;
  background: var(--ntf-accent);
  box-shadow: 0 0 10px rgba(var(--ntf-accent-rgb), 0.55);
}

/* ── Enter / exit ─────────────────────────────────────────────────────────── */
.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification.fade-out {
  opacity: 0;
  transform: translateX(115%);
  max-height: 0;
  padding-block: 0;
  margin-block-start: calc(-1 * var(--ntf-gap));
  border-width: 0;
  pointer-events: none;
}

/* هنگام سوییچ تم، توست نباید انیمیشن اضافه بگیرد */
.theme-transitioning .notification {
  transition: none !important;
}

/* ── Per-type accent ─────────────────────────────────────────────────────── */
.notification.success { --ntf-accent: var(--ntf-success); --ntf-accent-rgb: 16, 185, 129; }
.notification.error   { --ntf-accent: var(--ntf-error);   --ntf-accent-rgb: 239, 68, 68; }
.notification.warning { --ntf-accent: var(--ntf-warning); --ntf-accent-rgb: 245, 158, 11; }
.notification.info    { --ntf-accent: var(--ntf-info);    --ntf-accent-rgb: 59, 130, 246; }

.notification.success .notif-content::before { content: '\f058'; }
.notification.error   .notif-content::before { content: '\f06a'; }
.notification.warning .notif-content::before { content: '\f071'; }
.notification.info    .notif-content::before { content: '\f05a'; }

/* ── Responsive — رفتار موبایل قبلی، یکپارچه‌شده ────────────────────────────── */
@media (max-width: 768px) {
  #notificationContainer {
    top: 14px;
    right: 14px;
    left: 14px;
    align-items: center;
    max-width: none;
    gap: 8px;
  }

  .notification {
    width: 100%;
    max-width: 450px;
    min-width: 0;
    margin: 0 auto;
    padding: 12px 14px 13px;
    border-radius: 14px;
    font-size: 0.85rem;
    transform: translateY(-130%);
  }

  .notification.show {
    transform: translateY(0);
  }

  .notification.fade-out {
    transform: translateY(-130%);
  }

  .notif-content::before {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    font-size: 0.85rem;
  }

  .notif-close {
    background: rgba(var(--ntf-accent-rgb), 0.1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .notification {
    transition: opacity 0.2s ease;
    transform: none;
  }
  .notification.fade-out { transform: none; }
}
