/* toast.css */
#toast-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 340px;
  z-index: 99999999 !important;
  pointer-events: none;
}

.toast {
  position: absolute;
  bottom: 0;
  width: 100%;
  border-radius: 20px;
  background: var(--toast-bg, rgba(240, 240, 240, 0.85));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--toast-border, rgba(0, 0, 0, 0.05));
  box-shadow: 0 10px 30px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.05);
  color: var(--toast-color, #1d1d1f);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: auto;
  transform: translateY(50px) scale(0.9); /* Start state before showing */
}

/* Dark mode default */
body.dark-mode .toast,
body.dark-theme .toast,
.toast {
  background: #273542;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f5f5f7;
}

body.light-mode .toast,
body.light-theme .toast {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.05);
  color: #1d1d1f;
}

/* Stacking logic - newest is last-child */
.toast.show:nth-last-child(1) {
  transform: translateY(0) scale(1);
  z-index: 100;
  opacity: 1;
}

.toast.show:nth-last-child(2) {
  transform: translateY(-16px) scale(0.95);
  z-index: 99;
  opacity: 0.85;
  filter: brightness(0.9);
}

.toast.show:nth-last-child(3) {
  transform: translateY(-32px) scale(0.90);
  z-index: 98;
  opacity: 0.6;
  filter: brightness(0.8);
}

.toast.show:nth-last-child(4) {
  transform: translateY(-48px) scale(0.85);
  z-index: 97;
  opacity: 0.3;
  filter: brightness(0.7);
}

.toast.show:nth-last-child(n+5) {
  opacity: 0;
  pointer-events: none;
}

/* Expanding on hover */
#toast-container:hover .toast.show:nth-last-child(1) { transform: translateY(0) scale(1); filter: brightness(1); opacity: 1; }
#toast-container:hover .toast.show:nth-last-child(2) { transform: translateY(-100px) scale(1); filter: brightness(1); opacity: 1; }
#toast-container:hover .toast.show:nth-last-child(3) { transform: translateY(-200px) scale(1); filter: brightness(1); opacity: 1; }
#toast-container:hover .toast.show:nth-last-child(4) { transform: translateY(-300px) scale(1); filter: brightness(1); opacity: 1; }

.toast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px 6px;
}

.toast-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toast-app-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.toast-icon { font-size: 16px; }

.toast-app-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  opacity: 0.9;
}

.toast-time {
  font-size: 12px;
  opacity: 0.6;
}

.toast-body {
  padding: 6px 18px 16px;
}

.toast-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.toast-message {
  font-size: 14px;
  opacity: 0.75;
  line-height: 1.4;
}

.toast-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3a3a3c;
  color: #98989d;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, transform 0.1s;
}

body.light-mode .toast-close,
body.light-theme .toast-close {
  background: #e5e5ea;
  color: #8e8e93;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.toast:hover .toast-close { opacity: 1; }
.toast-close:hover { filter: brightness(1.2); transform: scale(1.05); }

/* Colors for the icons */
.toast-info .toast-icon { color: #0a84ff; }
.toast-success .toast-icon { color: #30d158; }
.toast-error .toast-icon { color: #ff453a; }
.toast-warning .toast-icon { color: #ff9f0a; }
