/**
 * Cyberpunk Button Widget Styles
 *
 * Styles pour les boutons cyberpunk avec effets néon, glitch,
 * traînées lumineuses et animations futuristes
 */

/* ========================================
   BUTTON BASE
   ======================================== */

.cyberpunk-button-wrapper {
    display: inline-block;
}

.cyberpunk-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 32px;
    border: 2px solid;
    border-style: solid;
    background: transparent;
    font-family: 'Orbitron', 'Rajdhani', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 2px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    isolation: isolate;
}

.cyberpunk-button .button-text {
    position: relative;
    z-index: 2;
    transition: color 0.3s ease;
}

.cyberpunk-button .button-icon {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    transition: transform 0.3s ease;
}

/* ========================================
   BUTTON SIZES
   ======================================== */

.cyberpunk-button.size-small {
    padding: 10px 24px;
    font-size: 0.875rem;
    letter-spacing: 1.5px;
}

.cyberpunk-button.size-medium {
    padding: 16px 32px;
    font-size: 1rem;
    letter-spacing: 2px;
}

.cyberpunk-button.size-large {
    padding: 20px 40px;
    font-size: 1.125rem;
    letter-spacing: 2.5px;
}

.cyberpunk-button.full-width {
    width: 100%;
    display: flex;
}

/* ========================================
   STYLE: NEON BORDER
   ======================================== */

.cyberpunk-button.style-neon-border {
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.cyberpunk-button.style-neon-border:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 20px var(--glow-color, rgba(0, 240, 255, 0.5)),
        0 0 40px var(--glow-color, rgba(0, 240, 255, 0.3)),
        0 0 60px var(--glow-color, rgba(0, 240, 255, 0.2));
}

/* ========================================
   STYLE: NEON FILL
   ======================================== */

.cyberpunk-button.style-neon-fill {
    background: linear-gradient(135deg, var(--bg-color, #00F0FF) 0%, var(--bg-color-alt, #00FFFF) 100%);
    border: none;
}

.cyberpunk-button.style-neon-fill::before {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    filter: blur(20px);
    opacity: 0.5;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.cyberpunk-button.style-neon-fill:hover::before {
    opacity: 0.8;
}

/* ========================================
   STYLE: GLITCH
   ======================================== */

.cyberpunk-button.style-glitch {
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.cyberpunk-button.style-glitch::before,
.cyberpunk-button.style-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cyberpunk-button.style-glitch::before {
    color: #FF0040;
    z-index: 1;
    animation: glitch-anim-1 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

.cyberpunk-button.style-glitch::after {
    color: #00FFFF;
    z-index: 1;
    animation: glitch-anim-2 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
    animation-delay: 0.1s;
}

.cyberpunk-button.style-glitch:hover::before,
.cyberpunk-button.style-glitch:hover::after {
    opacity: 0.8;
}

@keyframes glitch-anim-1 {
    0%, 100% { transform: translate(0); clip-path: inset(0 0 0 0); }
    20% { transform: translate(-3px, 3px); clip-path: inset(0 0 85% 0); }
    40% { transform: translate(-3px, -3px); clip-path: inset(15% 0 15% 0); }
    60% { transform: translate(3px, 3px); clip-path: inset(55% 0 0 0); }
    80% { transform: translate(3px, -3px); clip-path: inset(0 0 45% 0); }
}

@keyframes glitch-anim-2 {
    0%, 100% { transform: translate(0); clip-path: inset(0 0 0 0); }
    20% { transform: translate(3px, -3px); clip-path: inset(5% 0 45% 0); }
    40% { transform: translate(3px, 3px); clip-path: inset(65% 0 0 0); }
    60% { transform: translate(-3px, -3px); clip-path: inset(0 0 75% 0); }
    80% { transform: translate(-3px, 3px); clip-path: inset(35% 0 25% 0); }
}

/* ========================================
   STYLE: HOLOGRAPHIC
   ======================================== */

.cyberpunk-button.style-holographic {
    background: linear-gradient(
        135deg,
        #667eea 0%,
        #764ba2 25%,
        #f093fb 50%,
        #c471ed 75%,
        #667eea 100%
    );
    background-size: 400% 400%;
    border: none;
    animation: holographic-shift 6s ease infinite;
}

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

.cyberpunk-button.style-holographic:hover {
    animation-duration: 3s;
    transform: scale(1.05);
}

/* ========================================
   STYLE: CORNER CUT
   ======================================== */

.cyberpunk-button.style-corner-cut {
    clip-path: polygon(
        15px 0,
        calc(100% - 15px) 0,
        100% 15px,
        100% calc(100% - 15px),
        calc(100% - 15px) 100%,
        15px 100%,
        0 calc(100% - 15px),
        0 15px
    );
    position: relative;
}

.cyberpunk-button.style-corner-cut::before {
    content: '';
    position: absolute;
    inset: 2px;
    background: var(--bg-elevated, #1A1A2E);
    clip-path: inherit;
    z-index: -1;
}

/* ========================================
   STYLE: SCANLINE
   ======================================== */

.cyberpunk-button.style-scanline {
    position: relative;
}

.cyberpunk-button.style-scanline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(0, 240, 255, 0.1) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 3;
    animation: scanline-move 4s linear infinite;
}

@keyframes scanline-move {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* ========================================
   LIGHT TRAIL EFFECT
   ======================================== */

.cyberpunk-button.has-light-trail::after {
    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;
    z-index: 2;
}

.cyberpunk-button.has-light-trail:hover::after {
    left: 100%;
}

/* ========================================
   HOVER GLITCH EFFECT
   ======================================== */

.cyberpunk-button.has-hover-glitch:hover {
    animation: button-glitch 0.3s ease-in-out;
}

@keyframes button-glitch {
    0%, 100% { transform: translate(0); }
    25% { transform: translate(-2px, 2px); }
    50% { transform: translate(2px, -2px); }
    75% { transform: translate(-2px, -2px); }
}

/* ========================================
   PULSE EFFECT
   ======================================== */

.cyberpunk-button.has-pulse {
    animation: button-pulse 2s ease-in-out infinite;
}

@keyframes button-pulse {
    0%, 100% {
        box-shadow:
            0 0 10px var(--glow-color, rgba(0, 240, 255, 0.3)),
            0 0 20px var(--glow-color, rgba(0, 240, 255, 0.2));
    }
    50% {
        box-shadow:
            0 0 20px var(--glow-color, rgba(0, 240, 255, 0.5)),
            0 0 40px var(--glow-color, rgba(0, 240, 255, 0.3)),
            0 0 60px var(--glow-color, rgba(0, 240, 255, 0.2));
    }
}

/* ========================================
   ICON ANIMATIONS
   ======================================== */

.cyberpunk-button:hover .button-icon.icon-right {
    transform: translateX(5px);
}

.cyberpunk-button:hover .button-icon.icon-left {
    transform: translateX(-5px);
}

.cyberpunk-button .button-icon i,
.cyberpunk-button .button-icon svg {
    transition: transform 0.3s ease;
}

.cyberpunk-button:hover .button-icon i,
.cyberpunk-button:hover .button-icon svg {
    transform: scale(1.1);
}

/* ========================================
   ACTIVE/PRESSED STATE
   ======================================== */

.cyberpunk-button:active {
    transform: translateY(1px) scale(0.98);
}

/* ========================================
   DISABLED STATE
   ======================================== */

.cyberpunk-button:disabled,
.cyberpunk-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .cyberpunk-button.size-small {
        padding: 8px 20px;
        font-size: 0.813rem;
    }

    .cyberpunk-button.size-medium {
        padding: 12px 28px;
        font-size: 0.938rem;
    }

    .cyberpunk-button.size-large {
        padding: 16px 36px;
        font-size: 1rem;
    }

    .cyberpunk-button {
        letter-spacing: 1.5px;
    }

    /* Réduction des effets pour mobile */
    .cyberpunk-button.has-pulse {
        animation: none;
    }

    .cyberpunk-button:hover {
        transform: none;
    }
}

@media (max-width: 480px) {
    .cyberpunk-button {
        width: 100%;
        display: flex;
    }

    .cyberpunk-button.size-small {
        padding: 10px 16px;
    }

    .cyberpunk-button.size-medium {
        padding: 14px 24px;
    }

    .cyberpunk-button.size-large {
        padding: 18px 32px;
    }
}

/* ========================================
   FOCUS STATE (ACCESSIBILITY)
   ======================================== */

.cyberpunk-button:focus-visible {
    outline: 2px solid var(--glow-color, #00F0FF);
    outline-offset: 4px;
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .cyberpunk-button,
    .cyberpunk-button::before,
    .cyberpunk-button::after,
    .cyberpunk-button .button-icon {
        animation: none !important;
        transition: none !important;
    }

    .cyberpunk-button:hover {
        transform: none !important;
    }
}

/* ========================================
   HIGH CONTRAST MODE
   ======================================== */

@media (prefers-contrast: high) {
    .cyberpunk-button {
        border-width: 3px;
    }

    .cyberpunk-button::before,
    .cyberpunk-button::after {
        display: none;
    }
}

/* ========================================
   LOADING STATE
   ======================================== */

.cyberpunk-button.is-loading {
    pointer-events: none;
    position: relative;
}

.cyberpunk-button.is-loading .button-text,
.cyberpunk-button.is-loading .button-icon {
    opacity: 0;
}

.cyberpunk-button.is-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: button-spinner 0.8s linear infinite;
    z-index: 10;
}

@keyframes button-spinner {
    to { transform: rotate(360deg); }
}

/* ========================================
   GRADIENT BORDER ANIMATION
   ======================================== */

.cyberpunk-button.style-neon-border.animated-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(
        90deg,
        #00F0FF,
        #FF00FF,
        #00F0FF
    );
    background-size: 200% 100%;
    z-index: -1;
    animation: gradient-border 3s linear infinite;
    clip-path: inherit;
}

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