/* ==========================================================================
   solo.link — Micro-Interactions & UI Animations
   Notifications, In-App Messages, Delete Transitions, Modals & Tabs
   ========================================================================== */

/* Toast Notification Enter / Exit + Auto-Dismiss Progress */
@keyframes slToastIn {
  0% {
    opacity: 0;
    transform: translateY(-14px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slToastOut {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
    max-height: 120px;
  }
  100% {
    opacity: 0;
    transform: translateX(28px) scale(0.95);
    max-height: 0;
    margin: 0;
    padding-block: 0;
  }
}

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

.toast-item {
  position: relative;
  overflow: hidden;
  animation: slToastIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.toast-item.is-leaving {
  animation: slToastOut 0.26s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.toast-item::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  height: 3px;
  background: var(--color-primary);
  transform-origin: left center;
  animation: slToastTimer 4.5s linear forwards;
}

.toast-item.toast-danger::after {
  background: var(--color-danger);
}

.toast-item.toast-warning::after {
  background: var(--color-warning);
}

.toast-item.toast-info::after {
  background: var(--color-info);
}

/* Notification Bell Badge Pulse */
@keyframes slBadgePop {
  0% {
    transform: scale(0.6);
  }
  60% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

.notif-badge-anim {
  animation: slBadgePop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Notification List Item Enter */
@keyframes slFadeSlideUp {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.notif-item-enter {
  animation: slFadeSlideUp 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* In-App Message Bubble Enter */
@keyframes slMsgPop {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.msg-bubble-enter {
  animation: slMsgPop 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Delete Collapse & Fade-Out (HTMX swap:260ms & JS trigger) */
@keyframes slDeleteOut {
  0% {
    opacity: 1;
    transform: scale(1) translateX(0);
    max-height: 240px;
  }
  45% {
    opacity: 0.45;
    transform: scale(0.98) translateX(-10px);
    background: var(--status-danger-bg);
    border-color: var(--status-danger-border);
  }
  100% {
    opacity: 0;
    transform: scale(0.95) translateX(-20px);
    max-height: 0;
    padding-block: 0;
    margin-block: 0;
    border-width: 0;
  }
}

.is-deleting,
.htmx-swapping[data-animate-delete] {
  overflow: hidden;
  pointer-events: none;
  animation: slDeleteOut 0.28s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* Modal Backdrop & Dialog Spring */
@keyframes slBackdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slModalIn {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-backdrop {
  animation: slBackdropIn 0.18s ease forwards;
}

.modal-dialog {
  animation: slModalIn 0.24s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Tab Panel Fade Transition */
.tab-panel-anim {
  animation: slFadeSlideUp 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Dropdown Pop */
@keyframes slMenuIn {
  0% {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ds.open .pl,
.dropdown-panel-anim {
  animation: slMenuIn 0.16s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Spin & Shimmer */
@keyframes slSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes slShimmer {
  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast-item,
  .toast-item.is-leaving,
  .toast-item::after,
  .notif-badge-anim,
  .notif-item-enter,
  .msg-bubble-enter,
  .is-deleting,
  .modal-backdrop,
  .modal-dialog,
  .tab-panel-anim,
  .ds.open .pl,
  .dropdown-panel-anim,
  .spin,
  .sk i {
    animation: none !important;
    transition: none !important;
  }
}
