/*═══════════════════════════════════════════════════════════════
  FANCY SUBMIT FEEDBACK — Premium animated states
═══════════════════════════════════════════════════════════════*/

/* إخفاء الـ toast الأصلي حين الـ fancy يعمل */
#toast.fancy-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* ─── الحاوية الأساسية ─── */
.fancy-status {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 1.4rem;
  border-radius: 50px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  opacity: 0;
  transform: translateY(6px) scale(0.94);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  margin-top: 0.5rem;
}

.fancy-status.fancy-show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ─── Loading ─── */
.fancy-status.fancy-loading {
  background: linear-gradient(135deg, rgba(20, 20, 20, 0.92), rgba(35, 30, 15, 0.92));
  color: rgba(255, 217, 122, 0.95);
  border: 1.5px solid rgba(212, 175, 55, 0.6);
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.25),
    0 0 22px rgba(212, 175, 55, 0.2),
    0 8px 20px rgba(0, 0, 0, 0.35);
}

/* shimmer يجري على الخلفية */
.fancy-status.fancy-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.15), transparent);
  animation: fancy-shimmer 1.4s ease-in-out infinite;
}

@keyframes fancy-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.fancy-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(212, 175, 55, 0.3);
  border-top-color: rgba(255, 217, 122, 1);
  border-radius: 50%;
  animation: fancy-spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes fancy-spin {
  to { transform: rotate(360deg); }
}

/* ─── Success ─── */
.fancy-status.fancy-success {
  background: linear-gradient(135deg, rgba(15, 25, 15, 0.95), rgba(20, 35, 20, 0.95));
  color: rgba(210, 255, 190, 0.98);
  border: 1.5px solid rgba(212, 175, 55, 0.75);
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.4),
    0 0 32px rgba(212, 175, 55, 0.45),
    0 0 55px rgba(34, 197, 94, 0.15),
    0 10px 28px rgba(0, 0, 0, 0.35);
  animation: fancy-bounce-in 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fancy-bounce-in {
  0%   { transform: scale(0.4) translateY(16px); opacity: 0; }
  55%  { transform: scale(1.07) translateY(-2px); opacity: 1; }
  75%  { transform: scale(0.97) translateY(1px); }
  100% { transform: scale(1) translateY(0); }
}

.fancy-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4af37, #ffd97a, #fff0b4);
  color: #111;
  font-size: 0.78rem;
  font-weight: 900;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
  animation: fancy-check-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

@keyframes fancy-check-pop {
  0%   { transform: scale(0) rotate(-90deg); opacity: 0; }
  60%  { transform: scale(1.25) rotate(8deg);  opacity: 1; }
  100% { transform: scale(1)    rotate(0deg);  opacity: 1; }
}

/* ─── Error ─── */
.fancy-status.fancy-error {
  background: linear-gradient(135deg, rgba(30, 12, 12, 0.95), rgba(40, 18, 18, 0.95));
  color: rgba(255, 195, 195, 0.98);
  border: 1.5px solid rgba(239, 68, 68, 0.7);
  box-shadow:
    0 0 0 1px rgba(239, 68, 68, 0.35),
    0 0 22px rgba(239, 68, 68, 0.25),
    0 10px 22px rgba(0, 0, 0, 0.35);
  animation: fancy-shake-err 0.45s ease;
}

@keyframes fancy-shake-err {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(4px); }
}

.fancy-error-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.88);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 900;
  flex-shrink: 0;
}

/* ─── Confetti ─── */
.fancy-confetti-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.fancy-particle {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 1px;
  pointer-events: none;
  opacity: 0;
  animation: fancy-particle-fly var(--dur, 1s) cubic-bezier(0.25, 0.46, 0.45, 0.94) var(--delay, 0s) forwards;
}

@keyframes fancy-particle-fly {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--fx, 0), var(--fy, -70px)) rotate(var(--fr, 360deg)) scale(0.25); }
}

/* Light mode overrides */
body:not(.dark-theme) .fancy-status.fancy-loading {
  background: rgba(255, 251, 235, 0.96);
  color: rgba(120, 88, 0, 0.95);
  border-color: rgba(139, 111, 0, 0.6);
}

body:not(.dark-theme) .fancy-status.fancy-success {
  background: rgba(245, 255, 245, 0.97);
  color: rgba(30, 90, 30, 0.95);
  border-color: rgba(139, 111, 0, 0.7);
}

body:not(.dark-theme) .fancy-status.fancy-error {
  background: rgba(255, 245, 245, 0.97);
  color: rgba(140, 20, 20, 0.95);
}

/* reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .fancy-status         { animation: none !important; transition: opacity 0.3s ease; }
  .fancy-spinner        { animation: none !important; }
  .fancy-check          { animation: none !important; }
  .fancy-particle       { animation: none !important; }
  .fancy-status::before { animation: none !important; }
}
