/**
 * AC Home Page Pro - Niches Module
 * Full-Width Niche Showcase with Rich Interactive Tooltips
 * Version: 1.2.2 - FINAL Mobile Override Fix
 */

/* Main Container - Full Width */
.ac-hp-niches {
    width: 100%;
    background-color: #F8F9FA;
    padding: 80px 0;
    position: relative;
}

.ac-hp-niches-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.ac-hp-niches-content {
    width: 100%;
}

/* Header */
.ac-hp-niches-header {
    text-align: center;
    margin-bottom: 50px;
}

.ac-hp-niches-title {
    font-size: 42px;
    font-weight: 700;
    color: #2a2a2a;
    margin: 0 0 16px 0;
    line-height: 1.2;
}

.ac-hp-niches-subtitle {
    font-size: 18px;
    color: rgba(42, 42, 42, 0.7);
    margin: 0;
    max-width: 700px;
    margin: 0 auto;
}

/* Niche Pills Grid */
.ac-hp-niches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 50px;
}

/* Individual Niche Pill */
.ac-hp-niche-pill {
    position: relative;
    background: #FFFFFF;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ac-hp-niche-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.ac-hp-niche-name {
    font-size: 15px;
    font-weight: 500;
    color: #2a2a2a;
    line-height: 1.4;
    flex: 1;
}

.ac-hp-niche-badge {
    font-size: 16px;
    margin-left: auto;
    animation: pulse 2s infinite;
}

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

/* Tooltip Container - Desktop Default */
.ac-hp-niche-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: #FFFFFF;
    border: 2px solid #7FE8AC;
    border-radius: 16px;
    padding: 20px;
    width: 350px;
    max-width: 90vw;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    margin-bottom: 15px;
}

/* Tooltip Arrow - Desktop */
.ac-hp-niche-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-top-color: #7FE8AC;
}

/* Tooltip Header */
.ac-hp-niche-tooltip-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #F8F9FA;
}

.ac-hp-niche-tooltip-icon {
    font-size: 28px;
}

.ac-hp-niche-tooltip-header h4 {
    font-size: 18px;
    font-weight: 700;
    color: #2a2a2a;
    margin: 0;
    flex: 1;
}

.ac-hp-niche-tooltip-badge {
    font-size: 12px;
    background: linear-gradient(135deg, #FF6B6B, #FFB347);
    color: #FFFFFF;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* Tooltip Sections */
.ac-hp-niche-tooltip-section {
    margin-bottom: 14px;
}

.ac-hp-niche-tooltip-section h5 {
    font-size: 13px;
    font-weight: 600;
    color: #2a2a2a;
    margin: 0 0 8px 0;
}

.ac-hp-niche-tooltip-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ac-hp-niche-tooltip-section li {
    font-size: 13px;
    color: rgba(42, 42, 42, 0.8);
    padding: 4px 0;
    line-height: 1.5;
    position: relative;
    padding-left: 16px;
}

.ac-hp-niche-tooltip-section li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #7FE8AC;
    font-weight: bold;
    font-size: 16px;
}

.ac-hp-niche-platforms li {
    font-style: italic;
}

.ac-hp-niche-more {
    color: #7FE8AC !important;
    font-weight: 600;
    font-style: italic;
}

/* Tooltip Footer */
.ac-hp-niche-tooltip-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 2px solid #F8F9FA;
}

.ac-hp-niche-creators,
.ac-hp-niche-rate {
    font-size: 13px;
    font-weight: 600;
    color: #2a2a2a;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Dual CTA Section */
.ac-hp-niches-cta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.ac-hp-niches-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 18px 40px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
}

.ac-hp-niches-cta-creator {
    background: #7FE8AC;
    color: #2a2a2a;
}

.ac-hp-niches-cta-creator:hover {
    background: #5FD89C;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(127, 232, 172, 0.3);
}

.ac-hp-niches-cta-brand {
    background: #FFEF81;
    color: #2a2a2a;
}

.ac-hp-niches-cta-brand:hover {
    background: #FFE761;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 239, 129, 0.3);
}

/* Responsive Design - Tablet */
@media (max-width: 968px) {
    .ac-hp-niches {
        padding: 60px 0;
    }

    .ac-hp-niches-title {
        font-size: 36px;
    }

    .ac-hp-niches-subtitle {
        font-size: 16px;
    }

    .ac-hp-niches-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
    }

    .ac-hp-niche-pill {
        padding: 14px 16px;
    }

    .ac-hp-niche-icon {
        font-size: 20px;
    }

    .ac-hp-niche-name {
        font-size: 14px;
    }

    .ac-hp-niche-tooltip {
        width: 320px;
    }

    .ac-hp-niches-cta-btn {
        padding: 16px 32px;
        font-size: 16px;
    }
}

/* DESKTOP HOVER EFFECTS - Only for screens > 640px */
@media (min-width: 641px) {
    .ac-hp-niche-pill:hover {
        transform: translateY(-4px);
        border-color: #7FE8AC;
        box-shadow: 0 8px 20px rgba(127, 232, 172, 0.2);
        background: linear-gradient(135deg, #7FE8AC 0%, #FFEF81 100%);
    }

    .ac-hp-niche-pill:hover .ac-hp-niche-name {
        color: #2a2a2a;
        font-weight: 600;
    }

    .ac-hp-niche-pill:hover .ac-hp-niche-tooltip {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(-50%) translateY(0);
    }

    .ac-hp-niche-pill:focus {
        outline: 3px solid #7FE8AC;
        outline-offset: 2px;
    }

    .ac-hp-niche-pill:focus .ac-hp-niche-tooltip {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(-50%) translateY(0);
    }
}

/* ═══════════════════════════════════════════════════════════ */
/* MOBILE OPTIMIZATIONS - 2 Column Grid + Full-Width Tooltip   */
/* ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
    .ac-hp-niches {
        padding: 50px 0;
    }

    .ac-hp-niches-title {
        font-size: 26px;
        padding: 0 10px;
    }

    .ac-hp-niches-subtitle {
        font-size: 14px;
        padding: 0 10px;
    }

    /* 2 COLUMN GRID ON MOBILE */
    .ac-hp-niches-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
        padding: 0 10px;
    }

    /* Mobile Pill Styling */
    .ac-hp-niche-pill {
        padding: 12px 10px;
        flex-direction: column;
        text-align: center;
        gap: 6px;
        min-height: 100px;
        justify-content: center;
    }

    /* Disable hover on mobile */
    .ac-hp-niche-pill:hover {
        transform: none !important;
        border-color: #E5E7EB !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
        background: #FFFFFF !important;
    }

    .ac-hp-niche-icon {
        font-size: 32px;
    }

    .ac-hp-niche-name {
        font-size: 12px;
        line-height: 1.3;
        font-weight: 500;
    }

    .ac-hp-niche-badge {
        position: absolute;
        top: 6px;
        right: 6px;
        font-size: 14px;
    }

    /* ═══════════════════════════════════════════════════════════ */
    /* FULL-WIDTH MOBILE TOOLTIP - CRITICAL STYLES                 */
    /* ═══════════════════════════════════════════════════════════ */

    /* Reset ALL desktop tooltip styles for mobile */
    .ac-hp-niche-tooltip {
        /* Force fixed positioning */
        position: fixed !important;

        /* Full screen width from bottom */
        bottom: 0 !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;

        /* Remove desktop positioning */
        transform: translateY(100%) !important;
        margin: 0 !important;

        /* Full width */
        width: 100% !important;
        max-width: 100% !important;

        /* Height and scroll */
        max-height: 70vh !important;
        overflow-y: auto !important;

        /* Styling */
        border-radius: 20px 20px 0 0 !important;
        padding: 24px 20px 30px 20px !important;
        border: none !important;
        border-top: 3px solid #7FE8AC !important;

        /* Animation */
        transition: transform 0.3s ease-out, opacity 0.3s ease-out !important;

        /* Hidden by default */
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* Override ALL hover effects on mobile */
    .ac-hp-niche-pill:hover .ac-hp-niche-tooltip {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateY(100%) !important;
    }

    /* Show tooltip ONLY when active class is present */
    .ac-hp-niche-pill.active .ac-hp-niche-tooltip {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: translateY(0) !important;
        z-index: 1001 !important;
    }

    /* Remove desktop arrow on mobile */
    .ac-hp-niche-tooltip::after {
        display: none !important;
    }

    /* Mobile tooltip header - larger */
    .ac-hp-niche-tooltip-header {
        margin-bottom: 20px;
        padding-bottom: 16px;
    }

    .ac-hp-niche-tooltip-header h4 {
        font-size: 20px;
        line-height: 1.3;
    }

    .ac-hp-niche-tooltip-icon {
        font-size: 32px;
    }

    /* Mobile tooltip sections - better spacing */
    .ac-hp-niche-tooltip-section {
        margin-bottom: 18px;
    }

    .ac-hp-niche-tooltip-section h5 {
        font-size: 14px;
        margin-bottom: 10px;
        font-weight: 700;
    }

    .ac-hp-niche-tooltip-section li {
        font-size: 14px;
        padding: 6px 0;
        line-height: 1.6;
        padding-left: 18px;
    }

    .ac-hp-niche-tooltip-section li::before {
        font-size: 18px;
    }

    /* Mobile tooltip footer */
    .ac-hp-niche-tooltip-footer {
        margin-top: 20px;
        padding-top: 16px;
        flex-direction: row;
        justify-content: space-between;
        gap: 12px;
    }

    .ac-hp-niche-creators,
    .ac-hp-niche-rate {
        font-size: 14px;
    }

    /* CTA buttons mobile */
    .ac-hp-niches-cta {
        flex-direction: column;
        gap: 14px;
        padding: 0 20px;
    }

    .ac-hp-niches-cta-btn {
        width: 100%;
        max-width: 400px;
        padding: 16px 24px;
        font-size: 16px;
    }

    /* Dark Backdrop for Mobile Tooltips */
    .ac-hp-niche-pill.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 999;
        animation: fadeIn 0.3s ease;
    }
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Loading Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ac-hp-niche-pill {
    animation: fadeInUp 0.5s ease backwards;
}

.ac-hp-niche-pill:nth-child(1) { animation-delay: 0.05s; }
.ac-hp-niche-pill:nth-child(2) { animation-delay: 0.1s; }
.ac-hp-niche-pill:nth-child(3) { animation-delay: 0.15s; }
.ac-hp-niche-pill:nth-child(4) { animation-delay: 0.2s; }
.ac-hp-niche-pill:nth-child(5) { animation-delay: 0.25s; }
