/* Cat Card 3D Holographic Effects
   Inspired by Pokemon Cards CSS
   Only applies to detail page cards (non-clickable) */

/* Wrapper for 3D transform context - only on detail page */
.cat-card-3d-wrapper {
    width: 100%;
    max-width: 400px;
    perspective: 1000px;
    transform-style: preserve-3d;
    position: relative;
}

/* Zoomable cards (detail page) */
.cat-card-3d-wrapper.zoomable {
    cursor: zoom-in;
}

.cat-card-3d-wrapper.zoomable .cat-card {
    cursor: zoom-in;
}

/* Enhanced cat card for 3D effects - only in wrapper */
.cat-card-3d-wrapper .cat-card {
    transform-style: preserve-3d;
    will-change: transform;
    transition: transform 0.5s ease, box-shadow 0.3s ease;
    position: relative;
    z-index: 1;
}

/* Ensure clickable cards on main page show pointer cursor */
.cat-card.clickable-card {
    cursor: pointer !important;
}

/* Full-screen overlay */
.cat-card-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: all 0.3s ease;
    cursor: zoom-out;
}

.cat-card-fullscreen-overlay.active {
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    opacity: 1;
}

/* Full-screen card */
.cat-card-fullscreen {
    width: 100%;
    transform: scale(0.8) rotateY(0deg);
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.cat-card-fullscreen-overlay.active .cat-card-fullscreen {
    transform: scale(1) rotateY(0deg);
    opacity: 1;
}

/* Close button for full-screen */
.cat-card-fullscreen-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    color: white;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    z-index: 10000;
}

.cat-card-fullscreen-close:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

.cat-card-fullscreen-close:active {
    transform: scale(0.95);
}

/* Shine overlay effect - only in 3D wrapper */
.cat-card-3d-wrapper .cat-card-shine {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
    mix-blend-mode: overlay;
    border-radius: 28px;
}

/* Holographic rainbow effect - only in 3D wrapper */
.cat-card-3d-wrapper .cat-card-holographic {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9;
    opacity: 0;
    transition: opacity 0.3s ease;
    mix-blend-mode: color-dodge;
    border-radius: 28px;
}

/* Sparkles container for legendary and mythical cards - only in 3D wrapper */
.cat-card-3d-wrapper .cat-card-sparkles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 11;
    overflow: hidden;
    border-radius: 28px;
}

/* Individual sparkle */
.cat-card-3d-wrapper .sparkle {
    position: absolute;
    background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.8) 30%, transparent 70%);
    border-radius: 50%;
    animation: sparkle-twinkle 2s ease-in-out infinite;
    opacity: 0;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}

/* Sparkle twinkle animation */
@keyframes sparkle-twinkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.5) rotate(180deg);
    }
}

/* Subtle pulse effect for mythical and legendary cards - only in 3D wrapper */
.cat-card-3d-wrapper .cat-card.rarity-legendary,
.cat-card-3d-wrapper .cat-card.rarity-mythical {
    animation: subtle-glow 3s ease-in-out infinite;
}

.cat-card-3d-wrapper .cat-card.rarity-rare {
    animation: subtle-glow-rare 3s ease-in-out infinite;
}

@keyframes subtle-glow {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.15);
    }
}

@keyframes subtle-glow-rare {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.05);
    }
}

/* Enhanced hover state for 3D cards - only in wrapper */
.cat-card-3d-wrapper .cat-card:hover {
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(146, 157, 247, 0.3);
}

.cat-card-3d-wrapper .cat-card.rarity-common:hover {
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(129, 199, 132, 0.4);
}

.cat-card-3d-wrapper .cat-card.rarity-uncommon:hover {
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(146, 157, 247, 0.5);
}

.cat-card-3d-wrapper .cat-card.rarity-rare:hover {
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(111, 66, 193, 0.4);
}

.cat-card-3d-wrapper .cat-card.rarity-legendary:hover {
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 0 30px rgba(255, 213, 79, 0.6),
        0 0 10px rgba(255, 213, 79, 0.4);
}

.cat-card-3d-wrapper .cat-card.rarity-mythical:hover {
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 0 30px rgba(239, 83, 80, 0.5),
        0 0 10px rgba(239, 83, 80, 0.3);
}

/* Foil texture overlay for rare cards - only in 3D wrapper */
.cat-card-3d-wrapper .cat-card.rarity-legendary::after,
.cat-card-3d-wrapper .cat-card.rarity-mythical::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.03) 2px,
            rgba(255, 255, 255, 0.03) 4px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.03) 2px,
            rgba(255, 255, 255, 0.03) 4px
        );
    pointer-events: none;
    z-index: 8;
    border-radius: 24px;
    opacity: 0.3;
}

/* Enhanced foil pattern for mythical cards - only in 3D wrapper */
.cat-card-3d-wrapper .cat-card.rarity-mythical::after {
    background-image: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 1.5px,
            rgba(255, 100, 100, 0.05) 1.5px,
            rgba(255, 100, 100, 0.05) 3px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 1.5px,
            rgba(255, 100, 100, 0.05) 1.5px,
            rgba(255, 100, 100, 0.05) 3px
        );
    opacity: 0.4;
}

/* Animated gradient border for mythical cards on hover - only in 3D wrapper */
.cat-card-3d-wrapper .cat-card.rarity-mythical:hover::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        45deg,
        #ef5350, #ec407a, #ab47bc, #7e57c2,
        #5c6bc0, #42a5f5, #26c6da, #26a69a,
        #66bb6a, #9ccc65, #d4e157, #ffee58,
        #ffca28, #ffa726, #ff7043, #ef5350
    );
    background-size: 400% 400%;
    border-radius: 28px;
    z-index: -1;
    animation: gradient-rotate 3s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cat-card-3d-wrapper .cat-card.rarity-mythical:hover::before {
    opacity: 0.6;
}

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

/* Prevent z-index issues with card content */
.cat-card-photo-container,
.cat-card-body {
    position: relative;
    z-index: 5;
}

/* Ensure grid items work with 3D wrapper */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr));
    gap: 1.5rem;
    justify-items: center;
}

/* Mobile adjustments */
/*@media (max-width: 768px) {
    .cat-card-fullscreen-overlay {
        padding: 1rem;
    }
    
    .cat-card-fullscreen {
        max-width: 100%;
    }
    
    .cat-card-fullscreen-close {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
}*/

/* Accessibility: Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .cat-card-3d-wrapper .cat-card {
        transform: none !important;
        transition: none !important;
    }
    
    .cat-card-3d-wrapper .cat-card-shine,
    .cat-card-3d-wrapper .cat-card-holographic,
    .cat-card-3d-wrapper .cat-card-sparkles {
        display: none;
    }
    
    .cat-card-3d-wrapper .cat-card.rarity-legendary,
    .cat-card-3d-wrapper .cat-card.rarity-mythical {
        animation: none !important;
    }
    
    .cat-card-3d-wrapper .sparkle {
        animation: none !important;
    }
    
    .cat-card-3d-wrapper .cat-card.rarity-mythical:hover::before {
        animation: none !important;
    }
    
    .cat-card-fullscreen-overlay,
    .cat-card-fullscreen {
        transition: opacity 0.1s ease !important;
    }
}
