/* ==========================================================
   Search Bar Container and Elements
   ========================================================== */
#central-product-search-meili {
    display: flex;
    border: 1px solid #ccc;
    border-radius: 16px;
    overflow: hidden;
    width: 100%;
    margin: 10px auto;
    position: relative;
}

/* Pseudo-element for the animated placeholder text */
#central-product-search-meili::before {
    content: attr(data-placeholder-text);
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 70px);
    
    /* Animation transition properties */
    transition: opacity 0.7s ease-in-out;
    opacity: 1; /* Default visible state */
}

/* This class triggers the fade-out effect */
#central-product-search-meili.fading-out::before {
    opacity: 0;
}

/* Hide the pseudo-placeholder when the input is focused or has content */
#central-product-search-meili:focus-within::before,
#central-product-search-meili.has-content::before {
    opacity: 0;
}

#cps-search-input-meili {
    flex-grow: 1;
    border: none;
    padding: 10px 14px;
    font-size: 16px;
    outline: none;
    box-sizing: border-box;
    /* Styles to make the default placeholder text invisible */
    color: transparent;
    text-shadow: 0 0 0 #333;
}

#cps-search-button-meili {
    background-color: #F5FF21;
    border: none;
    cursor: pointer;
    padding: 10px 15px;
    color: #000;
    font-size: 18px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 16px 16px 0;
}

#cps-search-button-meili:hover {
    background-color: #d6dd00;
}

#cps-search-button-meili i {
    pointer-events: none;
}

/* ==========================================================
   Search Results and Card Styles
   ========================================================== */
div#cps-search-results-meili {
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
    margin-top: 25px;
    border-radius: 14px;
    background-color: white;
}

.cps-card {
    background: #fff;
    border-radius: 12px;
    margin-top: 5px;
    padding: 5px 16px;
}

.cps-card h4 {
    margin-bottom: 8px;
    font-size: 16px;
    color: #000;
}

/* ==========================================================
   Brands Styles (Horizontal Scroll)
   ========================================================== */
.cps-brands {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 6px;
}

img.cps-brand-thumb {
    border: solid #9f9e9e 2px !important;
    border-radius: 8px !important;
    padding: 3px;
    width: 120px;
}

/* ==========================================================
   Categories Styles (Grid)
   ========================================================== */
.cps-categories {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* default desktop */
    gap: 10px;
    padding-bottom: 6px;
}

@media (max-width: 900px) {
    .cps-categories {
        grid-template-columns: repeat(2, 1fr); /* tablet */
    }
}

@media (max-width: 600px) {
    .cps-categories {
        grid-template-columns: 1fr; /* mobile */
    }
}


.cps-category-item {
    color: #007a33;
    text-decoration: none;
    background: #f8f8f8;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    text-align: left;
    transition: background 0.2s ease;
    height: 100%;
    justify-content: flex-start;
}

.cps-category-item span {
    width: 100%;
}

.cps-category-item:hover {
    background: #eee;
}

.cps-category-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    margin-right: 15px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

/* ==========================================================
   Products Styles (Vertical List)
   ========================================================== */
.cps-product-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0px;
    border-radius: 5px;
    border: 1px solid #eee;
    margin-bottom: 3px;
    background: #fff;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

ul.cps-products{
    margin:0px;
}

.cps-product-item:hover {
    background: #f5f5f5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.cps-product-item img {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.cps-product-details {
    flex: 1;
}

.cps-product-details span {
    font-size: 15px;
    line-height: 1.2;
    color: #000;
}

/* ==========================================================
   Misc Styles
   ========================================================== */
.cps-keywords {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cps-keywords li {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid #eee;
}

.cps-keywords li:last-child {
    border-bottom: none;
}

.cps-keywords a {
    text-decoration: none;
    color: #000;
}

.cps-keywords a strong {
    font-weight: bold;
}

.cps-external-icon {
    color: #0073aa;
    margin-left: 6px;
}

#cps-search-loader {
    position: absolute;
    right: 55px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007a33;
    border-radius: 50%;
    animation: cps-spin 1s linear infinite;
}

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