/**
 * Animated Link Widget Styles
 * 5 different underline hover animations
 */

/* Base Link Styles */
.animated-link-container {
    display: inline-block;
}

.animated-link {
    position: relative;
    display: inline-block;
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
    cursor: pointer;
}

.animated-link::before,
.animated-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2px;
    background-color: currentColor;
    transition: all 0.3s ease;
    transform-origin: left center;
}

/* Animation 1: Slide Out */
.animated-link.animation-slide-out::before {
    transform: scaleX(1);
    z-index: 1;
}

.animated-link.animation-slide-out::after {
    transform: scaleX(0);
    background-color: transparent;
    z-index: 2;
}

.animated-link.animation-slide-out:hover::before {
    transform: scaleX(0);
}

.animated-link.animation-slide-out:hover::after {
    transform: scaleX(1);
    background-color: inherit;
}

/* Animation 2: Expand from Center */
.animated-link.animation-expand-center::before {
    transform: scaleX(1);
    transform-origin: center;
}

.animated-link.animation-expand-center::after {
    display: none;
}

.animated-link.animation-expand-center:hover::before {
    transform: scaleX(0);
}

/* Alternative expand effect - grows from center */
.animated-link.animation-expand-center {
    overflow: hidden;
}

.animated-link.animation-expand-center::before {
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animated-link.animation-expand-center:hover::before {
    transform: scaleX(1);
}

/* Animation 3: Fade Up */
.animated-link.animation-fade-up::before {
    opacity: 1;
    transform: translateY(0) scaleX(1);
}

.animated-link.animation-fade-up::after {
    opacity: 0;
    transform: translateY(5px) scaleX(1);
    transition: all 0.3s ease;
}

.animated-link.animation-fade-up:hover::before {
    opacity: 0;
    transform: translateY(-5px) scaleX(1);
}

.animated-link.animation-fade-up:hover::after {
    opacity: 1;
    transform: translateY(0) scaleX(1);
}

/* Animation 4: Bounce Up */
.animated-link.animation-bounce-up::before {
    transform: scaleX(1) translateY(0);
}

.animated-link.animation-bounce-up::after {
    display: none;
}

.animated-link.animation-bounce-up:hover::before {
    animation: bounceUp 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceUp {
    0% {
        transform: scaleX(1) translateY(0);
    }
    50% {
        transform: scaleX(1.1) translateY(-8px);
        background-color: rgba(255, 0, 0, 0.6);
    }
    100% {
        transform: scaleX(1) translateY(0);
    }
}

/* Animation 5: Wave Effect */
.animated-link.animation-wave-effect::before {
    transform: scaleX(1);
    z-index: 1;
}

.animated-link.animation-wave-effect::after {
    transform: scaleX(0);
    transform-origin: left;
    z-index: 2;
    background: linear-gradient(90deg, transparent 0%, currentColor 50%, transparent 100%);
    background-size: 200% 100%;
    background-position: -100% 0;
    animation: none;
}

.animated-link.animation-wave-effect:hover::after {
    transform: scaleX(1);
    animation: wave 0.8s ease-in-out;
}

@keyframes wave {
    0% {
        background-position: -100% 0;
        transform: scaleX(0);
    }
    50% {
        background-position: 0% 0;
        transform: scaleX(1);
    }
    100% {
        background-position: 100% 0;
        transform: scaleX(1);
    }
}

/* Enhanced hover effects for text */
.animated-link:hover {
    color: inherit;
}

/* Accessibility improvements */
.animated-link:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.animated-link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .animated-link::before,
    .animated-link::after {
        height: 1px;
    }
    
    /* Simplify animations on mobile for performance */
    .animated-link.animation-bounce-up:hover::before {
        animation-duration: 0.4s;
    }
    
    .animated-link.animation-wave-effect:hover::after {
        animation-duration: 0.6s;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .animated-link::before,
    .animated-link::after {
        transition: none;
        animation: none;
    }
    
    .animated-link:hover::before,
    .animated-link:hover::after {
        animation: none;
        transform: scaleX(1);
        opacity: 0.5;
    }
}

/* Print styles */
@media print {
    .animated-link::before,
    .animated-link::after {
        display: none;
    }
    
    .animated-link {
        text-decoration: underline;
    }
}

/* Dark mode compatibility */
@media (prefers-color-scheme: dark) {
    .animated-link {
        color: #ffffff;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .animated-link::before,
    .animated-link::after {
        background-color: currentColor;
        opacity: 1;
    }
}

/* Custom utility classes */
.animated-link.link-large {
    font-size: 1.25em;
}

.animated-link.link-small {
    font-size: 0.875em;
}

.animated-link.link-bold {
    font-weight: 600;
}

.animated-link.link-uppercase {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Color variants */
.animated-link.link-primary::before,
.animated-link.link-primary::after {
    background-color: #0520f5;
}

.animated-link.link-secondary::before,
.animated-link.link-secondary::after {
    background-color: #6c757d;
}

.animated-link.link-success::before,
.animated-link.link-success::after {
    background-color: #28a745;
}

.animated-link.link-danger::before,
.animated-link.link-danger::after {
    background-color: #dc3545;
}

.animated-link.link-warning::before,
.animated-link.link-warning::after {
    background-color: #ffc107;
}

.animated-link.link-info::before,
.animated-link.link-info::after {
    background-color: #17a2b8;
}

/* Extra thick underline variant */
.animated-link.underline-thick::before,
.animated-link.underline-thick::after {
    height: 4px;
}

/* Extra thin underline variant */
.animated-link.underline-thin::before,
.animated-link.underline-thin::after {
    height: 1px;
}

/* Dotted underline variant */
.animated-link.underline-dotted::before,
.animated-link.underline-dotted::after {
    background-image: repeating-linear-gradient(
        to right,
        currentColor 0px,
        currentColor 2px,
        transparent 2px,
        transparent 4px
    );
    background-color: transparent;
    height: 2px;
}

/* Gradient underline variant */
.animated-link.underline-gradient::before,
.animated-link.underline-gradient::after {
    background: linear-gradient(90deg, #0520f5, #ff6b6b, #4ecdc4);
}
