/* === Y2K GRUNGE EFFECTS === */

/* Scanlines overlay */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03) 0px,
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
}

/* Noise texture */
.noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Glitch text effect */
.glitch {
    position: relative;
    animation: glitch-skew 4s infinite linear alternate-reverse;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    color: #ff0040;
    animation: glitch-effect 3s infinite linear alternate-reverse;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
    transform: translate(-2px, -1px);
    opacity: 0.8;
}

.glitch::after {
    color: #00ffff;
    animation: glitch-effect 2s infinite linear alternate-reverse;
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
    transform: translate(2px, 1px);
    opacity: 0.8;
}

@keyframes glitch-effect {
    0% { transform: translate(0); }
    20% { transform: translate(-3px, 3px); }
    40% { transform: translate(-3px, -3px); }
    60% { transform: translate(3px, 3px); }
    80% { transform: translate(3px, -3px); }
    100% { transform: translate(0); }
}

@keyframes glitch-skew {
    0% { transform: skew(0deg); }
    2% { transform: skew(0.5deg); }
    4% { transform: skew(0deg); }
    50% { transform: skew(0deg); }
    52% { transform: skew(-0.5deg); }
    54% { transform: skew(0deg); }
    100% { transform: skew(0deg); }
}

/* Flickering animation for elements */
@keyframes flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow:
            0 0 4px #00ff00,
            0 0 11px #00ff00,
            0 0 19px #00ff00;
        filter: drop-shadow(0 0 8px rgba(0, 255, 0, 0.5));
    }
    20%, 24%, 55% {
        text-shadow: none;
        filter: none;
    }
}

.logo {
    animation: flicker 5s infinite alternate;
}

.logo-img-link {
    animation: flicker 5s infinite alternate;
}

/* Matrix-style background drip */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0, 255, 0, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 0, 64, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(0, 255, 255, 0.02) 0%, transparent 50%);
}

/* Cursor trail effect via CSS */
body::after {
    content: '';
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-primary);
    pointer-events: none;
    z-index: 9997;
    opacity: 0;
    animation: cursor-pulse 2s infinite;
}

@keyframes cursor-pulse {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.3; }
}

/* Product card hover distortion */
.product-card:hover {
    animation: card-glitch 0.3s;
}

@keyframes card-glitch {
    0% { transform: translateY(-3px) skew(0deg); }
    25% { transform: translateY(-3px) skew(0.5deg); }
    50% { transform: translateY(-3px) skew(-0.5deg); }
    75% { transform: translateY(-3px) skew(0.3deg); }
    100% { transform: translateY(-3px) skew(0deg); }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-primary);
    border: 1px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Selection styling */
::selection {
    background: var(--text-primary);
    color: var(--bg-primary);
}

/* Input focus glow */
input:focus {
    animation: input-glow 1.5s infinite alternate;
}

@keyframes input-glow {
    0% { box-shadow: 0 0 5px rgba(0, 255, 0, 0.1); }
    100% { box-shadow: 0 0 15px rgba(0, 255, 0, 0.3); }
}

/* Button press effect */
.btn:active {
    transform: scale(0.97);
    filter: brightness(1.2);
}

/* Border animation on cards */
.product-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(45deg, var(--text-primary), var(--accent), var(--accent-alt), var(--text-primary));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
}

.product-card:hover::before {
    opacity: 1;
    animation: border-rotate 3s linear infinite;
}

@keyframes border-rotate {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* Typing cursor effect on tagline */
.tagline {
    border-right: 2px solid var(--text-primary);
    animation: blink-cursor 1s step-end infinite;
    display: inline-block;
}

@keyframes blink-cursor {
    0%, 100% { border-color: var(--text-primary); }
    50% { border-color: transparent; }
}

/* Distorted underline on nav links */
.main-nav a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s;
    box-shadow: 0 0 5px var(--accent);
}

.main-nav a {
    position: relative;
}

.main-nav a:hover::after {
    width: 100%;
}

/* Star rating pulse */
.product-img-placeholder {
    animation: star-pulse 3s ease-in-out infinite;
}

@keyframes star-pulse {
    0%, 100% {
        text-shadow: 0 0 20px var(--accent);
        transform: scale(1);
    }
    50% {
        text-shadow: 0 0 40px var(--accent), 0 0 60px var(--accent);
        transform: scale(1.05);
    }
}

/* Auth container border animation */
.auth-container {
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--text-primary), transparent);
    animation: scan-line 4s linear infinite;
}

@keyframes scan-line {
    0% { left: -100%; }
    100% { left: 100%; }
}
