/* ================================
   TechWithTKS - Animations
   Smooth scroll-based animations (Flat Design Enhanced)
   ================================ */

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide Up Animation */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In From Left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide In From Right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale In Animation */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Subtle Pulse Animation */
@keyframes subtlePulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Soft Glow Animation */
@keyframes softGlow {
    0%, 100% {
        border-color: #e5e7eb;
    }
    50% {
        border-color: #7B77EB;
    }
}

/* Shimmer Effect for Loading */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ===== ANIMATE ON SCROLL ===== */

/* Base State */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Visible State */
.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Different Entrance Directions */
.animate-from-left {
    transform: translateX(-20px);
}

.animate-from-right {
    transform: translateX(20px);
}

.animate-from-left.visible,
.animate-from-right.visible {
    transform: translateX(0);
}

/* ===== STAGGER ANIMATIONS ===== */

/* Stagger children with increasing delays */
.stagger-children > * {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.stagger-children.visible > * {
    opacity: 1;
    transform: translateY(0);
}

.stagger-children.visible > *:nth-child(1) { transition-delay: 0.05s; }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.15s; }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.2s; }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.25s; }
.stagger-children.visible > *:nth-child(6) { transition-delay: 0.3s; }

/* ===== HOVER ANIMATIONS ===== */

/* Card Hover - Border Only */
.card-hover-border {
    transition: border-color 0.2s ease, background 0.2s ease;
}

.card-hover-border:hover {
    border-color: #7B77EB;
    background: #fafbff;
}

/* Button Hover - Background Shift */
.btn-hover-shift {
    transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-hover-shift:hover {
    background: #5B5FEF;
    border-color: #5B5FEF;
}

/* Icon Hover - Subtle Scale */
.icon-hover-scale svg {
    transition: transform 0.2s ease;
}

.icon-hover-scale:hover svg {
    transform: scale(1.05);
}

/* Tag Hover - Color Shift */
.tag-hover {
    transition: background 0.2s ease, color 0.2s ease;
}

.tag-hover:hover {
    background: #7B77EB;
    color: #ffffff;
}

/* ===== LOADING ANIMATIONS ===== */

/* Loading Spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #7B77EB;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #f8f8f8 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ===== PAGE TRANSITIONS ===== */

/* Page Load Animation */
.page-enter {
    animation: fadeIn 0.4s ease;
}

/* Section Transitions */
.section-enter {
    animation: slideUp 0.5s ease;
}

/* ===== MICRO-INTERACTIONS ===== */

/* Link Underline Animation */
.link-underline {
    position: relative;
}

.link-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.2s ease;
}

.link-underline:hover::after {
    width: 100%;
}

/* Checkmark Animation */
@keyframes checkmark {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.checkmark-animate {
    animation: checkmark 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pulse on Focus */
.pulse-on-focus:focus {
    animation: subtlePulse 0.3s ease;
}

/* ===== MENU ANIMATIONS ===== */

/* Mobile Menu Slide */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-menu-enter {
    animation: slideDown 0.3s ease;
}

/* Hamburger Menu Animation */
.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    margin: 4px 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ===== ACCESSIBILITY ===== */

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
}

/* ===== SCROLLBAR STYLING ===== */

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}