/* ============================================================================
   🔔 POPUP & TOAST SYSTEM - Roblox Arabic Hub
   Beautiful Notifications with Animations
   ============================================================================ */

/* ============= TOAST CONTAINER ============= */
#toastContainer {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 90vw;
}

/* ============= TOAST ITEM ============= */
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  min-width: 320px;
  max-width: 500px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.3),
    0 0 60px rgba(46, 174, 209, 0.1);
  pointer-events: auto;
  animation: toastSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

html[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.15),
    0 0 60px rgba(46, 174, 209, 0.08);
}

.toast.removing {
  animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
  }
}

/* Toast Icon */
.toast-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 22px;
  flex-shrink: 0;
}

/* Toast Content */
.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.toast-message {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

/* Toast Close */
.toast-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Toast Progress Bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  right: 0;
  height: 3px;
  border-radius: 0 0 16px 16px;
  animation: toastProgress linear forwards;
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

/* ============= TOAST VARIANTS ============= */

/* Success Toast */
.toast-success {
  border-color: rgba(16, 185, 129, 0.3);
}

.toast-success .toast-icon {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.1) 100%);
  color: #10b981;
}

.toast-success .toast-progress {
  background: linear-gradient(90deg, #10b981, #34d399);
}

/* Error Toast */
.toast-error {
  border-color: rgba(239, 68, 68, 0.3);
}

.toast-error .toast-icon {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.1) 100%);
  color: #ef4444;
}

.toast-error .toast-progress {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

/* Warning Toast */
.toast-warning {
  border-color: rgba(245, 158, 11, 0.3);
}

.toast-warning .toast-icon {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
  color: #f59e0b;
}

.toast-warning .toast-progress {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

/* Info Toast */
.toast-info {
  border-color: rgba(59, 130, 246, 0.3);
}

.toast-info .toast-icon {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.1) 100%);
  color: #3b82f6;
}

.toast-info .toast-progress {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

/* ============= POPUP MODAL ============= */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

.popup-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 40px 32px;
  background: var(--bg-card);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.4),
    0 0 100px rgba(46, 174, 209, 0.1);
  text-align: center;
  transform: scale(0.9) translateY(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme="light"] .popup-content {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.2),
    0 0 100px rgba(46, 174, 209, 0.08);
}

.popup-overlay.active .popup-content {
  transform: scale(1) translateY(0);
}

/* Popup Icon */
.popup-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 40px;
}

/* Success Popup Icon */
.popup-success .popup-icon {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.05) 100%);
  color: #10b981;
  animation: popupIconSuccess 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

@keyframes popupIconSuccess {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(10deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Checkmark Animation */
.popup-checkmark {
  width: 60px;
  height: 60px;
  position: relative;
}

.popup-checkmark svg {
  width: 100%;
  height: 100%;
}

.popup-checkmark .checkmark-circle {
  stroke: #10b981;
  stroke-width: 3;
  fill: none;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: checkmarkCircle 0.6s ease-in-out forwards;
}

.popup-checkmark .checkmark-check {
  stroke: #10b981;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: checkmarkCheck 0.3s ease-in-out 0.5s forwards;
}

@keyframes checkmarkCircle {
  to { stroke-dashoffset: 0; }
}

@keyframes checkmarkCheck {
  to { stroke-dashoffset: 0; }
}

/* Error Popup Icon */
.popup-error .popup-icon {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.05) 100%);
  color: #ef4444;
  animation: popupIconShake 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}

@keyframes popupIconShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* Warning Popup Icon */
.popup-warning .popup-icon {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.05) 100%);
  color: #f59e0b;
  animation: popupIconBounce 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}

@keyframes popupIconBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Popup Title */
.popup-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

/* Popup Message */
.popup-message {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* Popup Buttons */
.popup-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.popup-buttons .btn {
  min-width: 120px;
}

/* ============= CONFIRM DIALOG ============= */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.confirm-overlay.active {
  opacity: 1;
  visibility: visible;
}

.confirm-content {
  width: 100%;
  max-width: 380px;
  padding: 32px;
  background: var(--bg-card);
  backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.confirm-overlay.active .confirm-content {
  transform: scale(1);
}

.confirm-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.05) 100%);
  border-radius: 50%;
  font-size: 28px;
  color: #f59e0b;
}

.confirm-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.confirm-message {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
}

.confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-buttons .btn {
  flex: 1;
  max-width: 140px;
}

/* ============= RESPONSIVE ============= */
@media (max-width: 480px) {
  .toast {
    min-width: unset;
    width: 100%;
    padding: 14px 18px;
  }
  
  .popup-content {
    padding: 32px 24px;
  }
  
  .popup-buttons {
    flex-direction: column;
  }
  
  .popup-buttons .btn {
    width: 100%;
  }
}
