/* ============================================================
   VK RADIO TRADER — toast.css
   Toast notification system
   ============================================================ */

/* ── TOAST CONTAINER ──────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
  max-width: 360px;
  width: calc(100vw - 2.5rem);
}

/* ── TOAST ────────────────────────────────────────────────── */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--white);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.08);
  pointer-events: all;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--grey-200);

  /* Fly in from right */
  animation: toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toast.toast-out {
  animation: toast-out 0.35s ease-in forwards;
}

/* ── PROGRESS BAR ─────────────────────────────────────────── */
.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  border-radius: 0 0 12px 12px;
  animation: toast-progress linear forwards;
}

/* ── ICON ─────────────────────────────────────────────────── */
.toast-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 1px;
  animation: toast-icon-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

/* ── CONTENT ──────────────────────────────────────────────── */
.toast-body { flex: 1; min-width: 0; }
.toast-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--grey-900);
  margin-bottom: 0.15rem;
  line-height: 1.3;
}
.toast-message {
  font-size: 0.78rem;
  color: var(--grey-500);
  line-height: 1.5;
  font-weight: 300;
}

/* ── CLOSE BUTTON ─────────────────────────────────────────── */
.toast-close {
  background: none;
  border: none;
  color: var(--grey-400);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.15s;
  margin-top: -1px;
}
.toast-close:hover { color: var(--grey-700); }

/* ── VARIANTS ─────────────────────────────────────────────── */
.toast-success { border-left: 4px solid var(--green); }
.toast-success .toast-progress { background: var(--green); }

.toast-error   { border-left: 4px solid var(--red); }
.toast-error   .toast-progress { background: var(--red); }

.toast-warning { border-left: 4px solid var(--gold); }
.toast-warning .toast-progress { background: var(--gold); }

.toast-info    { border-left: 4px solid var(--blue); }
.toast-info    .toast-progress { background: var(--blue); }

/* ── DARK MODE ────────────────────────────────────────────── */
[data-theme="dark"] .toast {
  background: #1e2128;
  border-color: #30363d;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
[data-theme="dark"] .toast-title   { color: #e6edf3; }
[data-theme="dark"] .toast-message { color: #8b949e; }
[data-theme="dark"] .toast-close   { color: #484f58; }
[data-theme="dark"] .toast-close:hover { color: #c9d1d9; }

/* ── ANIMATIONS ───────────────────────────────────────────── */
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(120%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
    max-height: 200px;
    margin-bottom: 0;
  }
  to {
    opacity: 0;
    transform: translateX(120%) scale(0.8);
    max-height: 0;
    margin-bottom: -0.65rem;
    padding-top: 0;
    padding-bottom: 0;
  }
}

@keyframes toast-progress {
  from { width: 100%; }
  to   { width: 0%; }
}

@keyframes toast-icon-pop {
  from { transform: scale(0) rotate(-15deg); }
  to   { transform: scale(1) rotate(0deg); }
}

/* ── MOBILE ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  #toast-container {
    top: auto;
    bottom: 1.25rem;
    right: 1rem;
    left: 1rem;
    max-width: 100%;
    width: auto;
  }
  @keyframes toast-in {
    from { opacity: 0; transform: translateY(80px) scale(0.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }
  @keyframes toast-out {
    from { opacity: 1; transform: translateY(0); max-height: 200px; }
    to   { opacity: 0; transform: translateY(80px); max-height: 0; padding: 0; }
  }
}
