/**
 * SchoolOS — global top-right toast notifications
 */

.schoolos-toast-host {
  position: fixed;
  top: calc(var(--shell-topbar-h, 64px) + 12px);
  right: 16px;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  width: min(380px, calc(100vw - 24px));
  pointer-events: none;
}

.schoolos-layout-auth .schoolos-toast-host {
  top: 16px;
}

.schoolos-toast {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 14px 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 10px);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: schoolos-toast-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.schoolos-toast.is-leaving {
  animation: schoolos-toast-out 0.22s ease forwards;
}

.schoolos-toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--radius-lg, 10px) 0 0 var(--radius-lg, 10px);
}

.schoolos-toast--success::before {
  background: var(--success);
}

.schoolos-toast--error::before {
  background: var(--danger);
}

.schoolos-toast--warning::before {
  background: var(--warning);
}

.schoolos-toast--info::before {
  background: var(--info);
}

.schoolos-toast__icon {
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  font-size: 1.05rem;
  margin-top: 1px;
}

.schoolos-toast--success .schoolos-toast__icon {
  color: var(--success);
}

.schoolos-toast--error .schoolos-toast__icon {
  color: var(--danger);
}

.schoolos-toast--warning .schoolos-toast__icon {
  color: var(--warning);
}

.schoolos-toast--info .schoolos-toast__icon {
  color: var(--info);
}

.schoolos-toast__body {
  flex: 1;
  min-width: 0;
}

.schoolos-toast__title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  margin-bottom: 2px;
}

.schoolos-toast__message {
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text-1);
  word-break: break-word;
}

.schoolos-toast__close {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-3);
  padding: 2px 4px;
  margin: -2px -4px 0 0;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-sm, 6px);
  transition: color 0.15s, background 0.15s;
}

.schoolos-toast__close:hover {
  color: var(--text-1);
  background: var(--surface-2);
}

.schoolos-toast__progress {
  position: absolute;
  left: 4px;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--border);
  transform-origin: left center;
}

.schoolos-toast--success .schoolos-toast__progress-fill {
  background: var(--success);
}

.schoolos-toast--error .schoolos-toast__progress-fill {
  background: var(--danger);
}

.schoolos-toast--warning .schoolos-toast__progress-fill {
  background: var(--warning);
}

.schoolos-toast--info .schoolos-toast__progress-fill {
  background: var(--info);
}

.schoolos-toast__progress-fill {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(1);
  transform-origin: left center;
}

.schoolos-toast.is-paused .schoolos-toast__progress-fill {
  animation-play-state: paused !important;
}

@keyframes schoolos-toast-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes schoolos-toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

@media (max-width: 576px) {
  .schoolos-toast-host {
    right: 12px;
    left: 12px;
    width: auto;
    align-items: stretch;
  }
}
