/* ========================================
   TAMIL NEWS PORTAL - ANIMATIONS
   ======================================== */

/* ========== KEYFRAME ANIMATIONS ========== */

/* Fade Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

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

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

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

@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.5);
    }
}

/* Slide Animations */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

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

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Bounce Animations */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

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

@keyframes bounceOut {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(0.95);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        opacity: 0;
        transform: scale(0.3);
    }
}

/* Pulse Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(230, 57, 70, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(230, 57, 70, 0);
    }
}

@keyframes pulseBorder {
    0% {
        border-color: var(--primary-color);
    }
    50% {
        border-color: var(--accent-color);
    }
    100% {
        border-color: var(--primary-color);
    }
}

/* Shake Animations */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

/* Rotate Animations */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg);
    }
    to {
        opacity: 1;
        transform: rotate(0deg);
    }
}

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

@keyframes floatShadow {
    0%, 100% {
        transform: translateY(0);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    }
    50% {
        transform: translateY(-10px);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    }
}

/* Glow Animations */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--primary-color);
    }
    50% {
        box-shadow: 0 0 20px var(--primary-color), 0 0 30px var(--primary-light);
    }
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 5px var(--primary-color);
    }
    50% {
        text-shadow: 0 0 20px var(--primary-color), 0 0 30px var(--primary-light);
    }
}

/* Wave Animation */
@keyframes wave {
    0% {
        transform: translateX(0) translateZ(0) scaleY(1);
    }
    50% {
        transform: translateX(-25%) translateZ(0) scaleY(0.5);
    }
    100% {
        transform: translateX(-50%) translateZ(0) scaleY(1);
    }
}

/* Ripple Animation */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

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

/* Breaking News Flash */
@keyframes breakingFlash {
    0%, 100% {
        background-color: var(--primary-color);
    }
    50% {
        background-color: var(--accent-color);
    }
}

/* Typewriter Effect */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blinkCaret {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--primary-color);
    }
}

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

/* Heartbeat */
@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.1);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.1);
    }
    70% {
        transform: scale(1);
    }
}

/* Flip Animations */
@keyframes flipInX {
    from {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateX(0deg);
        opacity: 1;
    }
}

@keyframes flipInY {
    from {
        transform: perspective(400px) rotateY(90deg);
        opacity: 0;
    }
    to {
        transform: perspective(400px) rotateY(0deg);
        opacity: 1;
    }
}

/* ========== ANIMATION UTILITY CLASSES ========== */

/* Fade */
.animate-fadeIn {
    animation: fadeIn 0.5s ease forwards;
}

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

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

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

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

/* Scale */
.animate-scaleIn {
    animation: scaleIn 0.3s ease forwards;
}

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

/* Bounce */
.animate-bounce {
    animation: bounce 1s ease infinite;
}

.animate-bounceIn {
    animation: bounceIn 0.6s ease forwards;
}

/* Pulse */
.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

/* Shake */
.animate-shake {
    animation: shake 0.5s ease;
}

.animate-wiggle {
    animation: wiggle 1s ease infinite;
}

/* Rotate */
.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-spinSlow {
    animation: spin 3s linear infinite;
}

/* Float */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

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

/* Glow */
.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

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

/* Flip */
.animate-flipInX {
    animation: flipInX 0.5s ease forwards;
}

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

/* Heartbeat */
.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

/* ========== ANIMATION DELAYS ========== */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* ========== ANIMATION DURATIONS ========== */
.duration-fast { animation-duration: 0.2s; }
.duration-normal { animation-duration: 0.5s; }
.duration-slow { animation-duration: 1s; }
.duration-slower { animation-duration: 2s; }
.duration-slowest { animation-duration: 3s; }

/* ========== HOVER EFFECTS ========== */

/* Hover Lift */
.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

/* Hover Scale */
.hover-scale {
    transition: transform var(--transition-fast);
}

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

.hover-scale-sm:hover {
    transform: scale(1.02);
}

.hover-scale-lg:hover {
    transform: scale(1.1);
}

/* Hover Rotate */
.hover-rotate {
    transition: transform var(--transition-normal);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-rotate-reverse:hover {
    transform: rotate(-5deg);
}

/* Hover Glow */
.hover-glow {
    transition: box-shadow var(--transition-normal);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(230, 57, 70, 0.5);
}

/* Hover Shine */
.hover-shine {
    position: relative;
    overflow: hidden;
}

.hover-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

.hover-shine:hover::before {
    left: 100%;
}

/* Hover Border */
.hover-border {
    position: relative;
}

.hover-border::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: all var(--transition-normal);
    transform: translateX(-50%);
}

.hover-border:hover::after {
    width: 100%;
}

/* Hover Fill */
.hover-fill {
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.hover-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: var(--primary-color);
    transition: width var(--transition-normal);
    z-index: -1;
}

.hover-fill:hover::before {
    width: 100%;
}

.hover-fill:hover {
    color: #ffffff;
}

/* ========== SCROLL ANIMATIONS ========== */

/* Elements hidden before animation */
.scroll-animate {
    opacity: 0;
    transition: all 0.6s ease;
}

.scroll-animate.animate-up {
    transform: translateY(50px);
}

.scroll-animate.animate-down {
    transform: translateY(-50px);
}

.scroll-animate.animate-left {
    transform: translateX(-50px);
}

.scroll-animate.animate-right {
    transform: translateX(50px);
}

.scroll-animate.animate-scale {
    transform: scale(0.8);
}

/* When element is in view */
.scroll-animate.in-view {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* ========== SKELETON LOADING ========== */

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

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

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-text.full {
    width: 100%;
}

.skeleton-avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
}

.skeleton-image {
    width: 100%;
    height: 200px;
}

.skeleton-card {
    padding: var(--spacing-lg);
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
}

/* ========== RIPPLE EFFECT ========== */

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::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%;
}

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

/* ========== TRANSITION UTILITIES ========== */

.transition-none {
    transition: none !important;
}

.transition-all {
    transition: all var(--transition-normal);
}

.transition-fast {
    transition: all var(--transition-fast);
}

.transition-slow {
    transition: all var(--transition-slow);
}

.transition-colors {
    transition: color var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal);
}

.transition-opacity {
    transition: opacity var(--transition-normal);
}

.transition-transform {
    transition: transform var(--transition-normal);
}

.transition-shadow {
    transition: box-shadow var(--transition-normal);
}

/* ========== PREFERS 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;
    }
    
    .ticker-content {
        animation: none;
    }
    
    .scroll-animate {
        opacity: 1;
        transform: none;
    }
}

/* ========== SPECIAL EFFECTS ========== */

/* Gradient Border */
.gradient-border {
    position: relative;
    background: var(--bg-primary);
    z-index: 1;
}

.gradient-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--gradient-primary);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.gradient-border:hover::before {
    opacity: 1;
}

/* Glowing Text */
.text-glow {
    text-shadow: 
        0 0 10px var(--primary-color),
        0 0 20px var(--primary-color),
        0 0 30px var(--primary-color);
}

/* Neon Effect */
.neon-effect {
    box-shadow:
        0 0 5px var(--primary-color),
        0 0 10px var(--primary-color),
        0 0 20px var(--primary-color),
        0 0 40px var(--primary-color);
}

/* Glass Effect */
.glass-effect {
    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);
}

[data-theme="dark"] .glass-effect {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Blur Background */
.blur-bg {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Image Overlay Effects */
.img-overlay {
    position: relative;
    overflow: hidden;
}

.img-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-overlay);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.img-overlay:hover::after {
    opacity: 1;
}

/* Parallax Effect Placeholder */
.parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Count Up Animation Support */
.count-up {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.count-up.counted {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger Animation for Lists */
.stagger-animate > * {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.stagger-animate.in-view > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-animate.in-view > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-animate.in-view > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-animate.in-view > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-animate.in-view > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-animate.in-view > *:nth-child(6) { transition-delay: 0.6s; }

.stagger-animate.in-view > * {
    opacity: 1;
    transform: translateY(0);
}