/* Modern Toastr Redesign */
:root {
  /* Core Variables */
  --toast-font: 'Inter', system-ui, -apple-system, sans-serif;
  --toast-duration: 300ms;
  --toast-easing: cubic-bezier(0.215, 0.61, 0.355, 1);

  /* Dimensions */
  --toast-width: min(90vw, 380px);
  --toast-height: auto;
  --toast-radius: 16px;
  --toast-padding: 16px 24px 16px 56px;
  --toast-gap: 16px;
  --toast-icon-size: 28px;
  --toast-progress-height: 4px;

  /* Colors - Light Mode */
  --toast-bg: rgba(255, 255, 255, 0.98);
  --toast-color: #1e293b; /* slate-800 */
  --toast-border: rgba(15, 23, 42, 0.1);
  --toast-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);

  /* Accents */
  --toast-accent: #64748b; /* slate-500 */
  --toast-info: #0ea5e9;   /* sky-500 */
  --toast-success: #22c55e; /* green-500 */
  --toast-warning: #f59e0b; /* amber-500 */
  --toast-error: #ef4444;   /* red-500 */

  /* Dark Mode Overrides */
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --toast-bg: rgba(15, 23, 42, 0.95);
    --toast-color: #f8fafc; /* slate-50 */
    --toast-border: rgba(148, 163, 184, 0.2);
    --toast-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  }
}

/* Container */
#toast-container {
  position: fixed;
  z-index: 1000000;
  pointer-events: none;
  padding: 16px;
  max-width: 100vw;
}

/* Base Toast Styling */
#toast-container > div {
  font-family: var(--toast-font);
  width: var(--toast-width);
  margin: 0 0 var(--toast-gap);
  padding: var(--toast-padding);
  border-radius: var(--toast-radius);
  background: var(--toast-bg);
  color: var(--toast-color);
  border: 1px solid var(--toast-border);
  box-shadow: var(--toast-shadow);
  position: relative;
  overflow: hidden;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
  opacity: 1;
  transition: transform var(--toast-duration) var(--toast-easing), 
              opacity var(--toast-duration) var(--toast-easing);
}

/* Toast Types with Accent Colors */
#toast-container > .toast-info { --toast-accent: var(--toast-info); }
#toast-container > .toast-success { --toast-accent: var(--toast-success); }
#toast-container > .toast-warning { --toast-accent: var(--toast-warning); }
#toast-container > .toast-error { --toast-accent: var(--toast-error); }

/* Left Accent Bar */
#toast-container > div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 6px;
  background: var(--toast-accent);
}

/* Modern SVG Icons */
@supports (mask-image: url(#)) {
  #toast-container > div::after {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: var(--toast-icon-size);
    height: var(--toast-icon-size);
    background: var(--toast-accent);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2v-4h2v4z'/%3E%3C/svg%3E") no-repeat center / contain;
  }

  .toast-success::after { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z'/%3E%3C/svg%3E"); }
  .toast-warning::after { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M1 21h22L12 2 1 21zm12-3h-2v2h2v-2zm0-8h-2v6h2v-6z'/%3E%3C/svg%3E"); }
  .toast-error::after { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 15H7v-2h10v2zm0-8H7v-2h10v2z'/%3E%3C/svg%3E"); }
}

/* Text Content Styling */
.toast-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 0 4px 48px;
  line-height: 1.3;
}

.toast-message {
  font-size: 0.95rem;
  margin: 0 0 0 48px;
  opacity: 0.9;
  line-height: 1.5;
}

/* Close Button */
.toast-close-button {
  position: absolute;
  right: 16px;
  top: 16px;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  opacity: 0.6;
  transition: opacity 0.2s, background 0.2s;
}

.toast-close-button:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

/* Progress Bar */
.toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: var(--toast-progress-height);
  background: var(--toast-accent);
  opacity: 0.8;
  transition: width 0.3s linear;
}

/* Positions & Animations */
@keyframes slide-in-right { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slide-in-left  { from { transform: translateX(-20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slide-in-up    { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slide-out     { to { transform: translateY(-20px); opacity: 0; } }

/* Position Classes */
.toast-top-right { animation: slide-in-right var(--toast-duration) var(--toast-easing); top: 24px; right: 24px; }
.toast-top-left  { animation: slide-in-left var(--toast-duration) var(--toast-easing); top: 24px; left: 24px; }
.toast-bottom-right { animation: slide-in-right var(--toast-duration) var(--toast-easing); bottom: 24px; right: 24px; }
.toast-bottom-left  { animation: slide-in-left var(--toast-duration) var(--toast-easing); bottom: 24px; left: 24px; }
.toast-top-center,
.toast-bottom-center { left: 50%; transform: translateX(-50%); }

/* Compact Mode for Mobile */
@media (max-width: 480px) {
  :root {
    --toast-width: min(95vw, 320px);
    --toast-padding: 14px 20px 14px 48px;
  }

  #toast-container {
    padding: 12px;
  }

  .toast-title { font-size: 1rem; margin-bottom: 2px; }
  .toast-message { font-size: 0.9rem; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  #toast-container > div {
    animation: none !important;
    transform: none !important;
  }
}