/* ==========================================================================
   SEARCH BAR STYLING (Input & Button)
   ========================================================================== */

.custom-search-group {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 0px !important;
}

.custom-search-input,
.custom-search-button {
    height: 44px !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    line-height: normal !important;
}

.custom-search-input {
    flex: 1 !important;
    font-size: 16px !important;
    padding: 10px !important;
    border: 1px solid #ccc !important;
    background-color: #ffffff !important;
    color: #333333 !important;
    width: 100% !important;
    border-radius: 20px 0px 0px 20px !important;
    text-align: left !important;
    direction: ltr !important;
}

.custom-search-button {
    font-size: 16px !important;
    padding: 10px 15px !important;
    background-color: #2ba9e0 !important;
    color: #fff !important;
    cursor: pointer !important;
    width: auto !important;
    border-radius: 0px 20px 20px 0px !important;
    white-space: nowrap !important;
    margin-left: -1px !important;
    border: none !important;
}

.custom-search-button span {
    display: none !important;
}

.custom-search-button svg {
    width: 20px !important;
    height: 20px !important;
    fill: white !important;
    display: block !important;
}

/* RTL Adjustments for Search Bar */
html[dir="rtl"] .custom-search-input {
    border-radius: 0px 20px 20px 0px !important;
    text-align: right !important;
    direction: rtl !important;
    order: 1 !important;
}

html[dir="rtl"] .custom-search-button {
    margin-left: 0 !important;
    margin-right: -1px !important;
    border-radius: 20px 0px 0px 20px !important;
    order: 2 !important;
}

/* ==========================================================================
   SEARCH RESULTS GRID (The "Catalog Look")
   ========================================================================== */

/* 1. Force the 5-column grid (20%) and fix stretching from long titles */
.custom_product_search_results .row > .col-md-4,
.custom_product_search_results .row > .col-sm-6,
.search-result-column {
    flex: 0 0 20% !important;
    max-width: 20% !important;
    width: 20% !important;
    min-width: 0 !important; /* Forces content to respect width */
    padding: 12px !important; /* Gutter between cards */
    box-sizing: border-box !important;
}

/* 2. Style the Result Card to match Catalog UX (Summer Stripes look) */
.custom_product_search_results .product-teaser-wrap.product-teaser-attribute {
    background: #ffffff !important;
    border: 1px solid #f0f0f0 !important;
    border-radius: 25px !important; /* Rounded corners */
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important; /* Soft shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 15px !important;
}

/* 3. Hover Effect */
.custom_product_search_results .product-teaser-wrap.product-teaser-attribute:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12) !important;
}

/* 4. Typography: Noto Sans & Blue Links */
.custom_product_search_results .product-title-catalog a.product-title-link {
    font-family: 'Noto Sans', sans-serif !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #2ea3d1 !important; /* Catalog Blue */
    line-height: 1.3 !important;
    text-decoration: none !important;
    display: block !important;
    white-space: normal !important; /* Allow wrapping */
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    margin-top: 10px;
}

/* 5. Sub-text (Yarn Content) */
.custom_product_search_results .product-yarn-content {
    font-family: 'Noto Sans', sans-serif !important;
    font-size: 13px !important;
    color: #777 !important;
    margin-top: 5px;
}

/* 6. Strip the Search Module's default Card wrappers */
.custom_product_search_results .card.shadow-sm,
.custom_product_search_results .card-body {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
}

/* 8. Equal height cards - stretch chain */
.custom_product_search_results .row {
    align-items: stretch !important;
}

.block-system-main-block .search-result-column {
    display: flex !important;
    flex-direction: column !important;
}

.block-system-main-block .search-result-column .card {
    height: 100% !important;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 1200px) {
    .custom_product_search_results .row > .col-md-4,
    .search-result-column {
        flex: 0 0 25% !important; /* 4 items */
        max-width: 25% !important;
    }
}

@media (max-width: 991px) {
    .custom_product_search_results .row > .col-md-4,
    .search-result-column {
        flex: 0 0 33.33% !important; /* 3 items */
        max-width: 33.33% !important;
    }
}

@media (max-width: 767px) {
    .custom_product_search_results .row > .col-md-4,
    .search-result-column {
        flex: 0 0 50% !important; /* 2 items */
        max-width: 50% !important;
    }
}