/* ═══════════════════════════════════════════════════════════════
   ALERTS - Sistema global de alertas

   Componentes reutilizables para toda la aplicación:
   - .alert (base)
   - .alert-success (verde)
   - .alert-error (rojo)
   - .alert-info (azul)
   - .alert-warning (amarillo)

   Compatible con: Desktop + Mobile + Dark Mode
   ═══════════════════════════════════════════════════════════════ */

/* Base alert */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid transparent;
  animation: slideDown 0.3s ease;
}

.alert-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  font-size: 0.95rem;
}

.alert-message {
  margin: 0;
  opacity: 0.9;
}

/* Success alert (verde) */
.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #16a34a;
}

.dark_mode .alert-success {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}

/* Error alert (rojo) */
.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

.dark_mode .alert-error {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* Info alert (azul) */
.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #2563eb;
}

.dark_mode .alert-info {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}

/* Warning alert (amarillo) */
.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #d97706;
}

.dark_mode .alert-warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

/* Alert con botón de cerrar */
.alert-dismissible {
  padding-right: 3rem;
  position: relative;
}

.alert-close {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: currentColor;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: var(--transition-fast);
  border-radius: var(--radius-sm);
}

.alert-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.alert-close svg {
  width: 18px;
  height: 18px;
}

/* Animación de entrada */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animación de salida */
.alert.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* Alert pequeño (compacto) */
.alert-sm {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
}

.alert-sm .alert-icon {
  width: 16px;
  height: 16px;
}

/* Alert grande */
.alert-lg {
  padding: 1.25rem 1.5rem;
  font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .alert {
    padding: 0.875rem 1rem;
    font-size: 0.85rem;
  }

  .alert-dismissible {
    padding-right: 2.5rem;
  }

  .alert-close {
    right: 0.75rem;
  }
}

/* Reducir movimiento si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
  .alert {
    animation: none;
  }

  .alert.fade-out {
    animation: none;
    opacity: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS - Notificaciones flotantes
   ═══════════════════════════════════════════════════════════════ */

/* Contenedor de toasts (centrado arriba) */
.toast-container {
  position: fixed;
  top: 5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
  align-items: center;
}

/* Toast base */
.toast {
  background: var(--bg-primary);
  padding: 1.125rem 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-width: 400px;
  max-width: 500px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  opacity: 0;
  transform: translateY(-50px);
  transition: var(--transition-smooth);
  pointer-events: auto;
}

/* Toast visible */
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Toast success (verde) */
.toast-success {
  border-left: 4px solid #22c55e;
}

.toast-success::before {
  content: '';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'%3E%3C/path%3E%3Cpolyline points='22 4 12 14.01 9 11.01'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

/* Toast error (rojo) */
.toast-error {
  border-left: 4px solid #ef4444;
}

.toast-error::before {
  content: '';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='15' y1='9' x2='9' y2='15'%3E%3C/line%3E%3Cline x1='9' y1='9' x2='15' y2='15'%3E%3C/line%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

/* Toast info (azul) */
.toast-info {
  border-left: 4px solid var(--primary-color);
}

.toast-info::before {
  content: '';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231157ee' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'%3E%3C/line%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

/* Toast warning (amarillo) */
.toast-warning {
  border-left: 4px solid #f59e0b;
}

.toast-warning::before {
  content: '';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'%3E%3C/path%3E%3Cline x1='12' y1='9' x2='12' y2='13'%3E%3C/line%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'%3E%3C/line%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

/* Dark mode */
.dark_mode .toast {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
  .toast-container {
    top: 4.5rem;
    left: 1rem;
    right: 1rem;
    transform: none;
  }

  .toast {
    min-width: auto;
    width: 100%;
    max-width: 100%;
  }
}

/* Reducir movimiento */
@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
    animation: none;
  }

  .toast.show {
    transform: none;
  }
}
