/*
 * Live Search Custom Styles for Electro Child Theme
*/
.tt-menu {
    background: transparent;
}

.tt-dataset.tt-dataset-search {
    /* Positioning & Sizing */
    position: absolute !important;
    width: 100% !important;
    /* Match the width of the search input container */
    top: 100% !important;
    left: auto !important;
    right: 0 !important;
    z-index: 99999 !important;

    /* Appearance */
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    padding: 10px;

    /* Grid Layout */
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    /* Reduced gap */
    max-height: 60vh;
    overflow-y: auto;
}

/* Individual suggestion item - styled as a compact product card */
.tt-suggestion {
    display: block;
    padding: 6px !important;
    /* Reduced padding for compact size */
    border: 1px solid #eee;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    background-color: #fff;
    min-height: 90px;
    /* Compact height */
}

/* Hover state for the suggestion card */
.tt-suggestion.tt-cursor,
.tt-suggestion:hover {
    background-color: #f9f9f9 !important;
    border-color: #0088e2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* The link wrapper inside the suggestion */
.tt-suggestion a {
    display: flex;
    flex-direction: column;
    /* Vertical layout: image top, content bottom */
    align-items: flex-start;
    /* Align everything to start (left) */
    text-align: left;
    /* Text alignment to left */
    color: inherit;
    text-decoration: none;
    height: 100%;
    padding: 0;
}

/* Product image - matches template structure */
.tt-suggestion .media-left,
.tt-suggestion img.media-left {
    margin: 0 0 4px 0;
    /* Reduced margin below the image */
    width: 100%;
    display: flex;
    justify-content: center;
    /* Center the image */
    align-items: center;
    flex-shrink: 0;
}

.tt-suggestion .media-left,
.tt-suggestion img.media-left,
.tt-suggestion .media-object {
    width: 60px !important;
    /* Increased image size for better visibility */
    height: 60px !important;
    /* Increased height for better proportion */
    object-fit: contain !important;
    /* Maintain aspect ratio */
    object-position: center !important;
    max-width: 60px !important;
    max-height: 60px !important;
}

/* Product details container */
.tt-suggestion .media-body {
    flex-grow: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    /* Align all content to start (left) */
    padding-left: 0;
    /* Remove any left padding */
}

/* Product title - matches media-heading from template */
.tt-suggestion .media-heading {
    font-size: 0.85em;
    /* Smaller font size */
    font-weight: 600;
    margin-bottom: 4px;
    /* Reduced margin */
    color: #333;
    word-break: break-word;
    /* Single line */
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    /* Tighter line height */
    width: 100%;
    text-align: left;
    /* Align title to the left */
    padding-left: 0;
    /* Ensure no left padding */
    margin-left: 0;
    /* Ensure no left margin */
}

/* Container for price and stock - matches product-meta from template */
.tt-suggestion .product-meta {
    display: flex;
    flex-direction: column;
    /* Stack vertically */
    align-items: flex-start;
    /* Align to start (left) */
    justify-content: flex-start;
    /* Align to start (top) */
    width: 100%;
    gap: 2px;
    /* Small gap between price and stock */
    margin-top: auto;
    /* Push to bottom */
}

/* Price and stock row - matches price-stock-row from template */
.tt-suggestion .price-stock-row {
    display: flex;
    flex-direction: column;
    /* Stack price and stock vertically */
    justify-content: flex-start;
    /* Align to start (top) */
    align-items: flex-start;
    /* Align to start (left) */
    width: 100%;
    gap: 2px;
    /* Small gap between price and stock */
}

/* Price styling - matches price-wrapper from template */
.tt-dataset-search .price-wrapper {
    font-size: 1.3em !important;
    /* Smaller font size */
    font-weight: 600 !important;
    color: rgb(18, 70, 171) !important;
    margin: 0 !important;
    width: 100%;
    /* Take full width */
    text-align: left;
    /* Align to left */
    display: block;
    /* Block display for full width */
    padding-left: 0 !important;
    /* Ensure no left padding */
    margin-left: 0 !important;
    /* Ensure no left margin */
}

.tt-suggestion .price-wrapper del {
    font-size: 0.65em;
    color: #999 !important;
    margin-left: 0px;
    text-decoration: line-through !important;
}

/* Sale price - new price (ins element) */
.tt-suggestion .price-wrapper ins {
    color: #ff0017 !important;
    text-decoration: none !important;
    font-weight: 600 !important;
}

/* Stock status styling - matches product-stock from template */
.tt-suggestion .product-stock {
    font-size: 0.85em;
    /* Smaller font size */
    white-space: nowrap;
    font-weight: 500;
    width: 100%;
    /* Take full width */
    text-align: left;
    /* Align to left */
    display: block;
    /* Block display for full width */
}

.tt-suggestion .product-stock.in-stock {
    color:  #09c431 !important;
    font-weight: normal !important;
}

/* Out of stock styling - IMPORTANT: Higher specificity to prevent style.css override */
.tt-dataset.tt-dataset-search .tt-suggestion .product-stock.out-of-stock {
    color: #ff0017 !important;
    font-weight: 500 !important;
    font-size: 0.85em !important;
    /* Keep consistent with normal stock size */
}

/* --- Responsive Adjustments --- */

/* Desktop - Always 3 columns */
@media (min-width: 768px) {
    .tt-dataset.tt-dataset-search {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px;
        /* Reduced gap */
        padding: 10px;
        /* Reduced padding */
    }

    .tt-suggestion {
        min-height: 90px;
        /* Compact height for desktop */
    }
}

/* Tablets - 2 columns */
@media (max-width: 767px) {
    .tt-dataset.tt-dataset-search {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0 !important;
        padding: 0 !important;
    }
    .tt-suggestion {
        min-height: unset;
        height: 90%;
        padding: 4px !important;
        margin: 5px !important;
        box-sizing: border-box;
        display: flex;
        flex-direction: row;
        justify-content: stretch;
    }
    .tt-suggestion a {
        flex-direction: row !important;
        align-items: flex-start !important;
        height: 100%;
        width: 100%;
        padding: 0;
    }
    .tt-suggestion .media-left,
    .tt-suggestion img.media-left,
    .tt-suggestion .media-object {
        width: 44px !important;
        height: 44px !important;
        max-width: 44px !important;
        max-height: 44px !important;
        margin: 0 8px 0 0 !important;
        display: block;
    }
    .tt-suggestion .media-body {
        width: calc(100% - 52px);
        padding-left: 0;
        margin-left: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
    }
    .tt-suggestion .media-heading {
        font-size: 0.75em;
        margin-bottom: 0.1em;
        white-space: normal !important;
        overflow: visible;
        text-overflow: unset;
        line-height: 1.2;
        word-break: break-word;
        display: block;
    }
    .tt-suggestion .product-meta {
        gap: 0.1em;
        margin-top: 0.1em;
    }
    .tt-suggestion .price-stock-row {
        gap: 0em;
    }
    .tt-dataset-search .price-wrapper {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }
    .tt-suggestion .product-stock {
        margin-top: 0 !important;
        font-size: 12px !important;
        font-weight: 540 !important;
    }
    /* Ensure out-of-stock maintains same size in mobile */
    .tt-dataset.tt-dataset-search .tt-suggestion .product-stock.out-of-stock {
        font-size: 12px !important;
        font-weight: 500 !important;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.navbar-search .input-group-btn .btn.loading .ec-search,
.search-form .input-group-btn .btn.loading .ec-search,
.navbar-search.loading .input-group-btn .btn .ec-search,
.search-form.loading .input-group-btn .btn .ec-search {
    animation: spin 1s linear infinite;
    transform-origin: center;
}

.navbar-search .input-group-btn .btn .ec-search,
.search-form .input-group-btn .btn .ec-search {
    transition: transform 0.2s ease-in-out;
}

.input-group-btn .btn,
.input-group-btn .btn-secondary {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.search-btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 1.8px solid white;
    border-top: 1.8px solid #0088e2;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    position: absolute;
    transform: translate(-50%, -50%);
    background: transparent;
    z-index: 2;
    pointer-events: none;
}

.input-group-btn .btn.loading .ec-search {
    opacity: 0 !important;
    visibility: hidden !important;
    animation: none !important;
    transform: none !important;
}

.input-group-btn .btn.loading .search-btn-spinner {
    display: block;
}