/* DexxNet — Premium Animations & Micro-interactions */

/* ═══════════════════════════════════════════════════════
   PAGE LOAD TRANSITIONS
   ═══════════════════════════════════════════════════════ */
@keyframes pageReveal {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

body { animation: pageReveal 0.5s cubic-bezier(0.4, 0, 0.2, 1) both; }

/* Sidebar slide in */
@keyframes sidebarSlideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}
.sidebar { animation: sidebarSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both; }

/* Main content fade in */
@keyframes contentFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.main-content { animation: contentFadeIn 0.3s ease 0.2s both; }

/* ═══════════════════════════════════════════════════════
   STAGGERED CARD ENTRANCE
   ═══════════════════════════════════════════════════════ */
@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.content > .card,
.content > .stat-card,
.content > .feature-card,
.content > .dash-panel,
.content > .dash-stat,
.content > .grid > * {
    animation: cardEntrance 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.content > *:nth-child(1) { animation-delay: 0.05s; }
.content > *:nth-child(2) { animation-delay: 0.1s; }
.content > *:nth-child(3) { animation-delay: 0.15s; }
.content > *:nth-child(4) { animation-delay: 0.2s; }
.content > *:nth-child(5) { animation-delay: 0.25s; }
.content > *:nth-child(6) { animation-delay: 0.3s; }
.content > *:nth-child(7) { animation-delay: 0.35s; }
.content > *:nth-child(8) { animation-delay: 0.4s; }

.grid > *:nth-child(1) { animation-delay: 0.08s; }
.grid > *:nth-child(2) { animation-delay: 0.13s; }
.grid > *:nth-child(3) { animation-delay: 0.18s; }
.grid > *:nth-child(4) { animation-delay: 0.23s; }

/* ═══════════════════════════════════════════════════════
   SCROLL REVEAL (Enhanced)
   ═══════════════════════════════════════════════════════ */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}
.reveal.delay-1 { transition-delay: 0.1s; }
.reveal.delay-2 { transition-delay: 0.2s; }
.reveal.delay-3 { transition-delay: 0.3s; }

/* Scale reveal variant */
.reveal-scale {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* ═══════════════════════════════════════════════════════
   RIPPLE EFFECT ON BUTTONS
   ═══════════════════════════════════════════════════════ */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.ripple-wave {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, transparent 70%);
    transform: scale(0);
    animation: rippleExpand 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
}

@keyframes rippleExpand {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ═══════════════════════════════════════════════════════
   CARD 3D TILT ON HOVER
   ═══════════════════════════════════════════════════════ */
.tilt-card {
    transition: transform 0.15s ease, box-shadow 0.3s ease;
    transform-style: preserve-3d;
    will-change: transform;
}

.tilt-card:hover {
    box-shadow:
        0 8px 32px rgba(0,0,0,0.3),
        0 0 0 1px rgba(139,92,246,0.08),
        0 20px 60px -10px rgba(139,92,246,0.08);
}

/* ═══════════════════════════════════════════════════════
   SKELETON LOADING
   ═══════════════════════════════════════════════════════ */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.03) 0%,
        rgba(255,255,255,0.06) 40%,
        rgba(255,255,255,0.03) 80%
    );
    background-size: 300% 100%;
    animation: skeletonShimmer 1.8s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.skeleton-line {
    height: 14px;
    margin-bottom: 10px;
    border-radius: 6px;
}
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 65%; }
.skeleton-line.long { width: 85%; }

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-card {
    padding: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

/* ═══════════════════════════════════════════════════════
   SIDEBAR HOVER GLOW TRAIL
   ═══════════════════════════════════════════════════════ */
.sidebar-link {
    position: relative;
    overflow: hidden;
}

.sidebar-link::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 180px;
    height: 180px;
    margin-left: -90px;
    margin-top: -90px;
    background: radial-gradient(circle, rgba(139,92,246,0.08) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 0;
}

.sidebar-link:hover::after {
    opacity: 1;
    transform: scale(1);
}

.sidebar-link.active::after {
    opacity: 1;
    transform: scale(1);
    background: radial-gradient(circle, rgba(139,92,246,0.12) 0%, transparent 70%);
}

/* ═══════════════════════════════════════════════════════
   MAGNETIC BUTTON EFFECT
   ═══════════════════════════════════════════════════════ */
.magnetic {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ═══════════════════════════════════════════════════════
   TEXT SCRAMBLE EFFECT
   ═══════════════════════════════════════════════════════ */
.scramble-text {
    display: inline-block;
}

.scramble-text:hover {
    animation: textGlitch 0.3s ease;
}

@keyframes textGlitch {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-1px, 1px); }
    40% { transform: translate(1px, -1px); }
    60% { transform: translate(-1px, -1px); }
    80% { transform: translate(1px, 1px); }
}

/* ═══════════════════════════════════════════════════════
   GRADIENT BORDER ANIMATION
   ═══════════════════════════════════════════════════════ */
.gradient-border {
    position: relative;
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: conic-gradient(
        from var(--gradient-angle, 0deg),
        transparent 0%,
        var(--accent) 10%,
        transparent 20%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: xor;
    -webkit-mask-composite: xor;
    padding: 1px;
}

.gradient-border:hover::before {
    opacity: 1;
    animation: gradientRotate 3s linear infinite;
}

@keyframes gradientRotate {
    to { --gradient-angle: 360deg; }
}

@property --gradient-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* ═══════════════════════════════════════════════════════
   TOAST NOTIFICATIONS (Enhanced)
   ═══════════════════════════════════════════════════════ */
.toast {
    animation: toastSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.hiding {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(40px) scale(0.9);
    }
}

/* Toast progress bar */
.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    animation: toastProgress 4s linear forwards;
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ═══════════════════════════════════════════════════════
   MODAL ENTRANCE (Enhanced Spring)
   ═══════════════════════════════════════════════════════ */
.modal-backdrop {
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.25s ease;
}

.modal-backdrop.open .modal {
    animation: modalBounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes modalBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(24px);
    }
    60% {
        transform: scale(1.02) translateY(-4px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ═══════════════════════════════════════════════════════
   TAB SWITCHING
   ═══════════════════════════════════════════════════════ */
.tab-content {
    animation: tabFadeIn 0.3s ease both;
}

@keyframes tabFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tab indicator slide */
.tabs {
    position: relative;
}

.tab-indicator {
    position: absolute;
    bottom: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════════════════
   STAT COUNTER ANIMATION
   ═══════════════════════════════════════════════════════ */
.stat-value[data-count] {
    transition: color 0.3s ease;
}

.stat-value[data-count].counting {
    color: var(--accent);
}

/* ═══════════════════════════════════════════════════════
   FLOATING LABEL INPUT
   ═══════════════════════════════════════════════════════ */
.form-group {
    position: relative;
}

.form-group.floating .form-label {
    position: absolute;
    left: 14px;
    top: 12px;
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.2s ease;
    pointer-events: none;
    transform-origin: left center;
}

.form-group.floating .form-input:focus + .form-label,
.form-group.floating .form-input:not(:placeholder-shown) + .form-label {
    transform: translateY(-24px) scale(0.85);
    color: var(--accent);
}

/* ═══════════════════════════════════════════════════════
   PULSE ANIMATION (for notifications)
   ═══════════════════════════════════════════════════════ */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

.pulse { animation: pulse 2s ease-in-out infinite; }

/* ═══════════════════════════════════════════════════════
   BOUNCE IN
   ═══════════════════════════════════════════════════════ */
@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.bounce-in { animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ═══════════════════════════════════════════════════════
   SHAKE ANIMATION (for errors)
   ═══════════════════════════════════════════════════════ */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake { animation: shake 0.5s ease; }

/* ═══════════════════════════════════════════════════════
   SPIN ANIMATION (for loading)
   ═══════════════════════════════════════════════════════ */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin { animation: spin 1s linear infinite; }

/* ═══════════════════════════════════════════════════════
   CONFETTI PARTICLE (for success)
   ═══════════════════════════════════════════════════════ */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    animation: confettiFall 3s ease-in-out forwards;
}

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

/* ═══════════════════════════════════════════════════════
   PROGRESS BAR ANIMATION
   ═══════════════════════════════════════════════════════ */
.progress-bar {
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.2) 50%,
        transparent 100%
    );
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* ═══════════════════════════════════════════════════════
   NOTIFICATION BADGE BOUNCE
   ═══════════════════════════════════════════════════════ */
@keyframes badgeBounce {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(1.2); }
    60% { transform: scale(0.9); }
}

.badge-animate {
    animation: badgeBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ═══════════════════════════════════════════════════════
   GLOW PULSE (for online status)
   ═══════════════════════════════════════════════════════ */
@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 4px var(--success), 0 0 8px var(--success);
    }
    50% {
        box-shadow: 0 0 8px var(--success), 0 0 16px var(--success);
    }
}

.online-dot {
    animation: glowPulse 2s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════
   SMOOTH TRANSITIONS FOR ALL INTERACTIVE ELEMENTS
   ═══════════════════════════════════════════════════════ */
a, button, input, select, textarea {
    transition: all 0.2s ease;
}

/* Enhanced focus states */
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    transform: translateY(-1px);
}

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

.btn:active {
    transform: translateY(0) scale(0.98) !important;
}

/* ═══════════════════════════════════════════════════════
   PARALLAX SUBTLE SCROLL
   ═══════════════════════════════════════════════════════ */
.parallax-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    will-change: transform;
}

/* ═══════════════════════════════════════════════════════
   HOVER LIFT EFFECT
   ═══════════════════════════════════════════════════════ */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

/* ═══════════════════════════════════════════════════════
   STAGGER CHILDREN ANIMATION
   ═══════════════════════════════════════════════════════ */
.stagger-children > * {
    opacity: 0;
    transform: translateY(12px);
    animation: staggerFadeIn 0.4s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }

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

/* ═══════════════════════════════════════════════════════
   REDUCED MOTION PREFERENCES
   ═══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    body { animation: none; }
    .sidebar { animation: none; }
    .main-content { animation: none; }
    
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
