/**
 * FiboSearch Dropdown — Section-Based Layout
 *
 * Styles the FiboSearch (DGWT AJAX Search) dropdown with a two-column
 * grid layout: categories/blog/pages on the left, product grid on the right.
 * Adapted from Austin Natural Mattress reference with Byron Bay Candles branding.
 *
 * The dropdown HTML is restructured by JavaScript (search-dropdown.js) into
 * section-based wrappers (.dgwt-wcas-section-categories, .dgwt-wcas-section-blog,
 * .dgwt-wcas-section-pages, .dgwt-wcas-section-products) with a search-popup-header.
 *
 * @package Blocksy_Child
 * @since   1.0.0
 * @date    2026-04-15
 */

/* ==========================================================================
   1. CONTAINER — Full-width grid with left sidebar + right product area
   ========================================================================== */

body .dgwt-wcas-suggestions-wrapp {
    max-width: 1664px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: auto auto;
    gap: 0;
    box-shadow: rgba(0, 0, 0, 0.12) 8px 8px 16px;
    background: #fff;
    overflow-y: auto;
    max-height: calc(100vh - 150px) !important;
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    padding: 0 16px 16px !important;
    border-radius: 12px !important;
    max-height: 80vh;
}

.dgwt-wcas-suggestions-wrapp.has-search-header {
    grid-template-rows: auto auto auto auto;
}

/* ==========================================================================
   2. SEARCH POPUP HEADER — Title + close button spanning full width
   ========================================================================== */

.dgwt-wcas-suggestions-wrapp .search-popup-header {
    grid-area: 1 / 1 / auto / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 0;
    border-bottom: 1px solid #E1E3E5;
}

.search-popup-title {
    font-size: 14px;
    font-weight: 400;
    color: #888;
    margin: 0;
    line-height: 24px;
}

.search-popup-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #1d1d1f;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.search-popup-close:hover {
    opacity: 1;
}

/* ==========================================================================
   3. GRID ROW ADJUSTMENTS — When header is present, shift rows down
   ========================================================================== */

body .dgwt-wcas-suggestions-wrapp.has-search-header .dgwt-wcas-section-categories {
    grid-area: 2 / 1;
}

body .dgwt-wcas-suggestions-wrapp.has-search-header .dgwt-wcas-section-blog {
    grid-area: 3 / 1;
}

body .dgwt-wcas-suggestions-wrapp.has-search-header .dgwt-wcas-section-pages {
    grid-area: 4 / 1;
}

body .dgwt-wcas-suggestions-wrapp.has-search-header .dgwt-wcas-section-products {
    grid-area: 2 / 2 / span 3;
}

/* ==========================================================================
   4. SECTION POSITIONING — Left column sections + right product area
   ========================================================================== */

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-categories {
    grid-area: 1 / 1;
    padding: 0 24px 0 0;
    box-sizing: border-box;
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-blog {
    grid-area: 2 / 1;
    padding: 20px 24px 0 0;
    border-top: 1px solid #E4E5E7;
    margin-top: 20px;
    box-sizing: border-box;
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-pages {
    grid-area: 3 / 1;
    padding: 20px 24px 0 0;
    border-top: 1px solid #E4E5E7;
    margin-top: 20px;
    box-sizing: border-box;
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-products {
    grid-area: 1 / 2 / span 3;
    min-width: 0;
    padding-left: 24px;
    border-left: 1px solid #E4E5E7;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: visible;
    
}

/* ==========================================================================
   5. SECTION TITLES — Byron Bay Candles palette
   ========================================================================== */

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-title {
    font-family: 'Museo Sans', var(--theme-body-font-family, sans-serif);
    font-weight: 400;
    font-size: 18px;
    color: var(--theme-palette-color-4, #888);
    line-height: 40px;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   6. CATEGORY / BLOG / PAGE ITEMS
   ========================================================================== */

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion {
    line-height: 24px;
    padding: 6px 0;
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion:hover {
    text-decoration: none !important;
}
/* Disable FiboSearch JS-managed hover — it tracks element indices which break
   after our DOM restructure. Use pure CSS :hover instead. */
body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion.dgwt-wcas-suggestion-selected {
    background-color: transparent !important;
}

/* Category/post/page items — highlight on actual mouse hover */
body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-categories .dgwt-wcas-suggestion:hover .dgwt-wcas-st,
body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-blog .dgwt-wcas-suggestion:hover .dgwt-wcas-st,
body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-pages .dgwt-wcas-suggestion:hover .dgwt-wcas-st {
    color: var(--theme-palette-color-1, #111) !important;
    text-decoration: underline;
}


body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-categories .dgwt-wcas-suggestion .dgwt-wcas-st {
    font-family: 'Museo Sans', var(--theme-body-font-family, sans-serif);
    font-weight: 500;
    font-size: 16px;
    color: var(--theme-palette-color-2, #393939);
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-blog .dgwt-wcas-suggestion .dgwt-wcas-st {
    font-family: 'Museo Sans', var(--theme-body-font-family, sans-serif);
    font-weight: 500;
    font-size: 16px;
    color: var(--theme-palette-color-2, #393939);
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-categories .dgwt-wcas-st-breadcrumbs {
    display: none;
}

/* ==========================================================================
   7. PRODUCT GRID — 4 columns
   ========================================================================== */

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-products .dgwt-wcas-section-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* ==========================================================================
   8. PRODUCT CARDS — Vertical layout with image + content
   ========================================================================== */

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion.dgwt-wcas-suggestion-product {
    display: flex;
    flex-direction: column;
    border: none;
    padding: 0;
    border-radius: 0;
    background: #fff;
    overflow: hidden !important;
    resize: none !important;
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion.dgwt-wcas-suggestion-product .dgwt-wcas-si {
    width: 100% !important;
    height: 180px !important;
    min-height: 180px !important;
    max-height: 180px !important;
    overflow: hidden !important;
    max-width: none !important;
    flex-shrink: 0 !important;
    border-radius: 5px;
    background: #fff;
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion.dgwt-wcas-suggestion-product .dgwt-wcas-si img {
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 180px !important;
    object-fit: contain !important;
    object-position: center !important;
    border-radius: 5px !important;
    transition: transform 0.3s ease;
}
/* Product card hover — scale image matching homepage Favourite Buys effect */
body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion.dgwt-wcas-suggestion-product:hover .dgwt-wcas-si img {
    transform: scale(1.05);
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion.dgwt-wcas-suggestion-product .dgwt-wcas-content-wrapp {
    flex-direction: column;
    padding: 4px 0;
    row-gap: 2px;
    width: 100%;
    align-items: flex-start;
    text-align: left;
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion.dgwt-wcas-suggestion-product .dgwt-wcas-content-wrapp .dgwt-wcas-sp {
    padding-left: 0;
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-product .dgwt-wcas-sd {
    display: none;
}

/* ==========================================================================
   9. PRODUCT TITLE & PRICE — Byron Bay Candles palette
   ========================================================================== */

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-product .dgwt-wcas-st {
    font-family: 'Museo Sans', var(--theme-body-font-family, sans-serif);
    font-weight: 700;
    font-size: 16px;
    color: var(--theme-palette-color-2, #393939);
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-product .dgwt-wcas-sp .woocommerce-Price-amount {
    font-family: 'Museo Sans', var(--theme-body-font-family, sans-serif);
    font-weight: 500;
    font-size: 14px;
    color: var(--theme-palette-color-2, #393939);
    line-height: 24px;
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion.dgwt-wcas-suggestion-product .dgwt-wcas-sp {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    justify-content: flex-start;
    text-align: left;
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-product .dgwt-wcas-sp > span {
    display: inline !important;
}

/* ==========================================================================
   10. VIEW ALL BUTTON — Byron Bay brown accent
   ========================================================================== */

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-products .dgwt-wcas-view-all {
    background-color: var(--theme-palette-color-3, #746A5F);
    font-family: 'Museo Sans', var(--theme-body-font-family, sans-serif);
    font-weight: 700;
    font-size: 16px;
    line-height: 30px;
    transition: background-color 0.15s;
    color: #fff !important;
    text-decoration: none !important;
    text-transform: uppercase !important;
    display: inline-flex !important;
    align-items: center !important;
    align-self: flex-start !important;
    width: auto !important;
    gap: 6px !important;
    height: 30px !important;
    padding: 0 16px !important;
    border-radius: 6px !important;
    margin-top: 0 !important;
}

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-products .dgwt-wcas-view-all:hover {
    background-color: var(--theme-palette-color-1, #111);
}

/* ==========================================================================
   11. RESET FIBOSEARCH DEFAULTS
   ========================================================================== */

body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-product .dgwt-wcas-sp ins {
    text-decoration: none;
}

/* ==========================================================================
   12. MOBILE — Tablet and below (max-width: 999px)
   ========================================================================== */

@media (max-width: 999px) {
    body .dgwt-wcas-suggestions-wrapp {
        overflow: visible;
        
        grid-template-columns: 1fr !important;
        padding: 24px !important;
        border-radius: 12px !important;
        box-shadow: rgba(0, 0, 0, 0.12) 0 8px 40px !important;
        background: #fff !important;
    }

    body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-section {
        margin-bottom: 16px;
    }

    body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-suggestion-section + .dgwt-wcas-suggestion-section {
        border-top: 1px solid #ededed;
        padding-top: 16px;
    }

    body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-categories,
    body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-blog,
    body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-pages {
        border-right: none;
        padding-right: 0;
    }

    body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-products {
        border-left: none;
        padding-left: 0;
    }

    body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-products .dgwt-wcas-section-content,
    body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-layout-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 13px !important;
    }

    .dgwt-wcas-overlay-mobile-on .dgwt-wcas-suggestions-wrapp .search-popup-header {
        display: none;
    }

    .dgwt-wcas-overlay-mobile-on .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-categories,
    .dgwt-wcas-overlay-mobile-on .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-blog,
    .dgwt-wcas-overlay-mobile-on .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-products {
        grid-column: 1;
        border-right: none;
        padding-right: 0;
    }
}

/* ==========================================================================
   13. MOBILE SMALL — Phone (max-width: 689px) and narrow (max-width: 425px)
   ========================================================================== */

@media (max-width: 689px) {
    body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-section-products .dgwt-wcas-section-content,
    body .dgwt-wcas-suggestions-wrapp .dgwt-wcas-layout-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 425px) {
    body .dgwt-wcas-suggestions-wrapp {
        padding: 20px 16px 16px !important;
    }
}
