/* ===========================================================
   ASTRO Devices – نظام الإشعارات الموحّد (Modal + Toast)
   يطابق هوية الموقع البصرية (الألوان/الخطوط الحالية في css/core/base.css)
=========================================================== */

body.nm-modal-lock { overflow: hidden; }

/* ══════════════════════════════════════════
   Modal
══════════════════════════════════════════ */
.nm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,5,15,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.nm-modal-overlay.nm-modal-overlay-in { opacity: 1; }
.nm-modal-overlay.nm-modal-overlay-out { opacity: 0; }

.nm-modal {
  position: relative;
  background: rgba(14,14,30,0.97);
  border: 1px solid rgba(138,77,255,0.3);
  border-radius: 12px;
  padding: 36px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  transform: translateY(14px) scale(0.95);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.2,0.9,0.3,1.2), opacity 0.24s ease;
}
.nm-modal-overlay-in .nm-modal { transform: translateY(0) scale(1); opacity: 1; }
.nm-modal-overlay-out .nm-modal { transform: translateY(8px) scale(0.97); opacity: 0; }

.nm-modal-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  background: rgba(138,77,255,0.12);
  border: 1px solid rgba(138,77,255,0.25);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  color: rgba(242,242,247,0.6);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.nm-modal-close:hover { background: rgba(138,77,255,0.25); color: #fff; }

.nm-modal-icon { font-size: 2.6rem; line-height: 1; margin-bottom: 14px; filter: drop-shadow(0 0 12px rgba(138,77,255,0.35)); }
.nm-modal-danger .nm-modal-icon { filter: drop-shadow(0 0 12px rgba(255,107,107,0.4)); }

.nm-modal-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg,#fff,#C084FC);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.nm-modal-danger .nm-modal-title { background: linear-gradient(135deg,#fff,#ff9c9c); -webkit-background-clip: text; background-clip: text; }

.nm-modal-message {
  font-family: 'Cairo', sans-serif;
  font-size: 0.92rem;
  line-height: 1.75;
  color: rgba(242,242,247,0.72);
  margin-bottom: 22px;
}

.nm-modal-fields { text-align: start; margin-bottom: 6px; }
.nm-modal-field { margin-bottom: 14px; }
.nm-modal-field-label {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 2px;
  color: #C084FC;
  margin-bottom: 6px;
}
.nm-modal-input {
  width: 100%;
  background: rgba(10,5,25,0.8);
  border: 1px solid rgba(138,77,255,0.25);
  border-radius: 6px;
  padding: 11px 14px;
  color: #F2F2F7;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}
.nm-modal-input:focus { border-color: #8A4DFF; }
.nm-modal-input::placeholder { color: rgba(242,242,247,0.28); }
.nm-modal-field-error { color: #ff6b6b; font-size: 0.78rem; min-height: 18px; margin-bottom: 8px; text-align: center; }

.nm-modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.nm-modal-btn {
  flex: 1;
  padding: 12px;
  border-radius: 6px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  cursor: pointer;
  border: none;
  transition: box-shadow 0.2s, background 0.2s, transform 0.15s;
}
.nm-modal-btn:active { transform: scale(0.97); }
.nm-modal-btn-primary {
  background: linear-gradient(135deg,#3d1a6e,#8A4DFF);
  color: #fff;
  box-shadow: 0 0 20px rgba(138,77,255,0.35);
}
.nm-modal-btn-primary:hover { box-shadow: 0 0 32px rgba(138,77,255,0.6); }
.nm-modal-btn-secondary {
  background: transparent;
  border: 1px solid rgba(242,242,247,0.2);
  color: rgba(242,242,247,0.65);
}
.nm-modal-btn-secondary:hover { background: rgba(242,242,247,0.08); color: #fff; }
.nm-modal-btn-danger {
  background: linear-gradient(135deg,#7a1f1f,#ff6b6b);
  color: #fff;
  box-shadow: 0 0 20px rgba(255,107,107,0.3);
}
.nm-modal-btn-danger:hover { box-shadow: 0 0 32px rgba(255,107,107,0.55); }

/* Loading modal */
.nm-modal-loading { max-width: 300px; padding: 34px 30px; }
.nm-modal-spinner {
  width: 46px;
  height: 46px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 3px solid rgba(138,77,255,0.2);
  border-top-color: #8A4DFF;
  animation: nm-spin 0.8s linear infinite;
}
@keyframes nm-spin { to { transform: rotate(360deg); } }
.nm-modal-loading .nm-modal-message { margin-bottom: 0; }

/* ══════════════════════════════════════════
   Toast
══════════════════════════════════════════ */
.nm-toast-container {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 24px;
  z-index: 10050;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  pointer-events: none;
}

.nm-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 380px;
  background: rgba(14,14,30,0.96);
  border: 1px solid rgba(138,77,255,0.25);
  border-inline-start: 4px solid var(--pm);
  border-radius: 10px;
  padding: 13px 14px;
  box-shadow: 0 12px 34px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.nm-toast.nm-toast-in { opacity: 1; transform: translateY(0) scale(1); }
.nm-toast.nm-toast-out { opacity: 0; transform: translateY(8px) scale(0.97); }

.nm-toast-success { border-inline-start-color: #6bffb8; }
.nm-toast-error   { border-inline-start-color: #ff6b6b; }
.nm-toast-warning { border-inline-start-color: #ffd35c; }
.nm-toast-info    { border-inline-start-color: var(--pl); }

.nm-toast-icon { font-size: 1.1rem; line-height: 1.4; flex-shrink: 0; }
.nm-toast-message {
  flex: 1;
  font-family: 'Cairo', sans-serif;
  font-size: 0.85rem;
  line-height: 1.55;
  color: #F2F2F7;
  padding-top: 1px;
}
.nm-toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(242,242,247,0.4);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  transition: color 0.2s;
}
.nm-toast-close:hover { color: #fff; }

.nm-toast-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255,255,255,0.06);
}
.nm-toast-progress-bar {
  height: 100%;
  width: 100%;
  transform-origin: left;
  background: var(--pm);
  transition: transform linear;
  transition-duration: inherit;
}
.nm-toast-success .nm-toast-progress-bar { background: #6bffb8; }
.nm-toast-error   .nm-toast-progress-bar { background: #ff6b6b; }
.nm-toast-warning .nm-toast-progress-bar { background: #ffd35c; }
.nm-toast-info    .nm-toast-progress-bar { background: var(--pl); }
[dir="rtl"] .nm-toast-progress-bar { transform-origin: right; }

/* ══════════════════════════════════════════
   Responsive
══════════════════════════════════════════ */
@media (max-width: 640px) {
  .nm-modal { padding: 28px 22px; max-width: 94vw; }
  .nm-modal-actions { flex-direction: column-reverse; }
  .nm-toast-container { bottom: 14px; padding: 0 10px; }
  .nm-toast { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .nm-modal-overlay, .nm-modal, .nm-toast, .nm-modal-spinner {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
