/* ============================================
   RETROFASE SEARCH BAR
   ============================================
   
   Buscador AJAX mobile-first para productos
   
   ============================================ */

/* ============================================
   1. CONTENEDOR PRINCIPAL
   ============================================ */

.retrofase-search-bar-wrapper {
    width: 100%;
    max-width: 600px;
    position: relative;
    margin: 0 auto;
}

/* ============================================
   2. FORMULARIO DE BÚSQUEDA
   ============================================ */

.retrofase-search-form {
    position: relative;
    width: 100%;
}

/* ============================================
   3. INPUT WRAPPER
   ============================================ */

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 44px;
    background: #FFFFFF;
    border: 1px solid #EAEBED;
    border-radius: 30px;
    padding: 0 16px;
    transition: all 0.3s ease;
}

.search-input-wrapper:focus-within {
    border-color: #034AB1;
    box-shadow: 0 0 0 3px rgba(3, 74, 177, 0.1);
}

/* ============================================
   4. BOTÓN DE BÚSQUEDA (ICONO)
   ============================================ */

.search-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    margin-right: 12px;
    cursor: pointer;
    color: #666666;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.search-submit-btn:hover {
    color: #034AB1;
}

.search-submit-btn svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   5. INPUT FIELD
   ============================================ */

.retrofase-search-field {
    flex: 1;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    color: #333333;
    padding: 0;
}

.retrofase-search-field::placeholder {
    color: #999999;
}

/* ============================================
   6. LOADING INDICATOR
   ============================================ */

.search-loading {
    position: absolute;
    right: 50px;
    display: flex;
    align-items: center;
    color: #034AB1;
}

.search-loading .spinner {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   7. CLEAR BUTTON
   ============================================ */

.search-clear-btn {
    position: absolute;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #F5F5F5;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #666666;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.search-clear-btn:hover {
    background: #E8E8E8;
    color: #333333;
}

.search-clear-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   8. DROPDOWN DE RESULTADOS
   ============================================ */

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #FFFFFF;
    border: 1px solid #EAEBED;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.search-results-dropdown.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* ============================================
   9. LISTA DE RESULTADOS (TEXTO SIMPLE)
   ============================================ */

.search-results-list {
    padding: 8px 0;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    text-decoration: none;
    color: #333333;
    transition: background 0.2s ease;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    border-bottom: 1px solid #F5F5F5;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #F9F9F9;
}

/* Texto del resultado */
.result-title {
    flex: 1;
    margin: 0;
    font-weight: 400;
    color: #333333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Flecha de navegación */
.result-arrow {
    margin-left: 12px;
    color: #999999;
    font-size: 16px;
    flex-shrink: 0;
}

/* Separador de categorías */
.search-category-header {
    padding: 12px 16px 8px;
    font-family: 'Open Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #FAFAFA;
    border-bottom: 1px solid #EAEBED;
}

/* ============================================
   10. NO RESULTS
   ============================================ */

.search-no-results {
    padding: 40px 20px;
    text-align: center;
}

.search-no-results p {
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    color: #666666;
    margin: 0;
}

/* ============================================
   11. RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .search-input-wrapper {
        height: 42px;
    }
    
    .retrofase-search-field {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .search-results-dropdown {
        max-height: 350px;
        border-radius: 8px;
    }
}

@media (max-width: 576px) {
    .search-input-wrapper {
        height: 40px;
        padding: 0 12px;
    }
    
    .search-submit-btn {
        margin-right: 8px;
    }
    
    .search-result-item {
        padding: 10px 12px;
        font-size: 13px;
    }
}