/* ============================================
   21st.dev Modern UI/UX Effects
   Premium effects inspired by 21st.dev
   ============================================ */

/* ===== Animated Text Effects ===== */

/* Typewriter Effect */
.typewriter {
    overflow: hidden;
    border-right: 3px solid var(--color-accent);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--color-accent) }
}

/* Glowing Text Effect */
.glow-text {
    text-shadow: 
        0 0 10px rgba(196, 241, 53, 0.5),
        0 0 20px rgba(196, 241, 53, 0.3),
        0 0 30px rgba(196, 241, 53, 0.2),
        0 0 40px rgba(196, 241, 53, 0.1);
    animation: glow-pulse 2s ease-in-out infinite alternate;
}

@keyframes glow-pulse {
    from {
        text-shadow: 
            0 0 10px rgba(196, 241, 53, 0.5),
            0 0 20px rgba(196, 241, 53, 0.3),
            0 0 30px rgba(196, 241, 53, 0.2);
    }
    to {
        text-shadow: 
            0 0 20px rgba(196, 241, 53, 0.8),
            0 0 30px rgba(196, 241, 53, 0.5),
            0 0 40px rgba(196, 241, 53, 0.3),
            0 0 50px rgba(196, 241, 53, 0.2);
    }
}

/* Gradient Text Animation */
.gradient-text-animated {
    background: linear-gradient(
        90deg,
        var(--color-accent) 0%,
        #ffffff 25%,
        var(--color-accent) 50%,
        #ffffff 75%,
        var(--color-accent) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 3s linear infinite;
}

@keyframes gradient-shift {
    to { background-position: 200% center }
}

/* Text Reveal Animation */
.text-reveal {
    position: relative;
    display: inline-block;
    overflow: hidden;
}

.text-reveal::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-accent);
    transform: translateX(-101%);
    animation: reveal-text 1s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

.text-reveal.in-view::after {
    animation: reveal-text 1s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

@keyframes reveal-text {
    0% { transform: translateX(-101%) }
    50% { transform: translateX(0) }
    100% { transform: translateX(101%) }
}

/* ===== Glassmorphic Cards ===== */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.37),
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 0.5s ease;
}

.glass-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: rgba(196, 241, 53, 0.4);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(196, 241, 53, 0.15),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.glass-card:hover::before {
    left: 100%;
}

/* Card Inner Glow on Hover */
.glass-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(196, 241, 53, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
    z-index: -1;
}

.glass-card:hover::after {
    width: 300%;
    height: 300%;
}

/* ===== Gradient Buttons ===== */
.btn-gradient {
    position: relative;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-bg-primary);
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
    border: none;
    border-radius: var(--radius-md);
    overflow: hidden;
    z-index: 1;
    transition: all 0.4s ease;
    box-shadow: 0 4px 15px rgba(196, 241, 53, 0.3);
}

.btn-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-accent-hover) 0%, var(--color-accent) 100%);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.btn-gradient:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 8px 25px rgba(196, 241, 53, 0.4),
        0 0 60px rgba(196, 241, 53, 0.2);
}

.btn-gradient:hover::before {
    opacity: 1;
}

/* Pulse Button */
.btn-pulse {
    animation: btn-pulse-animation 2s infinite;
}

@keyframes btn-pulse-animation {
    0% {
        box-shadow: 0 0 0 0 rgba(196, 241, 53, 0.5);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(196, 241, 53, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(196, 241, 53, 0);
    }
}

/* Shiny Button Effect */
.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to right,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { left: -200% }
    100% { left: 200% }
}

/* ===== Animated Background ===== */
.animated-bg {
    position: relative;
    overflow: hidden;
}

.animated-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(196, 241, 53, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(196, 241, 53, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(196, 241, 53, 0.05) 0%, transparent 50%);
    animation: bg-morph 15s ease-in-out infinite;
    z-index: -1;
}

@keyframes bg-morph {
    0%, 100% {
        background: 
            radial-gradient(circle at 20% 80%, rgba(196, 241, 53, 0.15) 0%, transparent 50%),
            radial-gradient(circle at 80% 20%, rgba(196, 241, 53, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 40% 40%, rgba(196, 241, 53, 0.05) 0%, transparent 50%);
    }
    33% {
        background: 
            radial-gradient(circle at 60% 20%, rgba(196, 241, 53, 0.15) 0%, transparent 50%),
            radial-gradient(circle at 20% 60%, rgba(196, 241, 53, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 80% 80%, rgba(196, 241, 53, 0.05) 0%, transparent 50%);
    }
    66% {
        background: 
            radial-gradient(circle at 80% 60%, rgba(196, 241, 53, 0.15) 0%, transparent 50%),
            radial-gradient(circle at 40% 80%, rgba(196, 241, 53, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 20% 20%, rgba(196, 241, 53, 0.05) 0%, transparent 50%);
    }
}

/* Floating Particles Container */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--color-accent);
    border-radius: 50%;
    opacity: 0;
    animation: float-particle 8s infinite;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 1s; }
.particle:nth-child(3) { left: 30%; animation-delay: 2s; }
.particle:nth-child(4) { left: 40%; animation-delay: 3s; }
.particle:nth-child(5) { left: 50%; animation-delay: 4s; }
.particle:nth-child(6) { left: 60%; animation-delay: 5s; }
.particle:nth-child(7) { left: 70%; animation-delay: 6s; }
.particle:nth-child(8) { left: 80%; animation-delay: 7s; }
.particle:nth-child(9) { left: 90%; animation-delay: 0.5s; }
.particle:nth-child(10) { left: 95%; animation-delay: 2.5s; }

@keyframes float-particle {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

/* ===== Bento Grid Layout ===== */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: var(--spacing-md);
}

.bento-item {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

/* Featured Item - spans 2 columns */
.bento-item.featured {
    grid-column: span 2;
    grid-row: span 2;
}

/* Wide Item - spans 2 columns */
.bento-item.wide {
    grid-column: span 2;
}

/* Tall Item - spans 2 rows */
.bento-item.tall {
    grid-row: span 2;
}

.bento-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.bento-item:hover {
    transform: translateY(-8px);
    border-color: rgba(196, 241, 53, 0.3);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(196, 241, 53, 0.1);
}

.bento-item:hover::before {
    opacity: 1;
}

.bento-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(196, 241, 53, 0.2), rgba(196, 241, 53, 0.05));
    border-radius: var(--radius-lg);
    font-size: 1.75rem;
    margin-bottom: var(--spacing-md);
    transition: transform 0.4s ease;
}

.bento-item:hover .bento-icon {
    transform: scale(1.1) rotate(5deg);
}

.bento-item h4 {
    color: var(--color-text-primary);
    font-size: 1.5rem;
    margin-bottom: var(--spacing-xs);
}

.bento-item p {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.bento-stat {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-accent), #ffffff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: var(--spacing-xs);
}

/* ===== Hover Effects ===== */

/* Magnetic Effect (requires JS) */
.magnetic {
    transition: transform 0.3s ease;
}

/* 3D Tilt Effect Container */
.tilt-container {
    perspective: 1000px;
}

.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}

.tilt-card:hover {
    transform: rotateX(5deg) rotateY(5deg);
}

/* Border Gradient Animation */
.border-gradient {
    position: relative;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
}

.border-gradient::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(
        45deg,
        var(--color-accent),
        transparent,
        var(--color-accent),
        transparent
    );
    background-size: 200% 200%;
    border-radius: calc(var(--radius-lg) + 2px);
    z-index: -1;
    animation: border-rotate 4s linear infinite;
}

.border-gradient::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: var(--color-bg-secondary);
    border-radius: calc(var(--radius-lg) - 2px);
    z-index: -1;
}

@keyframes border-rotate {
    0% { background-position: 0% 0% }
    100% { background-position: 200% 200% }
}

/* ===== Floating Labels ===== */
.floating-label {
    position: absolute;
    top: -10px;
    left: 20px;
    padding: 4px 12px;
    background: var(--color-accent);
    color: var(--color-bg-primary);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    animation: label-float 3s ease-in-out infinite;
}

@keyframes label-float {
    0%, 100% { transform: translateY(0) }
    50% { transform: translateY(-5px) }
}

/* ===== Responsive Bento Grid ===== */
@media (max-width: 992px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bento-item.featured {
        grid-column: span 2;
        grid-row: span 1;
    }
}

@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }
    
    .bento-item.featured,
    .bento-item.wide,
    .bento-item.tall {
        grid-column: span 1;
        grid-row: span 1;
    }
}

/* ===== Scroll Reveal Animations ===== */
.reveal-up {
    opacity: 0;
    transform: translateY(60px);
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.reveal-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-60px);
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(60px);
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* Staggered Animation Delays */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }
.stagger-5 { transition-delay: 0.5s; }
.stagger-6 { transition-delay: 0.6s; }
