/**
 * Multicolumn Pricing Table Toggle Functionality - Mobile Only
 * Hides benefits by default and allows expand/collapse functionality
 * Button text changes between "View Benefits" and "Hide Benefits" based on state
 * 
 * Applies ONLY to #table-plan (Essential Blocks Multicolumn Pricing Table)
 * Does NOT affect the standard pricing table toggle functionality
 * 
 * @package SavingsXL
 * @since 1.0.0
 */

/* ========================================
   Hide toggle button on desktop by default
   ======================================== */
#table-plan .view-benefits-toggle-mcpt {
    display: none !important;
}

/* ========================================
   Ensure benefits are visible on desktop
   ======================================== */
@media (min-width: 993px) {
    #table-plan .eb-mcpt-benefits-wrapper {
        display: block !important;
    }
}

/* ========================================
   MOBILE: Toggle functionality (≤992px)
   ======================================== */
@media (max-width: 992px) {
    
    /* Hide benefits wrapper by default on mobile */
    #table-plan .eb-mcpt-benefits-wrapper {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.4s ease-out, opacity 0.3s ease-out;
    }
    
    /* Show benefits when expanded */
    #table-plan .eb-mcpt-benefits-wrapper.expanded {
        max-height: 2000px; /* 20 cells × 81px = ~1620px, 2000px gives safety margin */
        opacity: 1;
        transition: max-height 0.5s ease-in, opacity 0.4s ease-in;
    }
    
    /* Animate individual benefit cells */
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell {
        animation: fadeInUpMulticolumn 0.4s ease-out forwards;
        opacity: 0;
        height: 60px !important;
    }
    
    /* Stagger animation for each cell (20 items total) */
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(1)  { animation-delay: 0.05s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(2)  { animation-delay: 0.08s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(3)  { animation-delay: 0.11s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(4)  { animation-delay: 0.14s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(5)  { animation-delay: 0.17s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(6)  { animation-delay: 0.20s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(7)  { animation-delay: 0.23s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(8)  { animation-delay: 0.26s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(9)  { animation-delay: 0.29s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(10) { animation-delay: 0.32s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(11) { animation-delay: 0.35s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(12) { animation-delay: 0.38s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(13) { animation-delay: 0.41s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(14) { animation-delay: 0.44s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(15) { animation-delay: 0.47s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(16) { animation-delay: 0.50s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(17) { animation-delay: 0.53s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(18) { animation-delay: 0.56s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(19) { animation-delay: 0.59s; }
    #table-plan .eb-mcpt-benefits-wrapper.expanded .eb-mcpt-cell:nth-child(20) { animation-delay: 0.62s; }
    
    /* Keyframe animation - Fade in from bottom */
    @keyframes fadeInUpMulticolumn {
        from {
            opacity: 0;
            transform: translateY(10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* ========================================
       "View Benefits" / "Hide Benefits" toggle button
       ======================================== */
    #table-plan .view-benefits-toggle-mcpt {
        display: block !important;
        margin-top: 12px;
        margin-bottom: 8px;
        text-align: center;
        cursor: pointer;
        font-size: 1rem;
        font-family: inherit;
        padding: 8px 0;
        transition: opacity 0.3s ease;
    }
    
    #table-plan .view-benefits-toggle-mcpt:hover {
        opacity: 0.8;
    }
    
    #table-plan .view-benefits-toggle-mcpt .toggle-text {
        font-weight: 400 !important;
        font-style: normal !important;
    }
    
    /* Override any inherited font-weight from Essential Blocks - Maximum specificity */
    #table-plan .eb-mcpt-column .view-benefits-toggle-mcpt,
    #table-plan .eb-mcpt-column .view-benefits-toggle-mcpt .toggle-text,
    #table-plan .eb-mcpt-column .view-benefits-toggle-mcpt span,
    #table-plan .eb-mcpt-wrap .view-benefits-toggle-mcpt .toggle-text,
    #table-plan .eb-mcpt-column:not(.eb-mcpt-column-active) .view-benefits-toggle-mcpt .toggle-text,
    #table-plan .eb-mcpt-column.eb-mcpt-column-active .view-benefits-toggle-mcpt .toggle-text {
        font-weight: 400 !important;
        font-style: normal !important;
    }
    
    /* Force normal weight on all states */
    #table-plan .view-benefits-toggle-mcpt .toggle-text,
    #table-plan .view-benefits-toggle-mcpt span.toggle-text {
        font-weight: 400 !important;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* ========================================
       Style differentiation by plan type
       ======================================== */
    
    /* Regular plans (Essential XL, Premium XL) */
    #table-plan .eb-mcpt-column:not(.eb-mcpt-column-active) .view-benefits-toggle-mcpt {
        color: #333333;
    }
    
    /* Featured plan (Elite XL - Most Popular) */
    #table-plan .eb-mcpt-column.eb-mcpt-column-active .view-benefits-toggle-mcpt {
        color: #333333;
    }
    
    /* Adjust header spacing when toggle button is present */
    #table-plan .eb-mcpt-header {
        padding-bottom: 0 !important;
    }
}

/* ========================================
   Mobile Extra Small (≤480px)
   ======================================== */
@media (max-width: 480px) {
    /* Reduce font size on very small screens if needed */
    #table-plan .view-benefits-toggle-mcpt {
        font-size: 0.95rem;
    }
}
