/* CSS Custom Properties for easy theming and maintenance */
:root {
    --primary-color: #a000ff;
    --secondary-color: #00ffff;
    --accent-color: #ff00ff;
    --bg-dark: #0a0a0a;
    --bg-card: #111;
    --text-light: #fff;
    --text-muted: #888;
    --border-radius: 20px;
    --transition-speed: 0.3s;
    --animation-duration: 3s;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Layout */
.demo-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2.5rem;
    padding: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Card base styles */
.effect-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.875rem;
    position: relative;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-speed) ease;
    will-change: transform;
    cursor: pointer;
}

.effect-card:hover {
    transform: translateY(-5px);
}

.effect-card:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.effect-title {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color);
    z-index: 10;
    margin: 0;
}

.profile-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 1.25rem;
}

.profile-pic {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 2;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
}

/* Typography */
h1 {
    text-align: center;
    padding: 2.5rem 1.25rem 1.25rem;
    font-size: 2.25rem;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.description {
    text-align: center;
    padding: 0 1.25rem 2.5rem;
    color: var(--text-muted);
    max-width: 800px;
    margin: 0 auto;
}

/* 1. Gradient Overlay Effect */
.gradient-effect {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-overlay {
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle at center, transparent 30%, rgba(102, 126, 234, 0.6) 70%);
    animation: rotate 20s linear infinite;
    will-change: transform;
}

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

/* 2. Mesh Gradient Effect */
.mesh-effect {
    background: var(--bg-card);
    position: relative;
}

.mesh-gradient {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: 
        radial-gradient(at 40% 20%, hsla(280, 100%, 50%, 0.3) 0px, transparent 50%),
        radial-gradient(at 80% 0%, hsla(189, 100%, 56%, 0.3) 0px, transparent 50%),
        radial-gradient(at 0% 50%, hsla(355, 100%, 93%, 0.3) 0px, transparent 50%),
        radial-gradient(at 80% 50%, hsla(340, 100%, 76%, 0.3) 0px, transparent 50%),
        radial-gradient(at 0% 100%, hsla(224, 100%, 50%, 0.3) 0px, transparent 50%);
    animation: meshMove 15s ease infinite;
    will-change: transform;
}

@keyframes meshMove {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-20px, -20px) scale(1.1); }
    66% { transform: translate(20px, -10px) scale(0.9); }
}

/* 3. Particle Effect */
.particle-effect {
    background: var(--bg-dark);
    position: relative;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0;
    animation: particleFloat 10s infinite;
    will-change: transform, opacity;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translateY(100px) scale(0);
    }
    10% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    90% {
        opacity: 1;
        transform: translateY(-100px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-200px) scale(0);
    }
}

/* 4. Glow Effect */
.glow-effect {
    background: var(--bg-dark);
}

.glow-ring {
    position: absolute;
    inset: -30px;
    border-radius: 50%;
    background: conic-gradient(from 180deg at 50% 50%, var(--primary-color) 0deg, var(--secondary-color) 120deg, var(--accent-color) 240deg, var(--primary-color) 360deg);
    animation: spin var(--animation-duration) linear infinite;
    filter: blur(20px);
    opacity: 0.6;
    will-change: transform;
}

.glow-ring::before {
    content: '';
    position: absolute;
    inset: 20px;
    background: var(--bg-dark);
    border-radius: 50%;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 5. Glass Morphism with Patterns */
.pattern-effect {
    background: var(--bg-card);
    position: relative;
}

.pattern-overlay {
    position: absolute;
    inset: 0;
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(160, 0, 255, 0.03) 10px,
            rgba(160, 0, 255, 0.03) 20px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 10px,
            rgba(0, 255, 255, 0.03) 10px,
            rgba(0, 255, 255, 0.03) 20px
        );
    border-radius: var(--border-radius);
}

.glass-card {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

/* 6. Animated Border Effect */
.border-effect {
    background: var(--bg-dark);
    position: relative;
}

/* Updated Animated Gradient Border for grid card */
.animated-border {
    position: absolute;
    inset: 0; /* occupy same size as card */
    padding: 3px; /* border thickness */
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color), var(--primary-color));
    background-size: 400% 400%;
    border-radius: var(--border-radius);
    animation: borderGradient 5s ease infinite;
    pointer-events: none;

    /* mask to show only border */
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
}

/* Remove inner overlay element as it's no longer needed */
.animated-border::after { content: none; }

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

/* 7. Holographic Effect */
.holographic-effect {
    background: var(--bg-card);
    position: relative;
}

.holo-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        rgba(255, 0, 0, 0.1) 0%,
        rgba(255, 154, 0, 0.1) 10%,
        rgba(208, 222, 33, 0.1) 20%,
        rgba(79, 220, 74, 0.1) 30%,
        rgba(63, 218, 216, 0.1) 40%,
        rgba(47, 201, 226, 0.1) 50%,
        rgba(28, 127, 238, 0.1) 60%,
        rgba(95, 21, 242, 0.1) 70%,
        rgba(186, 12, 248, 0.1) 80%,
        rgba(251, 7, 217, 0.1) 90%,
        rgba(255, 0, 0, 0.1) 100%
    );
    background-size: 200% 200%;
    animation: holographic var(--animation-duration) ease infinite;
    mix-blend-mode: screen;
    will-change: background-position;
}

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

/* 8. Noise Texture Effect */
.noise-effect {
    background: var(--bg-card);
    position: relative;
}

.noise-overlay {
    position: absolute;
    inset: 0;
    opacity: 0.15;
    background-image: 
        repeating-radial-gradient(circle at 0 0, transparent 0, var(--primary-color) 2px, transparent 4px),
        repeating-radial-gradient(circle at 50% 50%, transparent 0, var(--secondary-color) 1px, transparent 3px);
    background-size: 50px 50px, 30px 30px;
    animation: noiseMove 20s linear infinite;
    will-change: transform;
}

@keyframes noiseMove {
    to { transform: translate(50px, 50px); }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    max-width: 90vw;
    max-height: 90vh;
    width: 600px;
    overflow: hidden;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-content {
    padding: 2rem;
}

.preview-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.preview-effect {
    position: relative;
    width: 300px;
    height: 300px;
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-profile-container {
    position: relative;
    width: 200px;
    height: 200px;
}

.preview-profile-pic {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: white;
    position: relative;
    z-index: 2;
}

/* Preview effect classes */
.preview-effect.gradient-effect {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.preview-effect.gradient-effect::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle at center, transparent 30%, rgba(102, 126, 234, 0.6) 70%);
    animation: rotate 20s linear infinite;
}

.preview-effect.mesh-effect {
    background: var(--bg-card);
}

.preview-effect.mesh-effect::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: 
        radial-gradient(at 40% 20%, hsla(280, 100%, 50%, 0.3) 0px, transparent 50%),
        radial-gradient(at 80% 0%, hsla(189, 100%, 56%, 0.3) 0px, transparent 50%),
        radial-gradient(at 0% 50%, hsla(355, 100%, 93%, 0.3) 0px, transparent 50%),
        radial-gradient(at 80% 50%, hsla(340, 100%, 76%, 0.3) 0px, transparent 50%),
        radial-gradient(at 0% 100%, hsla(224, 100%, 50%, 0.3) 0px, transparent 50%);
    animation: meshMove 15s ease infinite;
}

.preview-effect.particle-effect {
    background: var(--bg-dark);
}

.preview-effect.glow-effect {
    background: var(--bg-dark);
}

.preview-effect.glow-effect::before {
    content: '';
    position: absolute;
    inset: -50px;
    border-radius: 50%;
    background: conic-gradient(from 180deg at 50% 50%, var(--primary-color) 0deg, var(--secondary-color) 120deg, var(--accent-color) 240deg, var(--primary-color) 360deg);
    animation: spin var(--animation-duration) linear infinite;
    filter: blur(30px);
    opacity: 0.6;
}

.preview-effect.pattern-effect {
    background: var(--bg-card);
}

.preview-effect.pattern-effect::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(160, 0, 255, 0.03) 10px,
            rgba(160, 0, 255, 0.03) 20px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 10px,
            rgba(0, 255, 255, 0.03) 10px,
            rgba(0, 255, 255, 0.03) 20px
        );
    border-radius: var(--border-radius);
}

.preview-effect.border-effect {
    background: var(--bg-dark);
    position: relative;
    border-radius: var(--border-radius);
}

.preview-effect.border-effect::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 4px; /* Border thickness */
    border-radius: inherit;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color), var(--primary-color));
    background-size: 400% 400%;
    animation: borderGradient 5s ease infinite;
    
    /* Show only the border by masking the inner area */
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}

/* Remove unnecessary ::after (inner overlay) */
.preview-effect.border-effect::after {
    content: none;
}

.preview-effect.holographic-effect {
    background: var(--bg-card);
}

.preview-effect.holographic-effect::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        rgba(255, 0, 0, 0.1) 0%,
        rgba(255, 154, 0, 0.1) 10%,
        rgba(208, 222, 33, 0.1) 20%,
        rgba(79, 220, 74, 0.1) 30%,
        rgba(63, 218, 216, 0.1) 40%,
        rgba(47, 201, 226, 0.1) 50%,
        rgba(28, 127, 238, 0.1) 60%,
        rgba(95, 21, 242, 0.1) 70%,
        rgba(186, 12, 248, 0.1) 80%,
        rgba(251, 7, 217, 0.1) 90%,
        rgba(255, 0, 0, 0.1) 100%
    );
    background-size: 200% 200%;
    animation: holographic var(--animation-duration) ease infinite;
    mix-blend-mode: screen;
}

.preview-effect.noise-effect {
    background: var(--bg-card);
}

.preview-effect.noise-effect::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.15;
    background-image: 
        repeating-radial-gradient(circle at 0 0, transparent 0, var(--primary-color) 2px, transparent 4px),
        repeating-radial-gradient(circle at 50% 50%, transparent 0, var(--secondary-color) 1px, transparent 3px);
    background-size: 50px 50px, 30px 30px;
    animation: noiseMove 20s linear infinite;
}

.modal-description {
    color: var(--text-muted);
    line-height: 1.6;
    text-align: center;
}

/* Performance optimizations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Responsive design improvements */
@media (max-width: 768px) {
    .demo-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .effect-card {
        min-height: 300px;
        padding: 1.25rem;
    }
    
    h1 {
        font-size: 1.875rem;
        padding: 1.5rem 1rem 1rem;
    }
    
    .description {
        padding: 0 1rem 1.5rem;
    }
    
    .modal {
        width: 95vw;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 1rem 1.5rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
    
    .preview-effect {
        width: 250px;
        height: 250px;
    }
    
    .preview-profile-container {
        width: 150px;
        height: 150px;
    }
    
    .preview-profile-pic {
        font-size: 3rem;
    }
} 