/* Búsqueda: referencia con controles superiores y filtros específicos. */
body.in-search-view { background: #f8f9ff; }
body.in-search-view .main-header { height: 80px; padding-inline: max(32px, calc((100vw - 1280px) / 2 + 32px)); background: #fff; }
body.in-search-view .main-header .marketplace-brand { display: block; height: 44px; width: auto; }
body.in-search-view .main-header .logo :is(.logo-com, .logo-pro) { display: none; }
body.in-search-view .marketplace-search { display: none; }
body.in-search-view #distributor-indicator { background: #f1f5f9; }
body.in-search-view .sn-avatar-mini { border-radius: 50%; }
#view-buscar { padding: 0 0 calc(128px + env(safe-area-inset-bottom)); color: #0b1c30; }
#view-buscar button, #view-buscar input { font: inherit; }
.search-controls { position: sticky; top: 80px; z-index: 900; border-bottom: 1px solid #e2e8f0; background: #fff; }
.search-controls-inner { max-width: 1280px; margin: auto; padding: 12px 32px; }
.search-controls-row { display: flex; align-items: center; gap: 16px; }
.search-filter-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; color: #334155; font-size: 12px !important; font-weight: 700 !important; white-space: nowrap; cursor: pointer; }
.search-filter-toggle svg { width: 20px; height: 20px; }
.search-filter-toggle:hover { background: #f8fafc; }
.search-field { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }
.search-field > svg { position: absolute; left: 14px; width: 20px; height: 20px; color: #94a3b8; pointer-events: none; }
#view-buscar #search-input-dedicated { width: 100%; min-width: 0; height: 44px; padding: 10px 42px; border: 1px solid #b3c5ff; border-radius: 12px; background: #fff; color: #0f172a; font-size: 13px; outline: none; box-shadow: none; }
#view-buscar #search-input-dedicated:focus { border-color: #0066ff; box-shadow: 0 0 0 3px #0066ff18; }
#search-input-dedicated::-webkit-search-cancel-button { display: none; }
#search-input-dedicated::placeholder { color: #94a3b8; }
.search-field .search-clear-btn { position: absolute; right: 5px; top: 0; display: flex; align-items: center; justify-content: center; width: 38px; height: 44px; padding: 0; border: 0; background: transparent; color: #64748b; font-size: 22px !important; cursor: pointer; }
.search-result-count { display: flex; align-items: center; gap: 8px; margin: 0; color: #64748b; font-size: 11px; font-weight: 600; white-space: nowrap; }
.search-result-count::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #0066ff; flex-shrink: 0; }
.search-scope-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 10px; }
.search-active-filters { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.search-active-filters::-webkit-scrollbar { display: none; }
.search-filter-caption { color: #94a3b8; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; }
.search-filter-chip { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 3px 6px 3px 10px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f1f5f9; color: #475569; font-size: 11px; white-space: nowrap; }
.search-filter-chip.search-provider-chip { border-color: #dbeafe; background: #eff6ff; color: #0066ff; }
.search-filter-chip button { width: 28px; height: 28px; border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 18px !important; }
.search-reset, #view-buscar #toggle-all-providers { border: 0; background: transparent; color: #0066ff; padding: 8px 0; margin: 0; font-size: 11px !important; font-weight: 700 !important; white-space: nowrap; cursor: pointer; box-shadow: none; }
#view-buscar #toggle-all-providers.active { color: #475569; }
.search-reset:hover, #view-buscar #toggle-all-providers:hover { text-decoration: underline; }
.search-layout { display: flex; align-items: flex-start; gap: 24px; width: 100%; max-width: 1280px; margin: auto; padding: 24px 32px; }
.search-sidebar { position: sticky; top: 200px; width: 256px; flex-shrink: 0; padding: 16px; border: 1px solid #e2e8f0; border-radius: 16px; background: #fff; box-shadow: 0 2px 8px #0f172a04; max-height: calc(100dvh - 320px); overflow-y: auto; scrollbar-width: thin; }
.search-sidebar[hidden] { display: none; }
.search-sidebar-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 14px; }
.search-sidebar-title h2 { font-size: 13px; margin: 0; }
#search-filter-count { color: #94a3b8; font-size: 10px; white-space: nowrap; }
.search-facet { border-top: 1px solid #f1f5f9; padding: 16px 0; }
.search-facet summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; list-style: none; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; cursor: pointer; }
.search-facet summary::-webkit-details-marker { display: none; }
.search-facet summary::after { content: '⌄'; color: #94a3b8; font-size: 17px; }
.search-facet[open] summary::after { transform: rotate(180deg); }
.search-facet-options { display: grid; gap: 12px; margin-top: 16px; }
.search-facet-option { display: flex; align-items: center; gap: 8px; min-width: 0; color: #475569; font-size: 11px; cursor: pointer; }
.search-facet-option:hover { color: #0066ff; }
.search-facet-option input { width: 16px; height: 16px; margin: 0; flex-shrink: 0; accent-color: #0066ff; }
.search-facet-option span { overflow-wrap: anywhere; }
.search-facet-option small { margin-left: auto; color: #94a3b8; font-size: 10px; }
.search-facet-empty { font-size: 11px; color: #94a3b8; margin: 0; }
#search-results-area { flex: 1; min-width: 0; }
#view-buscar #search-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; width: 100%; max-width: none; margin: 0; padding: 0; }
body #view-buscar #search-grid > .catalog-product.product-card { padding: 16px; box-shadow: 0 2px 8px #0f172a05; }
body #view-buscar #search-grid .card-toolbar { margin-bottom: 0; min-height: 24px; }
body #view-buscar #search-grid .card-img-wrapper { height: 176px; margin-bottom: 12px; background: #fff; }
body #view-buscar #search-grid .card-img-wrapper:has(img.loaded) { background: #fff; }
body #view-buscar #search-grid .card-brand { font-size: 9px; text-transform: uppercase; }
body #view-buscar #search-grid .card-name { font-size: 14px; line-height: 20px; height: 40px; min-height: 40px; }
body #view-buscar #search-grid .card-desc { margin-bottom: 10px; }
.search-card-conservation { align-self: flex-start; max-width: 100%; padding: 5px 8px; margin-bottom: 12px; border-radius: 6px; background: #eff6ff; color: #0284c7; font-size: 10px; overflow-wrap: anywhere; }
.search-card-conservation:empty { display: none; }
body #view-buscar #search-grid .card-footer { border: 0; padding-top: 0; }
body #view-buscar #search-grid .card-price { font-size: 20px; }
body #view-buscar #search-grid .card-actions { display: flex; flex-direction: row; gap: 8px; padding-top: 12px; border-top: 1px solid #f1f5f9; }
body #view-buscar #search-grid .qty-control { width: 92px; flex: 0 0 92px; height: 36px; border-radius: 8px; }
body #view-buscar #search-grid .qty-btn { width: 28px; min-width: 28px; height: 36px; min-height: 36px; }
body #view-buscar #search-grid .qty-input { width: 30px; }
body #view-buscar #search-grid .btn-add-card { flex: 1; min-width: 0; height: auto; min-height: 36px; padding: 7px 6px; border-radius: 8px; white-space: normal; font-size: 11px; line-height: 16px; }
.search-pagination { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 0; color: #94a3b8; font-size: 11px; }
.search-pagination p { margin: 0; }
#search-load-more { padding: 12px 20px; border: 1px solid #dbeafe; border-radius: 12px; background: #fff; color: #0066ff; font-weight: 700 !important; cursor: pointer; }
#search-load-more[hidden] { display: none; }
#view-buscar :is(button, summary, input):focus-visible { outline: 2px solid #0066ff; outline-offset: 3px; }
@media (max-width: 1100px) {
    #view-buscar #search-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .search-sidebar { width: 220px; }
}
@media (max-width: 767px) {
    body.in-search-view .main-header { height: 64px; padding-inline: 16px; }
    body.in-search-view #distributor-indicator { max-width: 45%; padding: 6px 8px; }
    body.in-search-view #provider-logo-header { display: none !important; }
    body.in-search-view .distributor-name { font-size: 10px; }
    body.in-search-view .viewing-label { font-size: 8px; }
    .search-controls { top: 64px; }
    .search-controls-inner { padding: 12px 16px; }
    .search-controls-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
    .search-field { grid-row: 1; grid-column: 1/-1; }
    .search-filter-toggle { min-height: 36px; padding: 6px 10px; font-size: 11px !important; }
    .search-result-count { justify-self: end; font-size: 10px; white-space: normal; }
    .search-scope-row { flex-wrap: wrap; gap: 4px; }
    .search-active-filters { flex-basis: 100%; }
    .search-layout { flex-direction: column; padding: 16px; gap: 16px; }
    .search-sidebar { position: static; width: 100%; max-height: 360px; }
    #search-results-area { width: 100%; }
    #view-buscar #search-grid { gap: 12px; }
    body #view-buscar #search-grid > .catalog-product.product-card { padding: 12px; }
}
@media (max-width: 600px) {
    #view-buscar #search-grid { grid-template-columns: minmax(0, 1fr); }
    body #view-buscar #search-grid .qty-control { width: 116px; flex-basis: 116px; height: 44px; }
    body #view-buscar #search-grid .qty-btn { width: 38px; min-width: 38px; height: 44px; min-height: 44px; }
    body #view-buscar #search-grid .qty-input { font-size: 16px; }
    body #view-buscar #search-grid .btn-add-card { min-height: 44px; }
    body.in-search-view .main-header .marketplace-brand { height: 36px; }
}
