/* ============================================
   AlphaResource - Premium Animations Library
   Modern, Smooth Micro-interactions
   ============================================ */

/* ==========================================
   1. PAGE LOAD ANIMATIONS
   ========================================== */

/* Fade in from bottom - for main content */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

/* Fade in from left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

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

/* Fade in from right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

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

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

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

/* Blur in */
@keyframes blurIn {
    from {
        opacity: 0;
        filter: blur(10px);
    }

    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* ==========================================
   2. APPLY ANIMATIONS TO ELEMENTS
   ========================================== */

/* Cards animate on load */
.card {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Stagger cards in grid */
.card:nth-child(1) {
    animation-delay: 0s;
}

.card:nth-child(2) {
    animation-delay: 0.1s;
}

.card:nth-child(3) {
    animation-delay: 0.2s;
}

.card:nth-child(4) {
    animation-delay: 0.3s;
}

.card:nth-child(5) {
    animation-delay: 0.4s;
}

.card:nth-child(6) {
    animation-delay: 0.5s;
}

/* Stat cards */
.stat-card {
    animation: scaleIn 0.5s ease-out forwards;
}

.stat-card:nth-child(1) {
    animation-delay: 0s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.3s;
}

/* Tables animate in */
.table-responsive {
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: 0.3s;
}

/* ==========================================
   3. BUTTON HOVER EFFECTS
   ========================================== */

/* Ripple effect on buttons */
.btn {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.btn:active::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0) translate(-50%, -50%);
        opacity: 1;
    }

    100% {
        transform: scale(40) translate(-50%, -50%);
        opacity: 0;
    }
}

/* Primary button glow pulse */
.btn-primary {
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    }

    50% {
        box-shadow: 0 0 35px rgba(99, 102, 241, 0.5);
    }
}

/* Button hover lift */
.btn:hover {
    transform: translateY(-3px);
}

.btn:active {
    transform: translateY(-1px);
}

/* ==========================================
   4. CARD HOVER EFFECTS
   ========================================== */

/* Card lift and glow on hover */
.card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 0 30px rgba(99, 102, 241, 0.1);
}

/* Product card special effect */
.product-card,
.bundle-card,
.network-card {
    transition: all 0.3s ease;
}

.product-card:hover,
.bundle-card:hover,
.network-card:hover {
    transform: translateY(-10px) rotateX(2deg);
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(99, 102, 241, 0.3);
}

/* ==========================================
   5. FORM INPUT ANIMATIONS
   ========================================== */

/* Input focus animation */
.form-control {
    transition: all 0.3s ease;
}

.form-control:focus {
    transform: scale(1.01);
    box-shadow:
        0 0 0 3px rgba(99, 102, 241, 0.15),
        0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Label float effect */
.form-group {
    position: relative;
}

.form-label {
    transition: all 0.3s ease;
}

.form-group:focus-within .form-label {
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* Input border animation */
.form-control::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: all 0.3s ease;
}

.form-control:focus::before {
    left: 0;
    width: 100%;
}

/* ==========================================
   6. TABLE ANIMATIONS
   ========================================== */

/* Table row hover */
tbody tr {
    transition: all 0.3s ease;
}

tbody tr:hover {
    background: var(--bg-hover);
    transform: scale(1.01);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
}

/* Cell highlight on hover */
td,
th {
    transition: all 0.2s ease;
}

tbody tr:hover td {
    color: var(--text-primary);
}

/* ==========================================
   7. LOADING ANIMATIONS
   ========================================== */

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg,
            var(--bg-secondary) 25%,
            var(--bg-tertiary) 50%,
            var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

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

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

/* Dots loading */
.loading-dots {
    display: inline-flex;
    gap: 5px;
}

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

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

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

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

@keyframes bounce {

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

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

/* ==========================================
   8. NOTIFICATION/ALERT ANIMATIONS
   ========================================== */

/* Alert slide in from top */
.alert {
    animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

/* Success checkmark animation - disabled to prevent conflicts */
/* Add checkmarks manually in HTML if needed */

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0);
    }

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

/* ==========================================
   9. SIDEBAR ANIMATIONS
   ========================================== */

/* Sidebar slide in */
.admin-sidebar,
.sidebar {
    animation: slideInLeft 0.4s ease-out forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

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

/* Sidebar menu items stagger */
.sidebar-menu li,
.menu-item {
    animation: fadeInLeft 0.4s ease-out forwards;
}

.sidebar-menu li:nth-child(1) {
    animation-delay: 0.1s;
}

.sidebar-menu li:nth-child(2) {
    animation-delay: 0.15s;
}

.sidebar-menu li:nth-child(3) {
    animation-delay: 0.2s;
}

.sidebar-menu li:nth-child(4) {
    animation-delay: 0.25s;
}

.sidebar-menu li:nth-child(5) {
    animation-delay: 0.3s;
}

.sidebar-menu li:nth-child(6) {
    animation-delay: 0.35s;
}

.sidebar-menu li:nth-child(7) {
    animation-delay: 0.4s;
}

.sidebar-menu li:nth-child(8) {
    animation-delay: 0.45s;
}

.sidebar-menu li:nth-child(9) {
    animation-delay: 0.5s;
}

.sidebar-menu li:nth-child(10) {
    animation-delay: 0.55s;
}

/* Menu item hover */
.sidebar-menu a,
.menu-item a {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sidebar-menu a:hover,
.menu-item a:hover {
    transform: translateX(8px);
    background: var(--bg-hover);
}

/* Active menu indicator */
.sidebar-menu a.active,
.menu-item a.active {
    position: relative;
}

.sidebar-menu a.active::before,
.menu-item a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--primary-gradient);
    border-radius: 0 4px 4px 0;
    animation: indicatorPulse 2s ease-in-out infinite;
}

@keyframes indicatorPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ==========================================
   10. BADGE/STATUS ANIMATIONS
   ========================================== */

/* Pulse for pending status */
.badge-warning,
.status-pending {
    animation: warningPulse 2s ease-in-out infinite;
}

@keyframes warningPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
    }
}

/* Success badge glow */
.badge-success {
    animation: successGlow 2s ease-in-out infinite;
}

@keyframes successGlow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    50% {
        box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
    }
}

/* ==========================================
   11. WALLET/BALANCE ANIMATIONS
   ========================================== */

/* Wallet balance counter */
.wallet-balance,
.balance-amount {
    font-variant-numeric: tabular-nums;
    transition: all 0.5s ease;
}

.wallet-badge {
    animation: walletPulse 3s ease-in-out infinite;
}

@keyframes walletPulse {

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

    50% {
        transform: scale(1.05);
    }
}

/* Money value highlight on change */
.amount-updated {
    animation: highlightValue 1s ease-out;
}

@keyframes highlightValue {
    0% {
        background: rgba(99, 102, 241, 0.3);
        transform: scale(1.1);
    }

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

/* ==========================================
   12. MODAL ANIMATIONS
   ========================================== */

/* Modal backdrop */
.modal-backdrop {
    animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal content slide up */
.modal-content {
    animation: modalSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }

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

/* Modal close */
.modal-closing .modal-content {
    animation: modalSlideDown 0.3s ease-in forwards;
}

@keyframes modalSlideDown {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
}

/* ==========================================
   13. FLOATING ELEMENTS
   ========================================== */

/* Floating action button */
.floating-btn,
.theme-toggle-btn {
    animation: float 4s ease-in-out infinite;
}

@keyframes float {

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

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

/* Floating elements hover */
.floating-btn:hover,
.theme-toggle-btn:hover {
    animation: none;
    transform: scale(1.1) rotate(10deg);
}

/* ==========================================
   14. PAGE TRANSITION
   ========================================== */

/* Page content fade in */
.page-content,
.main-content,
.dashboard-content {
    animation: pageIn 0.5s ease-out forwards;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* ==========================================
   15. HOVER EFFECTS - TEXT & LINKS
   ========================================== */

/* Link underline animation */
.nav-link,
.sidebar a {
    position: relative;
}

.nav-link::after,
.sidebar a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.sidebar a:hover::after {
    width: 100%;
}

/* ==========================================
   16. NETWORK CARD ICONS
   ========================================== */

/* Network icon bounce on hover */
.network-icon,
.network-logo {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.network-card:hover .network-icon,
.network-card:hover .network-logo {
    transform: scale(1.2) rotate(5deg);
}

/* ==========================================
   17. STAT VALUE COUNTER
   ========================================== */

/* Stat value shine effect */
.stat-value {
    position: relative;
    overflow: hidden;
}

.stat-value::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% {
        left: -100%;
    }

    50%,
    100% {
        left: 100%;
    }
}

/* ==========================================
   18. ICON ANIMATIONS
   ========================================== */

/* Icon rotate on hover */
.icon-spin:hover {
    animation: iconSpin 0.6s ease;
}

@keyframes iconSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Icon bounce */
.icon-bounce {
    animation: iconBounce 2s ease-in-out infinite;
}

@keyframes iconBounce {

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

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

/* ==========================================
   19. SUCCESS/ERROR STATE ANIMATIONS
   ========================================== */

/* Success shake (celebration) */
.success-animation {
    animation: successShake 0.5s ease-in-out;
}

@keyframes successShake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Error shake */
.error-animation {
    animation: errorShake 0.4s ease-in-out;
}

@keyframes errorShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    50% {
        transform: translateX(10px);
    }

    75% {
        transform: translateX(-10px);
    }
}

/* ==========================================
   20. SCROLL-TRIGGERED ANIMATIONS
   ========================================== */

/* Elements that animate when scrolled into view */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered scroll animations */
.animate-on-scroll:nth-child(1) {
    transition-delay: 0s;
}

.animate-on-scroll:nth-child(2) {
    transition-delay: 0.1s;
}

.animate-on-scroll:nth-child(3) {
    transition-delay: 0.2s;
}

.animate-on-scroll:nth-child(4) {
    transition-delay: 0.3s;
}

/* ==========================================
   21. REDUCED MOTION PREFERENCE
   ========================================== */

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================
   22. TOOLTIP ANIMATIONS
   ========================================== */

.tooltip {
    animation: tooltipIn 0.2s ease-out forwards;
}

@keyframes tooltipIn {
    from {
        opacity: 0;
        transform: translateY(5px) scale(0.95);
    }

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

/* ==========================================
   23. CONFETTI EFFECT (for success moments)
   ========================================== */

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 9999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ==========================================
   24. TYPING ANIMATION
   ========================================== */

.typing-text {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    animation:
        typing 3s steps(40) 1s 1 normal both,
        blink 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

/* ==========================================
   25. GRADIENT ANIMATION
   ========================================== */

.gradient-animated {
    background: linear-gradient(45deg,
            #667eea,
            #764ba2,
            #ec4899,
            #667eea);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

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

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

/* ==========================================
   26. ANIMATED LOGO - SIDEBAR BRANDING
   ========================================== */

/* Logo image in sidebar */
.logo-icon-img {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    object-fit: contain;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Animated logo - breathing pulse effect */
.animated-logo {
    animation: logoPulse 3s ease-in-out infinite, logoGlow 4s ease-in-out infinite alternate;
}

@keyframes logoPulse {

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

    50% {
        transform: scale(1.08);
    }
}

@keyframes logoGlow {
    0% {
        box-shadow:
            0 4px 15px rgba(99, 102, 241, 0.3),
            0 0 20px rgba(99, 102, 241, 0.2);
        filter: brightness(1);
    }

    100% {
        box-shadow:
            0 4px 20px rgba(99, 102, 241, 0.5),
            0 0 30px rgba(99, 102, 241, 0.4),
            0 0 40px rgba(118, 75, 162, 0.2);
        filter: brightness(1.1);
    }
}

/* Hover effect - interactive bounce */
.sidebar-logo:hover .animated-logo {
    animation: logoHoverBounce 0.6s ease-out, logoHoverGlow 0.6s ease-out forwards;
    cursor: pointer;
}

@keyframes logoHoverBounce {
    0% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.2) rotate(-5deg);
    }

    50% {
        transform: scale(1.15) rotate(5deg);
    }

    75% {
        transform: scale(1.18) rotate(-2deg);
    }

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

@keyframes logoHoverGlow {
    0% {
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    }

    100% {
        box-shadow:
            0 8px 30px rgba(99, 102, 241, 0.6),
            0 0 50px rgba(99, 102, 241, 0.4),
            0 0 70px rgba(118, 75, 162, 0.3);
    }
}

/* Mobile wallet bar logo animation */
.mobile-wallet-logo {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    object-fit: contain;
    animation: mobileLogoFloat 4s ease-in-out infinite;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

@keyframes mobileLogoFloat {

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

    25% {
        transform: translateY(-2px) scale(1.02);
    }

    50% {
        transform: translateY(-4px) scale(1.05);
    }

    75% {
        transform: translateY(-2px) scale(1.02);
    }
}

/* Mobile specific animations - more subtle for performance */
@media (max-width: 768px) {
    .animated-logo {
        animation: logoMobilePulse 4s ease-in-out infinite;
        width: 60px;
        height: 60px;
    }

    @keyframes logoMobilePulse {

        0%,
        100% {
            transform: scale(1);
            box-shadow: 0 3px 12px rgba(99, 102, 241, 0.25);
        }

        50% {
            transform: scale(1.05);
            box-shadow: 0 5px 18px rgba(99, 102, 241, 0.4);
        }
    }

    .mobile-wallet-logo {
        animation: mobileLogoShine 3s ease-in-out infinite;
    }

    @keyframes mobileLogoShine {

        0%,
        100% {
            filter: brightness(1);
        }

        50% {
            filter: brightness(1.15);
        }
    }
}

/* Dark mode enhancements for logo */
[data-theme="dark"] .animated-logo,
.dark-mode .animated-logo {
    box-shadow:
        0 4px 15px rgba(99, 102, 241, 0.4),
        0 0 25px rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .logo-icon-img:hover,
.dark-mode .logo-icon-img:hover {
    box-shadow:
        0 8px 35px rgba(99, 102, 241, 0.7),
        0 0 60px rgba(99, 102, 241, 0.5),
        0 0 80px rgba(118, 75, 162, 0.4);
}

/* Loading state animation for logo (when first loading) */
.animated-logo.loading {
    animation: logoLoading 1.5s ease-in-out infinite;
}

@keyframes logoLoading {
    0% {
        opacity: 0.5;
        transform: scale(0.95);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }

    100% {
        opacity: 0.5;
        transform: scale(0.95);
    }
}

/* Success state - after successful action */
.animated-logo.success {
    animation: logoSuccess 0.8s ease-out;
}

@keyframes logoSuccess {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    }

    30% {
        transform: scale(1.3);
        box-shadow: 0 8px 40px rgba(16, 185, 129, 0.6);
    }

    60% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    }
}