/* ==========================================================================
   Search autocomplete — multi-section dropdown (.sac-*)
   Used by html/js/busqueda.js for the desktop .search_box and mobile .mm-search.
   Variables fall back to literal hex values so the file is safe to load
   independently of design.css.
   ========================================================================== */

.sac-host { position: relative; }

/* Clear-input button (×) inside .search_box */
.sac-clear-input {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0 4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #94a3b8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color .12s, color .12s;
}
.sac-clear-input:hover { background: #f1f5f9; color: var(--c-dark, #0f172a); }
.sac-clear-input[hidden] { display: none !important; }

/* ==========================================================================
   Dropdown shell
   ========================================================================== */

.sac-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    min-width: min(420px, calc(100vw - 32px));
    max-width: 720px;
    max-height: min(78vh, 640px);
    overflow: hidden auto;
    overscroll-behavior: contain;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow:
        0 1px 3px rgba(15, 23, 42, .04),
        0 16px 36px -8px rgba(15, 23, 42, .14),
        0 4px 12px -2px rgba(15, 23, 42, .08);
    z-index: 9999;
    font-family: var(--font-ui, roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
    color: var(--c-text, #334155);
    animation: sac-pop .14s ease-out;
    isolation: isolate;
}
.sac-dropdown[hidden] { display: none; }

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

/* Mobile menu version is full-width inside the drawer */
.mm-search.sac-host .sac-dropdown {
    position: relative;
    top: 8px;
    left: 0;
    right: 0;
    min-width: 0;
    max-width: none;
    max-height: 60vh;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
}

/* Thin progress bar shown while a fetch is in flight */
.sac-progress {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(232, 83, 14, .08);
    overflow: hidden;
    z-index: 2;
}
.sac-progress span {
    display: block;
    height: 100%;
    width: 35%;
    background: var(--c-orange, #e8530e);
    border-radius: 2px;
    animation: sac-prog 1s linear infinite;
}
@keyframes sac-prog {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(420%); }
}

/* ==========================================================================
   Sections
   ========================================================================== */

.sac-section {
    padding: 10px 4px 6px;
    border-bottom: 1px solid #f1f5f9;
}
.sac-section:last-of-type { border-bottom: 0; }

.sac-section-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px 6px;
    color: var(--c-muted, #64748b);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.sac-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--c-orange, #e8530e);
}
.sac-section-title { flex: 1; }
.sac-section-meta {
    color: var(--c-muted, #64748b);
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    font-size: .72rem;
}

/* Recent — tiny "Borrar" link aligned right */
.sac-recent-clear {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    color: var(--c-muted, #64748b);
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    cursor: pointer;
    transition: color .12s;
}
.sac-recent-clear:hover { color: var(--c-orange, #e8530e); }

/* ==========================================================================
   Pills (recent + trending)
   ========================================================================== */

.sac-pills {
    list-style: none;
    margin: 0;
    padding: 4px 10px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.sac-pills li {
    display: inline-flex;
    align-items: stretch;
    background: #f8fafc;
    border: 1px solid transparent;
    border-radius: 999px;
    overflow: hidden;
    transition: background-color .12s, border-color .12s, transform .12s;
}
.sac-pills li:hover {
    background: #fff;
    border-color: #e2e8f0;
    transform: translateY(-1px);
}
.sac-pills li > a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    color: var(--c-dark, #0f172a);
    font-size: .82rem;
    font-weight: 500;
    text-decoration: none;
    line-height: 1;
}
.sac-pills li > a.is-active {
    background: rgba(232, 83, 14, .08);
    color: var(--c-orange-h, #c44409);
}
.sac-pill-ico {
    display: inline-flex;
    color: var(--c-muted, #64748b);
}
.sac-pills li > a.is-active .sac-pill-ico { color: var(--c-orange, #e8530e); }

.sac-recent-remove {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    border-left: 1px solid #e2e8f0;
    padding: 0 8px;
    color: #cbd5e1;
    cursor: pointer;
    transition: color .12s, background-color .12s;
}
.sac-recent-remove:hover {
    color: var(--c-orange, #e8530e);
    background: rgba(232, 83, 14, .06);
}

.sac-pill-skel {
    width: 76px;
    height: 28px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: sac-shimmer 1.2s infinite;
    border-radius: 999px;
}

/* ==========================================================================
   Suggestion typeahead row (compact, full-width links)
   ========================================================================== */

.sac-section--sugs {
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
}
.sac-sug {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    color: var(--c-text, #334155);
    text-decoration: none;
    font-size: .92rem;
    transition: background-color .1s;
}
.sac-sug:hover,
.sac-sug.is-active {
    background: #fff7f1;
    color: var(--c-dark, #0f172a);
}
.sac-sug-ico {
    display: inline-flex;
    color: #cbd5e1;
    flex-shrink: 0;
}
.sac-sug.is-active .sac-sug-ico,
.sac-sug:hover .sac-sug-ico { color: var(--c-orange, #e8530e); }

.sac-sug-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sac-sug-text mark {
    background: none;
    color: inherit;
    font-weight: 700;
}
.sac-sug-arrow {
    color: #cbd5e1;
    flex-shrink: 0;
}

/* ==========================================================================
   Product list
   ========================================================================== */

.sac-section--products { padding: 8px 0 6px; }

.sac-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sac-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--c-text, #334155);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: background-color .1s, border-color .1s;
}
.sac-item:hover,
.sac-item.is-active {
    background: #fff7f1;
    border-left-color: var(--c-orange, #e8530e);
}

.sac-thumb {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.sac-item:hover .sac-thumb,
.sac-item.is-active .sac-thumb { border-color: #fcd2bd; }

.sac-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    padding: 3px;
    box-sizing: border-box;
}
.sac-img-empty {
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sac-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.sac-title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--c-dark, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.sac-title mark {
    background: none;
    color: var(--c-orange, #e8530e);
    font-weight: 700;
}

.sac-meta {
    font-size: .73rem;
    color: var(--c-muted, #64748b);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow: hidden;
}
.sac-meta-brand {
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .03em;
    font-size: .7rem;
}
.sac-meta-rubro {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sac-meta-sep { color: #cbd5e1; }

.sac-side {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}
.sac-price {
    font-size: .92rem;
    font-weight: 700;
    color: var(--c-dark, #0f172a);
    white-space: nowrap;
    line-height: 1.2;
}
.sac-badge {
    font-size: .6rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .05em;
    line-height: 1.2;
}
.sac-badge--oferta {
    background: var(--c-orange, #e8530e);
    color: #fff;
}

/* ==========================================================================
   Side groups (brands / categories / collections)
   Two-column layout on desktop, stacked on mobile.
   ========================================================================== */

.sac-section--groups {
    padding: 8px 0 6px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0;
    border-top: 1px solid #f1f5f9;
}

.sac-group {
    padding: 6px 0;
    border-right: 1px solid #f1f5f9;
}
.sac-group:last-child { border-right: 0; }

.sac-group-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 4px;
    color: var(--c-muted, #64748b);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.sac-mini-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sac-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    color: var(--c-text, #334155);
    text-decoration: none;
    font-size: .85rem;
    transition: background-color .1s;
}
.sac-mini:hover,
.sac-mini.is-active {
    background: #fff7f1;
    color: var(--c-dark, #0f172a);
}

.sac-mini-ico {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    color: var(--c-orange, #e8530e);
    background: rgba(232, 83, 14, .08);
    border-radius: 7px;
    flex-shrink: 0;
}
.sac-group--col .sac-mini-ico {
    color: #6366f1;
    background: rgba(99, 102, 241, .1);
}

.sac-mini-logo {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #64748b;
    font-weight: 700;
    font-size: .75rem;
}
.sac-mini-logo img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}
.sac-mini-logo--placeholder {
    background: linear-gradient(135deg, #fef3eb, #fdebd9);
    color: var(--c-orange-h, #c44409);
}

.sac-mini-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sac-mini-text mark {
    background: none;
    color: var(--c-orange, #e8530e);
    font-weight: 700;
}
.sac-mini-arrow {
    color: #cbd5e1;
    flex-shrink: 0;
    transform: translateX(0);
    transition: transform .15s;
}
.sac-mini:hover .sac-mini-arrow,
.sac-mini.is-active .sac-mini-arrow {
    color: var(--c-orange, #e8530e);
    transform: translateX(2px);
}

/* ==========================================================================
   Footer "Ver todos"
   ========================================================================== */

.sac-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 16px;
    background: linear-gradient(0deg, #fff7f1, #fff);
    color: var(--c-orange-h, #c44409);
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    border-top: 1px solid #f1f5f9;
    transition: background-color .15s, color .15s;
    position: sticky;
    bottom: 0;
}
.sac-footer:hover,
.sac-footer.is-active {
    background: #ffeede;
    color: var(--c-orange-h, #c44409);
}
.sac-footer strong { font-weight: 700; }
.sac-footer-arrow { color: var(--c-orange, #e8530e); }

/* ==========================================================================
   Status / empty state
   ========================================================================== */

.sac-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    color: var(--c-muted, #64748b);
    font-size: .88rem;
}
.sac-status-icon {
    display: inline-flex;
    color: #cbd5e1;
}
.sac-status--err { color: #b91c1c; }

.sac-empty {
    padding: 28px 24px;
    text-align: center;
}
.sac-empty-ico {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #94a3b8;
    border-radius: 50%;
    margin-bottom: 12px;
}
.sac-empty-msg {
    color: var(--c-dark, #0f172a);
    font-weight: 600;
    font-size: .98rem;
    margin-bottom: 4px;
}
.sac-empty-msg strong {
    color: var(--c-orange, #e8530e);
    font-weight: 700;
}
.sac-empty-tip {
    color: var(--c-muted, #64748b);
    font-size: .8rem;
    margin-bottom: 14px;
}
.sac-empty-cta {
    display: inline-block;
    padding: 9px 18px;
    background: var(--c-orange, #e8530e);
    color: #fff;
    text-decoration: none;
    border-radius: 100px;
    font-size: .82rem;
    font-weight: 600;
    transition: background-color .15s;
}
.sac-empty-cta:hover { background: var(--c-orange-h, #c44409); }

/* ==========================================================================
   Skeleton loading rows
   ========================================================================== */

.sac-skeleton { padding: 8px 14px 12px; }
.sac-skeleton-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}
.sac-sk-thumb {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 10px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: sac-shimmer 1.2s infinite;
}
.sac-sk-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sac-sk-line {
    height: 10px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: sac-shimmer 1.2s infinite;
}
.sac-sk-line--lg { width: 70%; }
.sac-sk-line--sm { width: 40%; height: 8px; }
.sac-sk-price {
    width: 56px;
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: sac-shimmer 1.2s infinite;
}
@keyframes sac-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Legacy spinner kept for backwards compatibility */
.sac-spinner {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--c-orange, #e8530e);
    border-radius: 50%;
    animation: sac-spin .6s linear infinite;
}
@keyframes sac-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
    .sac-dropdown {
        min-width: 0;
        max-width: none;
        left: -8px;
        right: -8px;
        border-radius: 12px;
    }
    .sac-section--groups { grid-template-columns: 1fr; }
    .sac-group { border-right: 0; border-bottom: 1px solid #f1f5f9; padding-bottom: 4px; }
    .sac-group:last-child { border-bottom: 0; }
    .sac-thumb { width: 46px; height: 46px; }
    .sac-title { font-size: .87rem; }
    .sac-meta  { font-size: .7rem; }
    .sac-price { font-size: .88rem; }
}

/* When the .search_box parent gets focus styling, blend the dropdown */
.search_box.is-open {
    border-color: var(--c-orange, #e8530e);
    box-shadow: 0 0 0 3px rgba(232, 83, 14, .1);
}
