/* ============================================================
   Librya Live — ribbon + toasts
   ============================================================ */

/* ---------- Top loading ribbon ---------- */
#librya-ribbon {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
  overflow: hidden;
  background: transparent;
}
#librya-ribbon.is-active { opacity: 1; }

#librya-ribbon .librya-ribbon-bar {
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(
    90deg,
    var(--gold, #D4A73A) 0%,
    var(--primary, #1F5C3B) 55%,
    var(--gold, #D4A73A) 100%
  );
  box-shadow: 0 0 10px rgba(212, 167, 58, 0.6), 0 0 4px rgba(31, 92, 59, 0.5);
  animation: librya-ribbon-slide 1.15s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes librya-ribbon-slide {
  0%   { left: -40%; }
  100% { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  #librya-ribbon .librya-ribbon-bar {
    animation: none;
    left: 0;
    width: 100%;
    opacity: 0.65;
  }
}

/* ---------- Toasts ---------- */
#librya-toasts {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  max-width: min(380px, calc(100vw - 2rem));
  pointer-events: none;
}
#librya-toasts > * { pointer-events: auto; }

.librya-toast {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .7rem .85rem;
  border-radius: .6rem;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 10px 30px -12px rgba(20, 40, 30, .28), 0 2px 6px rgba(20, 40, 30, .08);
  font-size: .86rem;
  line-height: 1.4;
  color: var(--foreground);
  animation: librya-toast-in 200ms cubic-bezier(.2,.8,.2,1);
}
.librya-toast.is-leaving {
  animation: librya-toast-out 220ms ease forwards;
}

.librya-toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 999px;
}
.librya-toast-icon svg { width: 15px; height: 15px; stroke-width: 2.4; }

.librya-toast-body { flex: 1 1 auto; min-width: 0; }

.librya-toast-close {
  background: transparent;
  border: 0;
  padding: 0;
  margin-left: .15rem;
  color: var(--muted-foreground);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: .35rem;
  flex: 0 0 auto;
}
.librya-toast-close:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}
.librya-toast-close svg { width: 13px; height: 13px; }

/* Tones */
.librya-toast-success { border-left: 3px solid var(--success); }
.librya-toast-success .librya-toast-icon {
  background: color-mix(in oklab, var(--success) 14%, transparent);
  color: var(--success);
}
.librya-toast-error { border-left: 3px solid var(--destructive); }
.librya-toast-error .librya-toast-icon {
  background: color-mix(in oklab, var(--destructive) 14%, transparent);
  color: var(--destructive);
}
.librya-toast-warning { border-left: 3px solid var(--warning); }
.librya-toast-warning .librya-toast-icon {
  background: color-mix(in oklab, var(--warning) 18%, transparent);
  color: oklch(0.55 0.15 70);
}
.librya-toast-info { border-left: 3px solid var(--primary); }
.librya-toast-info .librya-toast-icon {
  background: var(--primary-soft);
  color: var(--primary);
}

@keyframes librya-toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
@keyframes librya-toast-out {
  to { opacity: 0; transform: translateY(-6px); }
}

@media (max-width: 480px) {
  #librya-toasts {
    top: auto;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}