/**
 * Animated Button - Styles
 * Bouton avec effets d'animation modernes
 */

/* ========================
   BASE
   ======================== */
.animated-button-wrapper {
    display: block;
}

.animated-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-style: solid;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--animation-speed, 300ms) cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.animated-btn .btn-content {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all var(--animation-speed, 300ms) ease;
}

.animated-btn .btn-text {
    transition: all var(--animation-speed, 300ms) ease;
}

.animated-btn .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--animation-speed, 300ms) ease;
}

.animated-btn .btn-icon svg {
    fill: currentColor;
}

/* Éléments cachés par défaut */
.animated-btn .btn-fill,
.animated-btn .btn-border,
.animated-btn .btn-shine,
.animated-btn .btn-ripple,
.animated-btn .btn-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.animated-btn .btn-fill {
    z-index: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--animation-speed, 300ms) cubic-bezier(0.4, 0, 0.2, 1);
}

.animated-btn .btn-shine,
.animated-btn .btn-ripple,
.animated-btn .btn-border {
    display: none;
}

.animated-btn .btn-back {
    display: none;
}

/* ========================
   ANIMATION: FILL SLIDE
   ======================== */
.animated-btn.animation-fill-slide .btn-fill {
    display: block;
}

.animated-btn.animation-fill-slide.direction-left .btn-fill {
    transform-origin: left;
}

.animated-btn.animation-fill-slide.direction-right .btn-fill {
    transform-origin: right;
}

.animated-btn.animation-fill-slide.direction-top .btn-fill {
    transform: scaleY(0);
    transform-origin: top;
}

.animated-btn.animation-fill-slide.direction-bottom .btn-fill {
    transform: scaleY(0);
    transform-origin: bottom;
}

.animated-btn.animation-fill-slide:hover .btn-fill {
    transform: scaleX(1);
}

.animated-btn.animation-fill-slide.direction-top:hover .btn-fill,
.animated-btn.animation-fill-slide.direction-bottom:hover .btn-fill {
    transform: scaleY(1);
}

/* ========================
   ANIMATION: FILL CENTER
   ======================== */
.animated-btn.animation-fill-center .btn-fill {
    display: block;
    transform: scale(0);
    transform-origin: center;
    border-radius: 50%;
}

.animated-btn.animation-fill-center:hover .btn-fill {
    transform: scale(2);
}

/* ========================
   ANIMATION: BORDER DRAW
   ======================== */
.animated-btn.animation-border-draw {
    background: transparent !important;
}

.animated-btn.animation-border-draw::before,
.animated-btn.animation-border-draw::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 2px solid transparent;
    box-sizing: border-box;
    transition: all var(--animation-speed, 300ms) ease;
}

.animated-btn.animation-border-draw::before {
    top: 0;
    left: 0;
    border-top-color: currentColor;
    border-right-color: currentColor;
}

.animated-btn.animation-border-draw::after {
    bottom: 0;
    right: 0;
    border-bottom-color: currentColor;
    border-left-color: currentColor;
}

.animated-btn.animation-border-draw:hover::before,
.animated-btn.animation-border-draw:hover::after {
    width: 100%;
    height: 100%;
}

/* ========================
   ANIMATION: SHINE
   ======================== */
.animated-btn.animation-shine .btn-shine {
    display: block;
    background: linear-gradient(
        120deg,
        transparent 0%,
        transparent 40%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 60%,
        transparent 100%
    );
    transform: translateX(-100%);
    transition: transform calc(var(--animation-speed, 300ms) * 2) ease;
}

.animated-btn.animation-shine:hover .btn-shine {
    transform: translateX(100%);
}

/* ========================
   ANIMATION: PULSE GLOW
   ======================== */
.animated-btn.animation-pulse-glow {
    animation: pulse-glow-idle 2s ease-in-out infinite;
}

.animated-btn.animation-pulse-glow:hover {
    animation: pulse-glow-hover 0.5s ease-in-out infinite alternate;
}

@keyframes pulse-glow-idle {
    0%, 100% {
        box-shadow: 0 0 5px var(--neon-color, #00d9ff),
                    0 0 10px transparent;
    }
    50% {
        box-shadow: 0 0 10px var(--neon-color, #00d9ff),
                    0 0 20px var(--neon-color, #00d9ff);
    }
}

@keyframes pulse-glow-hover {
    0% {
        box-shadow: 0 0 10px var(--neon-color, #00d9ff),
                    0 0 20px var(--neon-color, #00d9ff),
                    0 0 30px var(--neon-color, #00d9ff);
    }
    100% {
        box-shadow: 0 0 20px var(--neon-color, #00d9ff),
                    0 0 40px var(--neon-color, #00d9ff),
                    0 0 60px var(--neon-color, #00d9ff);
    }
}

/* ========================
   ANIMATION: MAGNETIC
   ======================== */
.animated-btn.animation-magnetic {
    transition: transform 0.1s ease-out;
}

.animated-btn.animation-magnetic .btn-content {
    transition: transform 0.1s ease-out;
}

/* ========================
   ANIMATION: RIPPLE
   ======================== */
.animated-btn.animation-ripple .btn-ripple {
    display: block;
    background: transparent;
    overflow: hidden;
}

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

.animated-btn.animation-ripple:active .btn-ripple::before {
    width: 300px;
    height: 300px;
    opacity: 1;
}

/* ========================
   ANIMATION: NEON
   ======================== */
.animated-btn.animation-neon {
    background: transparent !important;
    border-color: var(--neon-color, #00d9ff) !important;
    color: var(--neon-color, #00d9ff) !important;
    text-shadow: 0 0 5px var(--neon-color, #00d9ff);
    box-shadow: 0 0 5px var(--neon-color, #00d9ff),
                inset 0 0 5px transparent;
    animation: neon-flicker 3s infinite;
}

.animated-btn.animation-neon:hover {
    background: var(--neon-color, #00d9ff) !important;
    color: #000 !important;
    text-shadow: none;
    box-shadow: 0 0 10px var(--neon-color, #00d9ff),
                0 0 20px var(--neon-color, #00d9ff),
                0 0 40px var(--neon-color, #00d9ff),
                0 0 80px var(--neon-color, #00d9ff);
}

@keyframes neon-flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        opacity: 1;
    }
    20%, 24%, 55% {
        opacity: 0.8;
    }
}

/* ========================
   ANIMATION: SLIDE ARROW
   ======================== */
.animated-btn.animation-slide-arrow .btn-icon {
    transition: transform var(--animation-speed, 300ms) ease,
                opacity var(--animation-speed, 300ms) ease;
}

.animated-btn.animation-slide-arrow:hover .btn-icon {
    transform: translateX(5px);
}

.animated-btn.animation-slide-arrow.icon-before:hover .btn-icon {
    transform: translateX(-5px);
}

/* ========================
   ANIMATION: BOUNCE
   ======================== */
.animated-btn.animation-bounce:hover {
    animation: bounce-btn var(--animation-speed, 300ms) ease;
}

@keyframes bounce-btn {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-8px);
    }
    50% {
        transform: translateY(-4px);
    }
    75% {
        transform: translateY(-6px);
    }
}

/* ========================
   ANIMATION: FLIP
   ======================== */
.animated-btn.animation-flip {
    perspective: 1000px;
    background: transparent !important;
}

.animated-btn.animation-flip .btn-content,
.animated-btn.animation-flip .btn-back {
    backface-visibility: hidden;
    transition: transform calc(var(--animation-speed, 300ms) * 1.5) ease;
}

.animated-btn.animation-flip .btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotateX(180deg);
    background: var(--btn-hover-bg, #ffffff);
    color: var(--btn-hover-color, #1a1a3e);
    border-radius: inherit;
}

.animated-btn.animation-flip .btn-content {
    background: var(--btn-bg, #1a1a3e);
    border-radius: inherit;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.animated-btn.animation-flip:hover .btn-content {
    transform: rotateX(-180deg);
}

.animated-btn.animation-flip:hover .btn-back {
    transform: rotateX(0deg);
}

/* ========================
   ANIMATION: GRADIENT SHIFT
   ======================== */
.animated-btn.animation-gradient-shift {
    background: linear-gradient(
        90deg,
        var(--gradient-1, #6366f1),
        var(--gradient-2, #ec4899),
        var(--gradient-3, #f59e0b),
        var(--gradient-1, #6366f1)
    ) !important;
    background-size: 300% 100% !important;
    border: none !important;
    animation: gradient-shift 4s ease infinite;
}

.animated-btn.animation-gradient-shift:hover {
    animation: gradient-shift 1s ease infinite;
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ========================
   ICON ANIMATIONS
   ======================== */
.animated-btn:hover .btn-icon {
    transform: translateX(3px);
}

.animated-btn.icon-before:hover .btn-icon {
    transform: translateX(-3px);
}

/* ========================
   FOCUS STATE
   ======================== */
.animated-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
}

.animated-btn:focus:not(:focus-visible) {
    box-shadow: none;
}

.animated-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ========================
   ACCESSIBILITÉ
   ======================== */
@media (prefers-reduced-motion: reduce) {
    .animated-btn,
    .animated-btn *,
    .animated-btn::before,
    .animated-btn::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}
