/* ==========================================================================
   modals.css — سیستم مودال، آلرت و تایید حرفه‌ای (Gold & Black)
   ========================================================================== */

/* ---------- مودال اوورلی (پس‌زمینه) ---------- */
.foneva-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: foneva-modal-fade-in 0.2s ease both;
}
.foneva-modal-overlay.active {
  display: flex;
}

/* ---------- مودال باکس ---------- */
.foneva-modal-box {
  background: var(--bg-card, #141210);
  border: 1px solid var(--border-gold, rgba(212, 175, 55, 0.2));
  border-radius: 16px;
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(212, 175, 55, 0.08);
  animation: foneva-modal-scale-in 0.25s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  padding: 28px 24px 20px;
  position: relative;
  direction: rtl;
}

/* ---------- هدر مودال ---------- */
.foneva-modal-header {
  text-align: center;
  margin-bottom: 16px;
}

.foneva-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 28px;
  line-height: 1;
  animation: foneva-modal-icon-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.foneva-modal-icon.success {
  background: rgba(0, 166, 80, 0.12);
  color: #00e676;
}
.foneva-modal-icon.error {
  background: rgba(239, 68, 68, 0.12);
  color: #ef5350;
}
.foneva-modal-icon.warning {
  background: rgba(245, 166, 35, 0.12);
  color: #ffa726;
}
.foneva-modal-icon.info {
  background: rgba(41, 121, 255, 0.12);
  color: #5b9aff;
}
.foneva-modal-icon.confirm {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold, #d4af37);
}

.foneva-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary, #f3ecda);
  margin-bottom: 4px;
  line-height: 1.5;
}

.foneva-modal-body {
  font-size: 14px;
  color: var(--text-secondary, #c9c2b0);
  line-height: 1.8;
  text-align: center;
  margin-bottom: 20px;
  word-break: break-word;
}

.foneva-modal-body strong,
.foneva-modal-body b {
  color: var(--text-primary, #f3ecda);
}

/* ---------- فوتر مودال (دکمه‌ها) ---------- */
.foneva-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.foneva-modal-btn {
  flex: 1;
  max-width: 160px;
  padding: 11px 20px;
  border: none;
  border-radius: 10px;
  font-family: var(--font, 'Vazirmatn', Tahoma, sans-serif);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 0.61, 0.36, 1);
  position: relative;
  overflow: hidden;
}

.foneva-modal-btn.primary {
  background: linear-gradient(135deg, var(--gold, #d4af37), var(--gold-dark, #a8841c));
  color: var(--bg-deep, #0a0906);
}
.foneva-modal-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
}
.foneva-modal-btn.primary:active {
  transform: translateY(0) scale(0.97);
}

.foneva-modal-btn.secondary {
  background: var(--bg-elevated, #1c1a15);
  color: var(--text-secondary, #c9c2b0);
  border: 1px solid var(--border-subtle, #2a271e);
}
.foneva-modal-btn.secondary:hover {
  border-color: var(--gold, #d4af37);
  color: var(--gold, #d4af37);
  transform: translateY(-2px);
}
.foneva-modal-btn.secondary:active {
  transform: translateY(0) scale(0.97);
}

.foneva-modal-btn.danger {
  background: linear-gradient(135deg, #ef5350, #c62828);
  color: #fff;
}
.foneva-modal-btn.danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}
.foneva-modal-btn.danger:active {
  transform: translateY(0) scale(0.97);
}

/* ---------- انیمیشن‌ها ---------- */
@keyframes foneva-modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes foneva-modal-scale-in {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes foneva-modal-icon-bounce {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  60% {
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---------- تایست (نوتیفیکیشن) ---------- */
#fonevaToast {
  position: fixed;
  bottom: 24px;
  right: 50%;
  transform: translateX(50%);
  z-index: 100001;
  padding: 14px 28px;
  border-radius: 12px;
  font-family: var(--font, 'Vazirmatn', Tahoma, sans-serif);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(212, 175, 55, 0.1);
  direction: rtl;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

#fonevaToast.show {
  opacity: 1;
  transform: translateX(50%) translateY(0);
  animation: foneva-toast-in 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

#fonevaToast.toast-success {
  background: linear-gradient(135deg, #00a650, #008040);
  color: #fff;
}
#fonevaToast.toast-error {
  background: linear-gradient(135deg, #ef5350, #c62828);
  color: #fff;
}
#fonevaToast.toast-info {
  background: linear-gradient(135deg, #2979ff, #1565c0);
  color: #fff;
}
#fonevaToast.toast-warning {
  background: linear-gradient(135deg, #ffa726, #f57c00);
  color: #fff;
}
#fonevaToast.toast-gold {
  background: linear-gradient(135deg, var(--gold, #d4af37), var(--gold-dark, #a8841c));
  color: var(--bg-deep, #0a0906);
}

@keyframes foneva-toast-in {
  from {
    opacity: 0;
    transform: translateX(50%) translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(50%) translateY(0) scale(1);
  }
}

/* ---------- لودینگ تمام‌صفحه ---------- */
.foneva-loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100002;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.foneva-loading-overlay.active {
  display: flex;
  animation: foneva-modal-fade-in 0.2s ease both;
}

.foneva-loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--gold, #d4af37);
  border-radius: 50%;
  animation: foneva-spin 0.8s linear infinite;
}

.foneva-loading-text {
  font-size: 14px;
  color: var(--text-secondary, #c9c2b0);
  font-weight: 500;
}

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

/* ---------- ریسپانسیو ---------- */
@media (max-width: 480px) {
  .foneva-modal-box {
    padding: 24px 18px 18px;
    border-radius: 14px;
  }
  .foneva-modal-icon {
    width: 48px;
    height: 48px;
    font-size: 24px;
    margin-bottom: 12px;
  }
  .foneva-modal-title {
    font-size: 15px;
  }
  .foneva-modal-body {
    font-size: 13px;
  }
  .foneva-modal-btn {
    font-size: 13px;
    padding: 10px 14px;
  }
  #fonevaToast {
    font-size: 13px;
    padding: 12px 20px;
    max-width: calc(100vw - 32px);
    white-space: normal;
    text-align: center;
  }
}
