/* ========================================
   MindFiti UX/UI Enhancements & Animations
   ======================================== */

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

/* ========================================
   SCROLL TO TOP BUTTON
   ======================================== */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-to-top.show {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.6);
}

.scroll-to-top:active {
    transform: translateY(-2px) scale(1.05);
}

/* Pulse Animation for Scroll Button */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 8px 30px rgba(102, 126, 234, 0.7);
    }
}

.scroll-to-top.show {
    animation: pulse 2s infinite;
}

/* ========================================
   INTRIGUING CATEGORY CARD ANIMATIONS
   ======================================== */

/* Floating Animation for Cards */
@keyframes float-card {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(1deg);
    }
    50% {
        transform: translateY(-5px) rotate(-1deg);
    }
    75% {
        transform: translateY(-15px) rotate(0.5deg);
    }
}

/* Colorful Gradient Shift */
@keyframes rainbow-gradient {
    0% {
        background-position: 0% 50%;
        filter: hue-rotate(0deg);
    }
    33% {
        background-position: 50% 50%;
        filter: hue-rotate(120deg);
    }
    66% {
        background-position: 100% 50%;
        filter: hue-rotate(240deg);
    }
    100% {
        background-position: 0% 50%;
        filter: hue-rotate(360deg);
    }
}

/* Pulsing Glow Effect */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 8px 30px rgba(124, 58, 237, 0.3),
                    0 0 40px rgba(124, 58, 237, 0.1);
    }
    50% {
        box-shadow: 0 12px 40px rgba(124, 58, 237, 0.5),
                    0 0 60px rgba(124, 58, 237, 0.3),
                    inset 0 0 20px rgba(255, 255, 255, 0.1);
    }
}

/* Rotate and Scale on Hover */
@keyframes hover-bounce {
    0%, 100% {
        transform: translateY(-15px) scale(1.05) rotate(-2deg);
    }
    50% {
        transform: translateY(-20px) scale(1.08) rotate(2deg);
    }
}

/* Apply Floating Animation to Category Cards */
.category-card {
    animation: float-card 6s ease-in-out infinite;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
}

/* Stagger Animation Delays for Cards */
.category-card:nth-child(1) {
    animation-delay: 0s;
}
.category-card:nth-child(2) {
    animation-delay: 0.5s;
}
.category-card:nth-child(3) {
    animation-delay: 1s;
}
.category-card:nth-child(4) {
    animation-delay: 1.5s;
}
.category-card:nth-child(5) {
    animation-delay: 2s;
}
.category-card:nth-child(6) {
    animation-delay: 2.5s;
}
.category-card:nth-child(7) {
    animation-delay: 3s;
}
.category-card:nth-child(8) {
    animation-delay: 3.5s;
}

/* Colorful Gradient Background with Animation */
.category-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(-45deg, #ff6b6b, #4ecdc4, #45b7d1, #f7b731, #5f27cd, #ff9ff3);
    background-size: 400% 400%;
    animation: rainbow-gradient 8s ease infinite;
    opacity: 0.15;
    border-radius: 15px;
    z-index: 0;
}

/* Keep card content above gradient */
.category-card > * {
    position: relative;
    z-index: 1;
}

/* Enhanced Hover Effects */
.category-card:hover {
    animation: hover-bounce 0.6s ease-in-out infinite;
    box-shadow: 0 20px 60px rgba(124, 58, 237, 0.4),
                0 0 80px rgba(124, 58, 237, 0.2);
    transform: translateY(-15px) scale(1.05);
}

/* Pulsing Glow Effect on Cards */
.category-card {
    animation: float-card 6s ease-in-out infinite,
               pulse-glow 3s ease-in-out infinite;
}

/* Icon Rotation on Hover */
.category-card:hover .card-icon {
    animation: spin-icon 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.8));
}

@keyframes spin-icon {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.3);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Breathing Effect for Card Icons */
.card-icon {
    animation: breathe 3s ease-in-out infinite;
    display: inline-block;
}

@keyframes breathe {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Button Pulse Animation */
.card-btn {
    position: relative;
    overflow: hidden;
}

.card-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.category-card:hover .card-btn::before {
    width: 300px;
    height: 300px;
}

/* Different Color Schemes for Card Types */
.category-card.substance::before {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: rainbow-gradient 10s ease infinite;
}

.category-card.behavioral::before {
    background: linear-gradient(-45deg, #a78bfa, #8b5cf6, #4facfe, #00f2fe);
    background-size: 400% 400%;
    animation: rainbow-gradient 12s ease infinite;
}

/* Shimmer Effect - Only on Hover */
@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.category-card:hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.5) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shimmer 0.8s ease-in-out;
    pointer-events: none;
    z-index: 2;
}

/* ========================================
   ANIMATED HERO SECTION
   ======================================== */

/* Animated Gradient Background */
.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(-45deg, #7c3aed, #6d28d9, #a78bfa, #8b5cf6);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

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

/* Floating Particles */
.floating-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: float 20s infinite;
}

.particle:nth-child(1) {
    width: 80px;
    height: 80px;
    left: 10%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    width: 120px;
    height: 120px;
    left: 20%;
    animation-delay: 2s;
}

.particle:nth-child(3) {
    width: 60px;
    height: 60px;
    left: 50%;
    animation-delay: 4s;
}

.particle:nth-child(4) {
    width: 100px;
    height: 100px;
    left: 70%;
    animation-delay: 1s;
}

.particle:nth-child(5) {
    width: 90px;
    height: 90px;
    left: 85%;
    animation-delay: 3s;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Hero Content Animation */
.hero-content {
    position: relative;
    z-index: 2;
    animation: fadeInUp 1s ease-out;
}

.hero-content h1 {
    animation: fadeInUp 1s ease-out 0.2s both;
}

.hero-content .tagline {
    animation: fadeInUp 1s ease-out 0.4s both;
}

.hero-content .subtitle {
    animation: fadeInUp 1s ease-out 0.6s both;
}

.logo-container img {
    animation: scaleIn 1s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   SCROLL REVEAL ANIMATIONS
   ======================================== */
.fade-in-section {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   ENHANCED CARD ANIMATIONS
   ======================================== */
.category-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    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;
}

.category-card:hover::before {
    left: 100%;
}

.category-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.category-card .card-icon {
    transition: transform 0.4s ease;
}

.category-card:hover .card-icon {
    transform: scale(1.2) rotate(10deg);
}

.card-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.card-btn:hover::after {
    width: 300px;
    height: 300px;
}

/* ========================================
   FEATURES SECTION ANIMATIONS
   ======================================== */
.feature {
    transition: transform 0.3s ease;
}

.feature:hover {
    transform: translateY(-8px);
}

.feature-icon {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.feature:hover .feature-icon {
    animation: spin 0.8s ease;
}

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

/* ========================================
   GLOWING TEXT EFFECT
   ======================================== */
.glow-text {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #7c3aed, 0 0 40px #6d28d9;
    }
    to {
        text-shadow: 0 0 20px #fff, 0 0 30px #a78bfa, 0 0 40px #8b5cf6, 0 0 50px #8b5cf6;
    }
}

/* ========================================
   LOADING SHIMMER EFFECT
   ======================================== */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ========================================
   RIPPLE EFFECT ON BUTTONS
   ======================================== */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.ripple:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 1;
    }
    20% {
        transform: scale(25, 25);
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

/* ========================================
   SECTION DIVIDERS
   ======================================== */
.section-divider {
    height: 4px;
    background: linear-gradient(90deg, transparent, #7c3aed, #6d28d9, transparent);
    margin: 40px 0;
    animation: slideDivider 3s ease-in-out infinite;
}

@keyframes slideDivider {
    0%, 100% {
        transform: translateX(-100px);
    }
    50% {
        transform: translateX(100px);
    }
}

/* ========================================
   MOBILE OPTIMIZATIONS
   ======================================== */
@media (max-width: 768px) {
    .scroll-to-top {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
        font-size: 20px;
    }
    
    .particle {
        display: none; /* Hide particles on mobile for performance */
    }
    
    /* FIX: Force category cards to be visible on mobile (IntersectionObserver issues on iPhone) */
    .fade-in-section {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }
    
    /* Disable complex animations on mobile for better performance */
    .category-card {
        animation: none !important;
    }
    
    .category-card::before {
        animation: none !important;
    }
    
    /* FIX: Ensure icons are visible on mobile - force Apple Color Emoji font */
    .card-icon {
        animation: none !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        font-size: 3.5rem !important;
        margin: 0 auto 15px auto !important;
        position: relative !important;
        z-index: 10 !important;
        font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", "EmojiSymbols", sans-serif !important;
        line-height: 1.2 !important;
        transform: none !important;
        -webkit-text-size-adjust: 100% !important;
        text-align: center !important;
        width: 100% !important;
        height: auto !important;
        min-height: 60px !important;
        color: inherit !important;
        text-rendering: optimizeLegibility !important;
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
    }
    
    /* Force emoji rendering for feature icons too */
    .feature-icon {
        font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif !important;
        display: block !important;
        text-align: center !important;
    }
    
    /* Ensure section headers with emojis also display */
    .category-section h3 {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji" !important;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
