/**
 * Toasts Material Design - Quiniela El Trébol
 * v1.0.0 - Estilos personalizados para SweetAlert2 y toastr
 *
 * Basado en Material Design 3.0
 * - Sombras elevation
 * - Colores semantic
 * - Tipografía Roboto/Inter
 * - Animaciones suaves
 */

:root {
  /* Colors Material Design */
  --toast-success: #2e7d32;
  --toast-error: #c62828;
  --toast-warning: #f57c00;
  --toast-info: #0288d1;

  /* Shadows Material Design */
  --toast-elevation-6: 0 3px 5px -1px rgba(0,0,0,.2), 0 6px 10px 0 rgba(0,0,0,.14), 0 1px 18px 0 rgba(0,0,0,.12);
  --toast-elevation-8: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);

  /* Typography */
  --toast-font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --toast-font-size: 0.9375rem;
  --toast-line-height: 1.5;

  /* Spacing */
  --toast-padding: 14px 20px;
  --toast-border-radius: 8px;

  /* Timing */
  --toast-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   SWEETALERT2 - Material Design Popup
   ============================================================ */

.swal2-popup.toast-md-popup {
  font-family: var(--toast-font-family) !important;
  font-size: var(--toast-font-size) !important;
  padding: var(--toast-padding) !important;
  border-radius: var(--toast-border-radius) !important;
  box-shadow: var(--toast-elevation-8) !important;
  border: none !important;
  backdrop-filter: blur(10px);
  min-width: 280px;
  max-width: 400px;
}

/* Title */
.swal2-popup.toast-md-popup .toast-md-title {
  font-size: var(--toast-font-size) !important;
  font-weight: 500 !important;
  line-height: var(--toast-line-height) !important;
  margin: 0 !important;
  padding: 0 0 0 8px !important;
  color: rgba(0, 0, 0, 0.87) !important;
}

/* Icon customization */
.swal2-popup.toast-md-popup .toast-md-icon {
  width: 28px !important;
  height: 28px !important;
  margin: 0 !important;
  border: none !important;
  font-size: 20px !important;
}

/* Success icon */
.swal2-popup.toast-md-popup.swal2-icon-success {
  background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%) !important;
  color: white !important;
}

.swal2-popup.toast-md-popup.swal2-icon-success .toast-md-title {
  color: white !important;
}

.swal2-popup.toast-md-popup.swal2-icon-success .swal2-icon {
  border-color: rgba(255, 255, 255, 0.5) !important;
  color: white !important;
}

.swal2-popup.toast-md-popup.swal2-icon-success .swal2-success-ring {
  border-color: rgba(255, 255, 255, 0.3) !important;
}

.swal2-popup.toast-md-popup.swal2-icon-success [class^='swal2-success-line'] {
  background-color: white !important;
}

/* Error icon */
.swal2-popup.toast-md-popup.swal2-icon-error {
  background: linear-gradient(135deg, #e53935 0%, #c62828 100%) !important;
  color: white !important;
}

.swal2-popup.toast-md-popup.swal2-icon-error .toast-md-title {
  color: white !important;
}

.swal2-popup.toast-md-popup.swal2-icon-error .swal2-icon {
  border-color: rgba(255, 255, 255, 0.5) !important;
  color: white !important;
}

.swal2-popup.toast-md-popup.swal2-icon-error [class^='swal2-x-mark-line'] {
  background-color: white !important;
}

/* Warning icon */
.swal2-popup.toast-md-popup.swal2-icon-warning {
  background: linear-gradient(135deg, #fb8c00 0%, #f57c00 100%) !important;
  color: white !important;
}

.swal2-popup.toast-md-popup.swal2-icon-warning .toast-md-title {
  color: white !important;
}

.swal2-popup.toast-md-popup.swal2-icon-warning .swal2-icon {
  border-color: rgba(255, 255, 255, 0.5) !important;
  color: white !important;
}

.swal2-popup.toast-md-popup.swal2-icon-warning .swal2-icon-content {
  color: white !important;
}

/* Info icon */
.swal2-popup.toast-md-popup.swal2-icon-info {
  background: linear-gradient(135deg, #039be5 0%, #0288d1 100%) !important;
  color: white !important;
}

.swal2-popup.toast-md-popup.swal2-icon-info .toast-md-title {
  color: white !important;
}

.swal2-popup.toast-md-popup.swal2-icon-info .swal2-icon {
  border-color: rgba(255, 255, 255, 0.5) !important;
  color: white !important;
}

.swal2-popup.toast-md-popup.swal2-icon-info .swal2-icon-content {
  color: white !important;
}

/* Timer Progress Bar */
.toast-md-progress {
  height: 3px !important;
  background: rgba(255, 255, 255, 0.3) !important;
  border-radius: 0 0 var(--toast-border-radius) var(--toast-border-radius) !important;
}

.swal2-popup.swal2-toast .swal2-timer-progress-bar {
  background: rgba(255, 255, 255, 0.7) !important;
}

/* Container layout */
.swal2-popup.swal2-toast.toast-md-popup .swal2-html-container {
  margin: 0 !important;
  padding: 0 !important;
}

/* Hover effect */
.swal2-popup.toast-md-popup:hover {
  transform: translateY(-2px);
  box-shadow:
    0 7px 8px -4px rgba(0,0,0,.2),
    0 12px 17px 2px rgba(0,0,0,.14),
    0 5px 22px 4px rgba(0,0,0,.12) !important;
  transition: var(--toast-transition);
}

/* ============================================================
   LOADING STATE
   ============================================================ */

.toast-md-loading {
  border-radius: 12px !important;
  padding: 24px !important;
}

.toast-md-loading .swal2-title {
  font-size: 1rem !important;
  margin-top: 16px !important;
}

/* ============================================================
   CONFIRM DIALOG
   ============================================================ */

.toast-md-confirm {
  border-radius: 16px !important;
  padding: 24px !important;
  box-shadow: var(--toast-elevation-8) !important;
}

.toast-md-confirm .swal2-title {
  font-size: 1.25rem !important;
  font-weight: 500 !important;
  color: rgba(0, 0, 0, 0.87) !important;
}

.toast-md-confirm .swal2-html-container {
  font-size: 0.9375rem !important;
  color: rgba(0, 0, 0, 0.6) !important;
  line-height: 1.5 !important;
}

.toast-md-confirm .swal2-actions {
  gap: 12px !important;
  margin-top: 24px !important;
}

.toast-md-confirm .swal2-confirm,
.toast-md-confirm .swal2-cancel {
  border-radius: 8px !important;
  padding: 10px 24px !important;
  font-weight: 500 !important;
  font-size: 0.9375rem !important;
  text-transform: none !important;
  box-shadow: none !important;
  transition: var(--toast-transition) !important;
}

.toast-md-confirm .swal2-confirm:hover,
.toast-md-confirm .swal2-cancel:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,.2) !important;
}

/* ============================================================
   TOASTR - Material Design Override
   ============================================================ */

#toast-container > div {
  box-shadow: var(--toast-elevation-6) !important;
  border-radius: var(--toast-border-radius) !important;
  padding: 16px 20px !important;
  font-family: var(--toast-font-family) !important;
  font-size: var(--toast-font-size) !important;
  line-height: var(--toast-line-height) !important;
  opacity: 0.98 !important;
  backdrop-filter: blur(10px);
}

#toast-container > .toast-success {
  background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%) !important;
}

#toast-container > .toast-error {
  background: linear-gradient(135deg, #e53935 0%, #c62828 100%) !important;
}

#toast-container > .toast-warning {
  background: linear-gradient(135deg, #fb8c00 0%, #f57c00 100%) !important;
}

#toast-container > .toast-info {
  background: linear-gradient(135deg, #039be5 0%, #0288d1 100%) !important;
}

#toast-container > div:hover {
  box-shadow: var(--toast-elevation-8) !important;
  opacity: 1 !important;
}

#toast-container .toast-progress {
  height: 3px !important;
  opacity: 0.7 !important;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes toastFadeInDown {
  from {
    opacity: 0;
    transform: translate3d(0, -20px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes toastFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translate3d(0, -10px, 0);
  }
}

.animate__fadeInDown {
  animation-name: toastFadeInDown;
}

.animate__fadeOut {
  animation-name: toastFadeOut;
}

.animate__faster {
  animation-duration: 0.3s !important;
}

/* ============================================================
   DARK MODE
   ============================================================ */

@media (prefers-color-scheme: dark) {
  .swal2-popup.toast-md-popup .toast-md-title {
    color: rgba(255, 255, 255, 0.95) !important;
  }

  .toast-md-confirm {
    background-color: #1e1e1e !important;
  }

  .toast-md-confirm .swal2-title {
    color: rgba(255, 255, 255, 0.95) !important;
  }

  .toast-md-confirm .swal2-html-container {
    color: rgba(255, 255, 255, 0.7) !important;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .swal2-popup.toast-md-popup {
    min-width: 260px;
    max-width: calc(100vw - 40px);
    font-size: 0.875rem !important;
  }

  .toast-md-confirm {
    width: calc(100vw - 40px) !important;
    max-width: 400px !important;
  }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .swal2-popup.toast-md-popup,
  #toast-container > div {
    transition: none !important;
    animation: none !important;
  }

  .swal2-popup.toast-md-popup:hover {
    transform: none !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .swal2-popup.toast-md-popup,
  #toast-container > div {
    border: 2px solid currentColor !important;
  }
}

/* ============================================================
   PRINT
   ============================================================ */

@media print {
  .swal2-container,
  #toast-container {
    display: none !important;
  }
}
