/**
 * Apollo.io Style Sticky Scrolling - CORRECTED CSS
 * 
 * This implementation uses CSS sticky positioning like the real Apollo.io
 * Key insight: height: 500vh creates the scroll space for the sticky effect
 */

/* Smooth scrolling for the entire document */
html {
    scroll-behavior: smooth;
}

/* Apollo Sticky Section - THE KEY CONTAINER */
.apollo-sticky-section {
    /* This creates the large scroll area - the key to Apollo's approach! */
    height: 500vh; /* 500% viewport height - this is crucial! */
    position: relative;
    background: #ffffff;
    z-index: 10;
}

/* Sticky Container - This stays fixed while scrolling through the 500vh area */
.apollo-sticky-container {
    position: sticky;
    top: 0; /* Adjust based on your header height */
    height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: flex;
    flex-direction: column;
    z-index: 100;
    /* Performance optimization */
    contain: paint;
    will-change: transform;
}

/* Tab Navigation - Horizontal across the top (Apollo.io style) */
.apollo-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 20px 40px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.apollo-tab {
    flex: 1;
    max-width: 250px;
    text-align: center;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #94a3b8;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.apollo-tab:first-child {
    border-radius: 12px 0 0 12px;
}

.apollo-tab:last-child {
    border-radius: 0 12px 12px 0;
}

.apollo-tab:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: translateY(-2px);
}

.apollo-tab.active {
    background: linear-gradient(135deg, var(--tab-color, #10b981) 0%, var(--tab-color-dark, #059669) 100%);
    color: #ffffff;
    border-color: var(--tab-color, #10b981);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transform: translateY(-4px);
}

/* Tab Colors - Customize for your features */
.apollo-tab[data-feature="pipeline"] {
    --tab-color: #10b981;
    --tab-color-dark: #059669;
}

.apollo-tab[data-feature="call"] {
    --tab-color: #ef4444;
    --tab-color-dark: #dc2626;
}

.apollo-tab[data-feature="data"] {
    --tab-color: #3b82f6;
    --tab-color-dark: #2563eb;
}

.apollo-tab[data-feature="platform"] {
    --tab-color: #f59e0b;
    --tab-color-dark: #d97706;
}

/* Content Area */
.apollo-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
}

/* Feature Content Sections */
.feature-content {
    display: none;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    color: white;
    animation: fadeIn 0.6s ease-in-out;
}

.feature-content.active {
    display: block;
}

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

/* Feature Icons */
.feature-icon {
    font-size: 6rem;
    margin-bottom: 32px;
    filter: drop-shadow(0 4px 20px rgba(0,0,0,0.3));
    animation: float 3s ease-in-out infinite;
}

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

/* Feature Titles */
.feature-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    line-height: 1.1;
    background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Feature Descriptions */
.feature-description {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #cbd5e1;
    margin-bottom: 48px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Feature Stats */
.feature-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-top: 48px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--tab-color, #10b981);
}

.stat-label {
    font-size: 0.9rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* CTA Buttons */
.apollo-cta {
    margin-top: 48px;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 18px 36px;
    background: linear-gradient(135deg, var(--tab-color, #10b981) 0%, var(--tab-color-dark, #059669) 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    color: white;
}

/* Background Animation */
.apollo-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%);
    animation: rotate 20s linear infinite;
    opacity: 0.5;
    z-index: -1;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .apollo-tabs {
        flex-direction: column;
        gap: 8px;
        padding: 16px 20px;
    }
    
    .apollo-tab {
        max-width: none;
        border-radius: 8px !important;
    }
    
    .feature-title {
        font-size: 2.5rem;
    }
    
    .feature-icon {
        font-size: 4rem;
    }
    
    .feature-stats {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .apollo-content {
        padding: 40px 20px;
    }
    
    /* Reduce sticky section height on mobile for better UX */
    .apollo-sticky-section {
        height: 300vh;
    }
}

/* Tablet Responsive */
@media (max-width: 1024px) and (min-width: 769px) {
    .apollo-tabs {
        padding: 18px 30px;
    }
    
    .apollo-tab {
        max-width: 200px;
        font-size: 0.85rem;
        padding: 14px 20px;
    }
    
    .feature-title {
        font-size: 3rem;
    }
    
    .apollo-content {
        padding: 50px 30px;
    }
}

/* Smooth transitions for all elements */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    .feature-content,
    .apollo-tab,
    .stat-card,
    .feature-icon,
    .apollo-content::before {
        animation: none !important;
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .apollo-tab {
        border-width: 2px;
    }
    
    .apollo-tab.active {
        border-width: 3px;
    }
    
    .stat-card {
        border-width: 2px;
    }
}

/* WordPress Theme Integration */
.apollo-sticky-section h1,
.apollo-sticky-section h2,
.apollo-sticky-section h3,
.apollo-sticky-section h4,
.apollo-sticky-section h5,
.apollo-sticky-section h6 {
    color: inherit;
    font-family: inherit;
}

.apollo-sticky-section p {
    color: inherit;
    font-family: inherit;
}

.apollo-sticky-section a {
    color: inherit;
    text-decoration: none;
}

/* Ensure proper z-index stacking */
.apollo-sticky-section {
    z-index: 10;
}

.apollo-sticky-container {
    z-index: 100;
}

/* Performance optimizations */
.apollo-sticky-container,
.apollo-content,
.feature-content {
    transform: translateZ(0); /* Force hardware acceleration */
}

/**
 * USAGE INSTRUCTIONS:
 * 
 * 1. Add this CSS to your WordPress theme
 * 2. Create HTML structure with classes:
 *    - .apollo-sticky-section (main container with 500vh height)
 *    - .apollo-sticky-container (sticky container)
 *    - .apollo-tabs (tab navigation)
 *    - .apollo-tab (individual tabs)
 *    - .apollo-content (content area)
 *    - .feature-content (individual feature content)
 * 
 * 3. Include the corrected JavaScript file
 * 4. The section will automatically become sticky and work like Apollo.io
 * 
 * Key differences from the original broken implementation:
 * - Uses CSS sticky positioning instead of JavaScript scroll hijacking
 * - Uses 500vh height to create scroll space
 * - Much simpler and more performant
 * - Better accessibility and mobile support
 */

