/**
 * =================================================================
 * Elementor Widget: Egns Popular AI Tools - V4 Styles (RESPONSIVE & OPTIMIZED)
 * =================================================================
 * HIDES: Entire Categories Sidebar on Tablet/Mobile (Max-width: 991px) using !important for robustness.
 */

/* --- Define default variables if Elementor controls fail (FOR THEME INTEGRATION) --- */
:root {
    --egns-primary-blue: #1877f2; 
    --egns-primary-pink: #e91e63; 
    --egns-tag-bg: #f0f7ff; 
    --egns-active-blue: #1877f2; 
}

/* -----------------------------------
 * BASE DESKTOP STYLES (Min-width: 992px)
 * ----------------------------------- */

/* Global Widget Container */
.egns-ai-tools-widget--v4 {
    background-color: var(--widget-background-color, var(--section-bg-color2, #f9fbfc)); 
    padding: 30px; 
    margin: 0; 
    max-width: 100%; 
    border-radius: 8px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* Main Layout: Sidebar + Content (Flexbox for Desktop) */
.egns-ai-tools-widget__layout-wrap {
    display: flex;
    gap: 30px; 
}

/* Categories Sidebar (Left Column) */
.egns-ai-tools-categories-sidebar {
    width: 250px; 
    flex-shrink: 0;
}
.egns-ai-tools-categories-sidebar__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--sidebar-title-color, var(--title-color));
    margin-bottom: 20px;
    text-transform: uppercase;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--borderr-color);
}
.egns-ai-tools-categories-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.egns-ai-tools-categories-list__item a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--category-item-color, var(--text-color)); 
    transition: color 0.2s, background-color 0.2s, border-right 0.2s;
    text-decoration: none;
    border-radius: 6px;
    border-right: 3px solid transparent; 
    margin-bottom: 5px; 
}
.egns-ai-tools-categories-list__item a i {
    margin-right: 12px;
    font-size: 1.1em;
    width: 20px; 
    text-align: center;
    color: inherit; 
    transition: color 0.2s;
}
/* Active and Hover States */
.egns-ai-tools-categories-list__item.is-active a,
.egns-ai-tools-categories-list__item a:hover {
    color: var(--category-item-active-color, var(--egns-active-blue)); 
    background-color: rgba(24, 119, 242, 0.08); 
    border-right-color: var(--category-item-active-color, var(--egns-active-blue));
}


/* Tools List (Right Column) */
.egns-ai-tools-list {
    flex-grow: 1;
    list-style: none;
    margin: 0;
    padding: 0;
    width: calc(100% - 280px); 
}
.egns-ai-tools-list__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid var(--item-border-color, var(--borderr-color)); 
    border-radius: 8px;
    background-color: var(--item-background-color, var(--white-color, #ffffff));
}
.egns-ai-tools-list__main-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
    padding-right: 20px; 
}
.egns-ai-tools-list__tool-link {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}
.egns-ai-tools-list__icon-wrap {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    margin-right: 15px;
    border-radius: 6px;
    overflow: hidden;
}
.egns-ai-tools-list__verified {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background-color: var(--verified-badge-bg-color, var(--egns-primary-blue));
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border: 2px solid var(--white-color, #ffffff); 
}
.egns-ai-tools-list__verified i {
    color: var(--verified-badge-icon-color, #ffffff); 
    font-size: 9px; 
}
.egns-ai-tools-list__name {
    font-size: 1.1rem;
    font-weight: 600; 
    color: var(--title-color); 
    margin: 0 0 4px 0;
    line-height: 1.3;
}
.egns-ai-tools-list__desc {
    font-size: 0.9rem;
    color: var(--text-color); 
    margin: 0;
    line-height: 1.5;
}
.egns-ai-tools-list__tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 10px;
    gap: 8px;
}
.egns-ai-tools-list__tag-pill {
    font-size: 0.8rem;
    padding: 4px 8px;
    margin: 0;
    color: var(--tag-pill-color, var(--egns-primary-blue)); 
    background: transparent; 
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
    font-family: var(--font-worksans);
}
.egns-ai-tools-list__tag-pill:hover {
    color: var(--tag-pill-hover-color, var(--egns-primary-pink)); 
    text-decoration: underline;
}
.egns-ai-tools-list__actions-rank {
    display: flex;
    flex-direction: row; 
    align-items: center;
    justify-content: center; 
    flex-shrink: 0;
    gap: 15px; 
    min-width: 120px; 
    border-left: 1px solid var(--borderr-color); 
    padding-left: 20px;
}
.egns-ai-tools-list__ranking {
    display: flex;
    flex-direction: column;
    align-items: center; 
    text-align: center;
    border: 1px solid var(--borderr-color); 
    padding: 8px 12px;
    border-radius: 6px;
    min-width: 60px;
}
.egns-ai-tools-list__ranking-pos {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ranking-text-color, var(--title-color)); 
    margin: 0;
    line-height: 1;
}
.egns-ai-tools-list__ranking-label {
    font-size: 0.7rem; 
    color: var(--ranking-label-color, var(--text-color)); 
    display: block;
    margin-top: 3px;
    line-height: 1;
    text-transform: uppercase;
}
.egns-ai-tools-list__visit-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 35px;
    height: 35px;
    border: 1px solid var(--borderr-color); 
    border-radius: 6px; 
    color: var(--visit-button-color, var(--text-color));
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    font-size: 1rem;
}
.egns-ai-tools-list__visit-btn:hover {
    background-color: var(--visit-button-hover-bg-color, #f0f0f0);
    color: var(--visit-button-hover-color, var(--title-color));
    border-color: var(--borderr-color);
}
.egns-ai-tools-list__item[data-filter-hidden="true"] {
    display: none;
}

/* -----------------------------------
 * TABLET/MOBILE STYLES (Max-width: 991px)
 * HIDES: Entire Sidebar Container
 * ----------------------------------- */
@media (max-width: 991px) {
    .egns-ai-tools-widget--v4 {
        padding: 20px;
    }
    
    /* DEFINITIVE: Hide the entire sidebar container on tablet/mobile */
    .egns-ai-tools-categories-sidebar {
        display: none !important;
    }
    
    /* Since the sidebar is hidden, the main layout must reset to default stacking */
    .egns-ai-tools-widget__layout-wrap {
        flex-direction: column;
        gap: 0; 
    }
    
    /* Tool List now occupies the full width */
    .egns-ai-tools-list {
        width: 100%;
    }
    
    /* Tool Item: Adjust padding and ensure no wrapping issues */
    .egns-ai-tools-list__item {
        padding: 15px;
    }
    
    /* Ranking and Actions: Shrink the margin/padding */
    .egns-ai-tools-list__actions-rank {
        min-width: unset;
        gap: 10px;
        padding-left: 15px;
    }
}


/* -----------------------------------
 * MOBILE ONLY STYLES (Max-width: 767px)
 * ----------------------------------- */
@media (max-width: 767px) {
    .egns-ai-tools-widget--v4 {
        padding: 15px;
    }

    /* Tool Item: Stack the main content and actions vertically */
    .egns-ai-tools-list__item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    /* Ranking and Actions: Move to the bottom, span full width */
    .egns-ai-tools-list__actions-rank {
        width: 100%;
        justify-content: space-between; 
        border-left: none; 
        border-top: 1px solid var(--borderr-color); 
        padding-top: 15px;
        padding-left: 0;
    }
    
    /* Main content area takes full width, no right padding needed */
    .egns-ai-tools-list__main-content {
        width: 100%;
        padding-right: 0;
    }
    
    /* Tool Link: Stack icon and details for narrow screens */
    .egns-ai-tools-list__tool-link {
        flex-wrap: wrap; 
        margin-bottom: 10px;
    }

    /* Icon size reduced slightly for a more compact look */
    .egns-ai-tools-list__icon-wrap {
        width: 35px;
        height: 35px;
        margin-right: 10px;
    }

    /* Tool Name and Description: Reduce font size */
    .egns-ai-tools-list__name {
        font-size: 1rem;
    }
    .egns-ai-tools-list__desc {
        font-size: 0.85rem;
    }
    
    /* Ranking box should be compact */
    .egns-ai-tools-list__ranking {
        padding: 6px 10px;
    }
}