/* ==========================================================================
   Estilos Unificados para Buscador de Productos (Desktop & M車vil)
   ========================================================================== */

.cps-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%; 
    margin: 0 auto;
    font-family: inherit;
    box-sizing: border-box;
}

/* Contenedor del formulario unificado */
.cps-unified-form {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #ffffff;
    box-sizing: border-box;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Caja de entrada */
.cps-search-input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 10px 15px !important;
    font-size: 14px;
    color: #333333;
    outline: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    width: 100% !important;
    -webkit-appearance: none; /* Para safari/iOS m車vil */
}

.cps-search-input::placeholder {
    color: #777777;
    opacity: 1;
}

.cps-unified-form:focus-within {
    border-color: #c20a0b;
    box-shadow: 0 0 0 2px rgba(194, 10, 11, 0.15);
}

/* Bot車n transparente para la Lupa */
.cps-unified-icon-btn {
    border: none !important;
    background: transparent !important;
    padding: 0 14px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333333;
    height: 100%;
    margin: 0;
    line-height: 1;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.cps-unified-icon-btn:hover {
    color: #c20a0b !important;
}

/* ==========================================================================
   Resultados AJAX desplegables
   ========================================================================== */

.cps-results-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-top: 2px solid #c20a0b;
    box-shadow: 0px 6px 16px rgba(0, 0, 0, 0.12);
    z-index: 99999; /* Z-index elevado para sobresalir en men迆s m車viles */
    margin-top: 4px;
    border-radius: 0 0 6px 6px;
    display: none;
    max-height: 80vh;
    overflow-y: auto;
}

/* Grilla en Desktop (2 Columnas) */
.cps-grid-results {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px;
}

.cps-item {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding: 8px;
    background-color: #fafafa;
    border: 1px solid #eee;
    border-radius: 4px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.cps-item:hover,
.cps-item:active {
    background-color: #f4f4f4;
    border-color: #c20a0b;
}

.cps-item-img {
    width: 45px;
    height: 45px;
    flex-shrink: 0;
}

.cps-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
}

.cps-item-title {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #111111;
    line-height: 1.25;
}

.cps-no-results {
    padding: 15px;
    text-align: center;
    color: #666666;
    font-size: 13px;
}

/* ==========================================================================
   Adaptaci車n Responsiva (M車viles: 1 Columna)
   ========================================================================== */
@media screen and (max-width: 767px) {
    .cps-grid-results {
        grid-template-columns: 1fr !important; /* 1 sola columna en dispositivos m車viles */
        gap: 6px;
        padding: 8px;
    }

    .cps-item {
        padding: 10px; /* Incremento para toque c車modo */
    }

    .cps-item-title {
        font-size: 13px; /* Mayor legibilidad en m車viles */
    }

    .cps-search-input {
        font-size: 16px !important; /* Previene el zoom autom芍tico molesto en iOS Safari */
    }
}