/* Visual Enhancements & Animations */

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Scroll Fade-in Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Apply animations to elements */
.animate-on-scroll {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Staggered animation delays */
.news-card:nth-child(1),
.blog-card:nth-child(1),
.feature-card:nth-child(1) {
    animation: fadeInUp 0.6s ease-out 0.1s forwards;
    opacity: 0;
}

.news-card:nth-child(2),
.blog-card:nth-child(2),
.feature-card:nth-child(2) {
    animation: fadeInUp 0.6s ease-out 0.2s forwards;
    opacity: 0;
}

.news-card:nth-child(3),
.blog-card:nth-child(3),
.feature-card:nth-child(3) {
    animation: fadeInUp 0.6s ease-out 0.3s forwards;
    opacity: 0;
}

.news-card:nth-child(n+4),
.blog-card:nth-child(n+4),
.feature-card:nth-child(n+4) {
    animation: fadeInUp 0.6s ease-out 0.4s forwards;
    opacity: 0;
}

/* Glassmorphism Effects */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .glass {
    background: rgba(17, 24, 39, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Glassmorphism on theme toggle */
.theme-toggle {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(34, 197, 94, 0.9) !important;
}

/* Enhanced Card Hover Effects */
.news-card,
.blog-card,
.feature-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.news-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(34, 197, 94, 0.25), 
                0 0 0 1px rgba(34, 197, 94, 0.1);
}

.blog-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(34, 197, 94, 0.25),
                0 0 0 1px rgba(34, 197, 94, 0.1);
}

.feature-card:hover {
    transform: translateY(-5px);
    background: var(--bg-light);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-700) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-section h1 {
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.9) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Animated Gradient Backgrounds */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-section,
.newsletter-section {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end), var(--primary-600));
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
}

/* Loading Skeleton Screens */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-light) 0%,
        var(--border-color) 50%,
        var(--bg-light) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: 0.5rem;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 2rem;
    margin-bottom: 1rem;
}

.skeleton-image {
    height: 200px;
    margin-bottom: 1rem;
}

/* Button Ripple Effect */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* Hover Glow Effect */
.hover-glow {
    transition: all 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.4),
                0 0 40px rgba(34, 197, 94, 0.2);
}

/* Pulse Animation for New Badge */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

/* Icon Animations */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.icon-bounce:hover {
    animation: bounce 0.6s ease;
}

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

.icon-rotate:hover {
    animation: rotate 0.6s ease;
}

/* Card Lift Shadow Effect */
.card-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-lift:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px -12px rgba(34, 197, 94, 0.25);
}

/* Text Shimmer Effect */
@keyframes textShimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.text-shimmer {
    background: linear-gradient(
        90deg,
        var(--text-dark) 0%,
        var(--primary-color) 50%,
        var(--text-dark) 100%
    );
    background-size: 1000px 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShimmer 3s linear infinite;
}

/* Progress Bar Animation */
@keyframes progressBar {
    from { width: 0%; }
    to { width: var(--progress); }
}

.progress-bar {
    animation: progressBar 1s ease-out forwards;
}

/* Fade In from Bottom on Scroll */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Smooth Image Loading */
img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.loaded {
    opacity: 1;
}

/* Gradient Border Effect */
.gradient-border {
    position: relative;
    border: 2px solid transparent;
    background: var(--bg-white);
    background-clip: padding-box;
}

.gradient-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: inherit;
    z-index: -1;
}

/* Floating Animation */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.float {
    animation: float 3s ease-in-out infinite;
}

/* Underline Expand Effect */
.underline-expand {
    position: relative;
    text-decoration: none;
}

.underline-expand::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.underline-expand:hover::after {
    width: 100%;
}

/* Scale on Hover */
.scale-hover {
    transition: transform 0.3s ease;
}

.scale-hover:hover {
    transform: scale(1.05);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
