/**
 * App-wide toast notifications — single visual system.
 * Used by window.createToast() (cco-toast.js) and showAppToast().
 */

:root {
  --app-toast-bg: #ffffff;
  --app-toast-shadow: 0 10px 28px rgba(2, 6, 23, 0.14);
  --app-toast-radius: 12px;
  --app-toast-border: var(--line, #e5e7eb);
  --app-toast-success: #059669;
  --app-toast-error: #dc2626;
  --app-toast-warning: #d97706;
  --app-toast-info: #2563eb;
}

.notifications {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10050;
  list-style: none;
  margin: 0;
  padding: 0;
  width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}

.notifications .toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: var(--app-toast-radius);
  background: var(--app-toast-bg);
  border: 1px solid var(--app-toast-border);
  box-shadow: var(--app-toast-shadow);
  position: relative;
  overflow: hidden;
  animation: appToastIn 0.28s ease-out;
}

/* Progress strip (5s, matches default auto-dismiss) */
.notifications .toast::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  transform-origin: left center;
  animation: appToastProgress 5s linear forwards;
}

@keyframes appToastProgress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

@keyframes appToastIn {
  from {
    transform: translateX(14px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.notifications .toast.hide {
  animation: appToastOut 0.32s ease forwards;
}

@keyframes appToastOut {
  to {
    transform: translateX(20px);
    opacity: 0;
  }
}

/* Body: icon + message (JS uses .column; prefer .toast__body going forward) */
.notifications .toast .toast__body,
.notifications .toast .column {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.notifications .toast .toast__text,
.notifications .toast .column span {
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
  word-break: break-word;
}

.notifications .toast .toast__body > i:first-child,
.notifications .toast .column > i:first-child {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast.success .toast__body > i:first-child,
.toast.success .column > i:first-child {
  color: var(--app-toast-success);
}

.toast.error .toast__body > i:first-child,
.toast.error .column > i:first-child {
  color: var(--app-toast-error);
}

.toast.warning .toast__body > i:first-child,
.toast.warning .column > i:first-child {
  color: var(--app-toast-warning);
}

.toast.info .toast__body > i:first-child,
.toast.info .column > i:first-child {
  color: var(--app-toast-info);
}

.toast.success::after {
  background: linear-gradient(90deg, var(--app-toast-success), #34d399);
}

.toast.error::after {
  background: linear-gradient(90deg, var(--app-toast-error), #f87171);
}

.toast.warning::after {
  background: linear-gradient(90deg, var(--app-toast-warning), #fbbf24);
}

.toast.info::after {
  background: linear-gradient(90deg, var(--app-toast-info), #60a5fa);
}

.toast__close {
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  flex-shrink: 0;
  line-height: 1;
}

.toast__close:hover {
  color: #475569;
  background: #f1f5f9;
}

.toast__close i {
  font-size: 0.85rem;
}

@media screen and (max-width: 530px) {
  .notifications {
    right: 12px;
    left: 12px;
    width: auto;
  }
}
