/* Desplegable de búsqueda automática — ancho del buscador */
.header-search {
    position: relative;
    z-index: 50;
}

.header-search .search-results-container,
#search-results-container.search-results-container {
    position: absolute !important;
    top: calc(100% + 6px) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e3eef6;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(15, 55, 90, 0.14);
    z-index: 10050;
    max-height: min(70vh, 520px);
    overflow-x: hidden;
    overflow-y: auto;
    display: none;
    font-family: inherit;
}

/* Ocultar resultados viejos del tema Bacola */
.klb-search-results {
    display: none !important;
}

.imperio-sr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(180deg, #f7fbfe 0%, #eef6fb 100%);
    border-bottom: 1px solid #e3eef6;
    position: sticky;
    top: 0;
    z-index: 2;
}

.imperio-sr-header strong {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e3a8a;
    letter-spacing: 0.02em;
}

.imperio-sr-header span {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    color: #6b7c8c;
    font-weight: 500;
}

.imperio-sr-close {
    all: unset;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7c8c;
    font-size: 1.25rem;
    line-height: 1;
}

.imperio-sr-close:hover {
    background: #e8f4fc;
    color: #2bbef9;
}

.imperio-sr-list {
    margin: 0;
    padding: 6px 0;
    list-style: none;
}

.imperio-sr-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
    box-sizing: border-box;
    transition: background 0.15s ease;
}

.imperio-sr-item:hover,
.imperio-sr-item:focus {
    background: #f3f9fd;
    outline: none;
}

.imperio-sr-thumb {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    background: #f7fafc;
    border: 1px solid #e8eef4;
}

.imperio-sr-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.imperio-sr-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.imperio-sr-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.imperio-sr-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-size: 0.78rem;
    color: #6b7c8c;
}

.imperio-sr-cat {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef6fb;
    color: #3b6d8c;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.imperio-sr-stock.is-ok {
    color: #16a34a;
    font-weight: 600;
}

.imperio-sr-stock.is-out {
    color: #dc2626;
    font-weight: 600;
}

.imperio-sr-side {
    flex: 0 0 auto;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 88px;
}

.imperio-sr-price {
    font-size: 1.05rem;
    font-weight: 700;
    color: #e53935;
    white-space: nowrap;
}

.imperio-sr-price-old {
    font-size: 0.78rem;
    color: #94a3b8;
    text-decoration: line-through;
}

.imperio-sr-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 6px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 0.7rem;
    font-weight: 700;
}

.imperio-sr-footer {
    padding: 12px 14px 14px;
    border-top: 1px solid #e3eef6;
    background: #fafcfe;
    position: sticky;
    bottom: 0;
}

.imperio-sr-footer a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 10px;
    background: #2bbef9;
    color: #fff !important;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    box-sizing: border-box;
    transition: background 0.15s ease;
}

.imperio-sr-footer a:hover {
    background: #1a9fd4;
}

.imperio-sr-empty,
.imperio-sr-loading,
.imperio-sr-error {
    padding: 28px 18px;
    text-align: center;
    color: #6b7c8c;
    font-size: 0.92rem;
}

.imperio-sr-loading .spinner {
    width: 28px;
    height: 28px;
    margin: 0 auto 10px;
    border: 3px solid #e3eef6;
    border-top-color: #2bbef9;
    border-radius: 50%;
    animation: imperio-sr-spin 0.7s linear infinite;
}

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

@media (max-width: 575px) {
    .imperio-sr-item {
        gap: 10px;
        padding: 10px 12px;
    }

    .imperio-sr-thumb {
        flex-basis: 52px;
        width: 52px;
        height: 52px;
    }

    .imperio-sr-title {
        font-size: 0.88rem;
    }

    .imperio-sr-side {
        min-width: 72px;
    }

    .imperio-sr-price {
        font-size: 0.95rem;
    }
}
