/* ============================================
   ANIMATIONS.CSS - All Micro-Interactions
   ============================================ */

/* ---- Floating Animation ---- */
@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-8px);
    }
}

/* ---- Pulse Ring ---- */
@keyframes pulse-ring {
    0% {
        transform: scale(0.85);
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.5);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 12px rgba(79, 70, 229, 0);
    }

    100% {
        transform: scale(0.85);
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    }
}

/* ---- Spin ---- */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-right-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ---- Fade Up ---- */
@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Base class for manual triggering */
.animate-fade-up {
    opacity: 0;
    /* Only 0 if we explicitly intend to animate */
    animation: fade-up 0.5s ease forwards;
}

/* ---- Fade In ---- */
@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ---- Scale In ---- */
@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ---- Slide Right ---- */
@keyframes slide-right {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

/* ---- Slide Left ---- */
@keyframes slide-left {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-100%);
    }
}

/* ---- Gradient Shift ---- */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ---- Card Appear ---- */
.card-appear {
    animation: fade-up 0.4s ease forwards;
}

.card-appear:nth-child(1) {
    animation-delay: 0ms;
}

.card-appear:nth-child(2) {
    animation-delay: 60ms;
}

.card-appear:nth-child(3) {
    animation-delay: 120ms;
}

.card-appear:nth-child(4) {
    animation-delay: 180ms;
}

.card-appear:nth-child(5) {
    animation-delay: 240ms;
}

.card-appear:nth-child(6) {
    animation-delay: 300ms;
}

.card-appear:nth-child(7) {
    animation-delay: 360ms;
}

.card-appear:nth-child(8) {
    animation-delay: 420ms;
}

/* ---- Sidebar Nav Item ---- */
.sidebar-nav-link {
    position: relative;
    overflow: hidden;
}

.sidebar-nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--primary-gradient);
    transform: scaleY(0);
    transition: transform var(--transition-base);
    border-radius: 0 2px 2px 0;
}

.sidebar-nav-link.active::before {
    transform: scaleY(1);
}

/* ---- Sidebar Hover Tray ---- */
.sidebar-nav-link .nav-hover-bg {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    opacity: 0;
    background: var(--glass-active);
}

.sidebar-nav-link:hover .nav-hover-bg,
.sidebar-nav-link.active .nav-hover-bg {
    opacity: 1;
}

/* ---- Form Card Hover ---- */
.form-card {
    transition: all var(--transition-base);
}

.form-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

/* ---- Animated Background Orbs ---- */
.bg-orbs {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.08;
    animation: float 8s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #ffffff, #aaaaaa);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #cccccc, #777777);
    bottom: -100px;
    left: -50px;
    animation-delay: 3s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #eeeeee, #bbbbbb);
    top: 50%;
    left: 50%;
    animation-delay: 6s;
}

/* ---- Loading Dots ---- */
.loading-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.loading-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-light);
    animation: dot-bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ---- Number Counter ---- */
@keyframes count-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-animate {
    animation: count-up 0.5s ease forwards;
}

/* ---- Search Input Focus ---- */
.search-input:focus {
    animation: search-glow 0.3s ease forwards;
}

@keyframes search-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);
    }

    100% {
        box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
    }
}

/* ---- Notification Bell Shake ---- */
@keyframes bell-shake {

    0%,
    100% {
        transform: rotate(0deg);
    }

    10%,
    90% {
        transform: rotate(-6deg);
    }

    30%,
    70% {
        transform: rotate(8deg);
    }

    50% {
        transform: rotate(-8deg);
    }
}

.bell-animate {
    animation: bell-shake 0.6s ease;
}

/* ---- Favorite Heart ---- */
@keyframes heart-pop {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.3);
    }

    60% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

.heart-animate {
    animation: heart-pop 0.4s ease;
}

/* ---- Mobile Sidebar Overlay ---- */
@keyframes overlay-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.sidebar-overlay {
    animation: overlay-fade-in 0.2s ease;
}

/* ---- Status Badge Pulse (Active) ---- */
.status-active-indicator {
    position: relative;
}

.status-active-indicator::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--success);
    opacity: 0.4;
    animation: pulse-ring 2s ease-in-out infinite;
}

/* ---- Chart Bar Rise ---- */
@keyframes bar-rise {
    from {
        transform: scaleY(0);
    }

    to {
        transform: scaleY(1);
    }
}

.chart-bar {
    transform-origin: bottom;
    animation: bar-rise 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ---- Drag & Drop Active ---- */
.drag-over {
    border-color: var(--primary) !important;
    background: var(--primary-gradient-soft) !important;
    transform: scale(1.01);
}

.dragging {
    opacity: 0.4;
    transform: scale(0.98);
    cursor: grabbing !important;
}

/* ---- Delete Animation ---- */
@keyframes remove-card {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
        max-height: 300px;
        margin-bottom: 16px;
    }

    50% {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }

    100% {
        opacity: 0;
        transform: translateX(40px);
        max-height: 0;
        margin-bottom: 0;
        padding: 0;
    }
}

.removing {
    animation: remove-card 0.4s ease forwards;
    overflow: hidden;
    pointer-events: none;
}

/* ---- Theme Toggle ---- */
.theme-icon {
    transition: transform var(--transition-spring), opacity var(--transition-base);
}

.theme-icon.hidden-icon {
    transform: scale(0) rotate(90deg);
    opacity: 0;
    position: absolute;
}

.theme-icon.visible-icon {
    transform: scale(1) rotate(0deg);
    opacity: 1;
}