/**
 * Estilos para el Buscador Predictivo y Ajustes de Cabecera ComprarOnline
 */

/* ==========================================================================
   1. Contenedor del Buscador en la Cabecera
   ========================================================================== */
.co-header-search-wrap {
    width: 100%;
    max-width: 580px;
    margin: 0 auto;
    position: relative;
    box-sizing: border-box;
}

.co-header-search-form {
    margin: 0;
    padding: 0;
    width: 100%;
}

.co-search-input-box {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 28px;
    padding: 3px 6px 3px 14px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    position: relative;
    box-sizing: border-box;
    width: 100%;
}

.co-search-input-box:hover {
    border-color: #94a3b8;
    background: #ffffff;
}

.co-search-input-box:focus-within {
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 0 0 3.5px rgba(2, 132, 199, 0.15), 0 2px 8px rgba(15, 23, 42, 0.06);
}

.co-search-icon-lens {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    margin-right: 8px;
    flex-shrink: 0;
}

.co-search-input-box:focus-within .co-search-icon-lens {
    color: #0284c7;
}

.co-header-search-field {
    border: none !important;
    background: transparent !important;
    font-size: 14px !important;
    color: #0f172a !important;
    width: 100% !important;
    height: 38px !important;
    padding: 0 4px !important;
    margin: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    font-family: inherit !important;
}

.co-header-search-field::placeholder {
    color: #94a3b8 !important;
    font-size: 13.5px !important;
}

/* Botón de limpiar campo (X) */
.co-search-clear-btn {
    background: #e2e8f0;
    color: #475569;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-right: 6px;
    padding: 0;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.co-search-clear-btn:hover {
    background: #cbd5e1;
    color: #0f172a;
}

/* Spinner indicador de búsqueda activa */
.co-search-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e2e8f0;
    border-top-color: #0284c7;
    border-radius: 50%;
    animation: coSearchSpin 0.6s linear infinite;
    margin-right: 8px;
    flex-shrink: 0;
}

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

/* Botón Buscar */
.co-search-submit-btn {
    background: #0f172a !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 0 16px !important;
    height: 34px !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    letter-spacing: 0.2px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15) !important;
}

.co-search-submit-btn:hover {
    background: #0284c7 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3) !important;
}

/* ==========================================================================
   2. Dropdown de Resultados Predictivos en Vivo (Live Search)
   ========================================================================== */
.co-live-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14), 0 4px 12px rgba(15, 23, 42, 0.04);
    z-index: 9999;
    overflow: hidden;
    max-height: 480px;
    overflow-y: auto;
    animation: coDropdownFadeIn 0.2s ease-out;
}

@keyframes coDropdownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.co-search-dropdown-header {
    padding: 10px 16px 8px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748b;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.co-search-dropdown-header span.co-results-badge {
    background: #e2e8f0;
    color: #334155;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10.5px;
}

.co-search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.co-search-item-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none !important;
    transition: background 0.15s ease;
}

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

.co-search-item-link:hover,
.co-search-item-link.co-item-active {
    background: #f0f9ff;
}

.co-search-item-img {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    object-fit: cover;
    flex-shrink: 0;
}

.co-search-item-details {
    flex: 1;
    min-width: 0;
}

.co-search-item-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
    margin: 0 0 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.co-search-item-title mark {
    background: #fef08a;
    color: #0f172a;
    padding: 0 2px;
    border-radius: 2px;
}

.co-search-item-price {
    font-size: 13px;
    font-weight: 700;
    color: #059669;
}

.co-search-item-price del {
    color: #94a3b8;
    font-weight: 400;
    margin-right: 6px;
}

.co-search-view-all {
    display: block;
    text-align: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 700;
    color: #0284c7 !important;
    text-decoration: none !important;
    transition: background 0.15s ease, color 0.15s ease;
}

.co-search-view-all:hover {
    background: #0284c7;
    color: #ffffff !important;
}

.co-search-empty {
    padding: 24px 20px;
    text-align: center;
    color: #64748b;
    font-size: 13.5px;
    line-height: 1.5;
}

.co-search-empty strong {
    color: #0f172a;
}

/* ==========================================================================
   3. Mejoras Visuales para el Carrito en la Cabecera de Astra
   ========================================================================== */
.ast-site-header-cart {
    display: inline-flex !important;
    align-items: center !important;
}

.ast-site-header-cart .cart-container {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    padding: 7px 14px !important;
    border-radius: 24px !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}

.ast-site-header-cart .cart-container:hover {
    background: #e0f2fe !important;
    border-color: #0284c7 !important;
    transform: translateY(-1px);
}

.ast-site-header-cart .ast-cart-menu-wrap {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.ast-site-header-cart .count {
    background: #10b981 !important;
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    padding: 2px 7px !important;
    border-radius: 12px !important;
    display: inline-block !important;
    line-height: 1.3 !important;
}

/* ==========================================================================
   4. Barra Inferior de Categorías (Below Header)
   ========================================================================== */
.ast-below-header-bar {
    border-top: 1px solid #f1f5f9 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    padding: 2px 0 !important;
}

.ast-below-header-bar .main-header-menu > .menu-item > a {
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    padding: 10px 14px !important;
    transition: color 0.2s ease !important;
}

.ast-below-header-bar .main-header-menu > .menu-item:hover > a,
.ast-below-header-bar .main-header-menu > .current-menu-item > a {
    color: #0284c7 !important;
}

/* ==========================================================================
   5. Adaptación Responsive en Móviles
   ========================================================================== */
@media (max-width: 921px) {
    .co-header-search-wrap {
        max-width: 100%;
        padding: 4px 0 6px 0;
    }

    .co-search-input-box {
        padding: 2px 4px 2px 12px;
    }

    .co-header-search-field {
        font-size: 13px !important;
        height: 36px !important;
    }

    .co-search-submit-btn {
        height: 32px !important;
        padding: 0 12px !important;
        font-size: 12px !important;
    }

    .co-live-search-dropdown {
        position: absolute;
        top: calc(100% + 4px);
        max-height: 360px;
    }

    .ast-mobile-header-wrap .ast-below-header-bar {
        padding: 6px 14px 10px 14px !important;
        border-top: 1px solid #f1f5f9 !important;
        background: #fafafa !important;
    }
}
