/**
 * Notification System
 * Beautiful toast-style notifications for the educational platform
 */

/* ===== MESSAGE NOTIFICATIONS ===== */
.message {
  position: fixed;
  top: 150px;
  /* Position below WP admin bar + main menu */
  right: var(--space-lg);
  z-index: 1001;
  max-width: 400px;
  min-width: 300px;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(10px);
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-primary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  font-weight: var(--font-weight-medium);
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.message::before {
  content: '';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-top: 2px;
}

/* Success Messages */
.message-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-success);
  border-color: rgba(16, 185, 129, 0.3);
}

.message-success::before {
  background: radial-gradient(circle, var(--color-success) 30%, transparent 30%);
  background-size: 4px 4px;
  background-position: center;
  content: '✓';
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-success);
  color: white;
  font-weight: var(--font-weight-bold);
  font-size: 12px;
}

/* Error Messages */
.message-error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
  border-color: rgba(239, 68, 68, 0.3);
}

.message-error::before {
  content: '✕';
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-error);
  color: white;
  font-weight: var(--font-weight-bold);
  font-size: 12px;
}

/* Info Messages */
.message-info {
  background: rgba(6, 182, 212, 0.1);
  color: var(--color-info);
  border-color: rgba(6, 182, 212, 0.3);
}

.message-info::before {
  content: 'i';
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-info);
  color: white;
  font-weight: var(--font-weight-bold);
  font-size: 12px;
  font-style: italic;
}

/* Warning Messages */
.message-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.3);
}

.message-warning::before {
  content: '!';
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-warning);
  color: white;
  font-weight: var(--font-weight-bold);
  font-size: 12px;
}

/* ===== ANIMATIONS ===== */
@keyframes slideInRight {
  0% {
    transform: translateX(100%);
    opacity: 0;
  }

  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  0% {
    transform: translateX(0);
    opacity: 1;
  }

  100% {
    transform: translateX(100%);
    opacity: 0;
  }
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

/* ===== PROGRESS INDICATOR ===== */
.message-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.3;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: progressCountdown 3s linear;
}

@keyframes progressCountdown {
  0% {
    width: 100%;
  }

  100% {
    width: 0%;
  }
}

/* ===== CLOSE BUTTON ===== */
.message-close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: none;
  border: none;
  color: currentColor;
  cursor: pointer;
  font-size: 16px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: all var(--transition-base);
}

.message-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

/* ===== STACKED NOTIFICATIONS ===== */
.message+.message {
  top: calc(150px + 80px);
}

.message+.message+.message {
  top: calc(150px + 160px);
}

.message+.message+.message+.message {
  top: calc(150px + 240px);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .message {
    top: var(--space-md);
    right: var(--space-md);
    left: var(--space-md);
    max-width: none;
    min-width: auto;
  }

  .message+.message {
    top: calc(var(--space-md) + 70px);
  }

  .message+.message+.message {
    top: calc(var(--space-md) + 140px);
  }

  .message+.message+.message+.message {
    top: calc(var(--space-md) + 210px);
  }
}

@media (max-width: 480px) {
  .message {
    padding: var(--space-md);
    font-size: var(--font-size-xs);
  }

  .message::before {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  .message {
    animation: none;
  }

  .message-progress {
    animation: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .message {
    border-width: 2px;
  }

  .message::before {
    border: 2px solid currentColor;
  }
}

/* ===== GLOBAL NOTIFICATION CONTAINER ===== */
.notifications-container {
  position: fixed;
  top: 150px;
  /* Position below WP admin bar + main menu */
  right: var(--space-lg);
  z-index: 1001;
  pointer-events: none;
}

.notifications-container .message {
  position: relative;
  top: auto;
  right: auto;
  margin-bottom: var(--space-md);
  pointer-events: auto;
}

@media (max-width: 768px) {
  .notifications-container {
    top: var(--space-md);
    right: var(--space-md);
    left: var(--space-md);
  }
}