/* Smartweb Smart Search — type-ahead so živými náhľadmi. */

.sws {
    --sws-accent: var(--rfx-orange, #0064b1);
    --sws-accent-dark: var(--rfx-orange-dark, #00548f);
    --sws-text: var(--rfx-text, #1f2937);
    --sws-border: var(--rfx-border, #e5e7eb);
    position: relative;
    width: 100%;
}

.sws-form { position: relative; display: flex; width: 100%; }

.sws-lens {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--sws-accent);
    color: #fff;
    pointer-events: none;
    z-index: 2;
}
.sws-lens .sws-ic { width: 16px; height: 16px; }

div.sws input.sws-input {
    width: 100%;
    height: 46px;
    padding: 12px 44px 12px 50px;
    border: 1px solid var(--sws-border);
    border-radius: var(--rfx-radius-pill, 999px);
    font-size: 16px; /* 16px bráni auto-zoomu iOS Safari pri fokuse */
    background: #fff;
    outline: none;
}
div.sws input.sws-input:focus {
    border-color: var(--sws-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--sws-accent) 18%, transparent);
}
div.sws input.sws-input::-webkit-search-cancel-button,
div.sws input.sws-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
@media (min-width: 768px) {
    div.sws input.sws-input { font-size: .9rem; }
}

.sws-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: rgba(0, 0, 0, .4);
    cursor: pointer;
    z-index: 2;
}
.sws-clear:hover { background: rgba(0, 0, 0, .06); color: var(--sws-text); }
.sws-clear .sws-ic { width: 15px; height: 15px; }

.sws-ic { width: 14px; height: 14px; flex: 0 0 auto; }
.sws-accent { color: var(--sws-accent); }

/* ---------- dropdown ---------- */

.sws-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: min(720px, calc(100vw - 24px));
    z-index: 1050;
    background: #fff;
    border: 1px solid var(--sws-border);
    border-radius: 14px;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .28);
    overflow: hidden;
    font-size: .875rem;
    color: var(--sws-text);
    text-align: left;
}

/* ---------- história ---------- */

.sws-history { border-bottom: 1px solid var(--sws-border); }

.sws-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, .03);
}
.sws-group-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, .55);
}
.sws-history-clear {
    border: 0;
    background: none;
    font-size: 11px;
    color: rgba(0, 0, 0, .5);
    cursor: pointer;
    padding: 0;
}
.sws-history-clear:hover { color: var(--sws-text); text-decoration: underline; }

.sws-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; }
.sws-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 999px;
    background: #fff;
    padding: 4px 6px 4px 12px;
    transition: border-color .15s;
}
.sws-chip:hover { border-color: var(--sws-accent); }
.sws-chip-term {
    border: 0;
    background: none;
    padding: 0;
    font-size: 13px;
    color: var(--sws-text);
    cursor: pointer;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sws-chip-term:hover { color: var(--sws-accent); }
.sws-chip-x {
    border: 0;
    background: none;
    padding: 0;
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: rgba(0, 0, 0, .4);
    cursor: pointer;
}
.sws-chip-x:hover { background: rgba(0, 0, 0, .1); color: var(--sws-text); }
.sws-chip-x .sws-ic { width: 11px; height: 11px; }

/* ---------- výsledky ---------- */

.sws-loading { padding: 18px; text-align: center; color: rgba(0, 0, 0, .55); }

.sws-empty {
    padding: 24px;
    text-align: center;
    color: rgba(0, 0, 0, .55);
    display: grid;
    justify-items: center;
    gap: 8px;
}
.sws-empty .sws-ic { width: 20px; height: 20px; }

.sws-link {
    border: 0;
    background: none;
    padding: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--sws-accent);
    cursor: pointer;
}
.sws-link:hover { text-decoration: underline; }

.sws-split { display: grid; }
@media (min-width: 768px) {
    .sws-split { grid-template-columns: 300px 1fr; }
}

.sws-left { max-height: 480px; overflow-y: auto; }
@media (min-width: 768px) {
    .sws-left { border-right: 1px solid var(--sws-border); }
}

.sws-group { border-bottom: 1px solid var(--sws-border); }
.sws-group:last-of-type { border-bottom: 0; }

.sws-list { list-style: none; margin: 0; padding: 0; }
.sws-row {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 6px 12px;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
    color: var(--sws-text);
    transition: background-color .12s;
}
.sws-row:hover, .sws-row.is-active { background: rgba(0, 0, 0, .05); }

.sws-row-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.sws-row-count { margin-left: auto; font-size: 12px; color: rgba(0, 0, 0, .5); flex: 0 0 auto; }

/* Náhľady v zoznamoch: jednotný štvorec pre kategórie aj produkty, fotka na bielom. */
.sws-thumb, .sws-thumb-sm {
    position: relative;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    overflow: hidden;
    display: block;
}
.sws-thumb img, .sws-thumb-sm img { display: block; width: 100%; height: 100%; max-height: 100%; object-fit: contain; padding: 2px; }

.sws-row-meta { min-width: 0; flex: 1; }
.sws-row-name {
    font-size: 13px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sws-row-brand {
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, .5);
}

.sws-all {
    display: block;
    width: 100%;
    padding: 11px;
    border: 0;
    border-top: 1px solid var(--sws-border);
    background: rgba(0, 0, 0, .02);
    font-size: .875rem;
    font-weight: 500;
    color: var(--sws-text);
    text-align: center;
    cursor: pointer;
}
.sws-all:hover { background: rgba(0, 0, 0, .05); }

/* ---------- pravý náhľadový panel ---------- */

.sws-right {
    display: none;
    max-height: 480px;
    overflow-y: auto;
    background: rgba(0, 0, 0, .02);
    padding: 14px;
}
@media (min-width: 768px) {
    .sws-right { display: block; }
}

.sws-right-label {
    margin-bottom: 10px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, .55);
}
.sws-right-hint {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    padding: 28px 0;
    font-size: 12px;
    color: rgba(0, 0, 0, .5);
}

/* minmax(0, 1fr) + min-width: 0 - dlhý názov/cena inak roztiahne stĺpec a karty (aj obrázky) majú rôznu šírku. */
.sws-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sws-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
    padding: 8px;
    border: 1px solid rgba(0, 0, 0, .1);
    border-radius: 10px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: border-color .12s, box-shadow .12s;
}
.sws-card:hover { border-color: rgba(0, 0, 0, .3); }
.sws-card.is-active {
    border-color: var(--sws-accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--sws-accent) 30%, transparent);
}
.sws-card-img {
    position: relative;
    aspect-ratio: 1 / 1;
    margin-bottom: 6px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    overflow: hidden;
    display: block;
}
.sws-card-img img { display: block; width: 100%; height: 100%; max-height: 100%; object-fit: contain; padding: 6px; }
.sws-card-brand {
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, .5);
}
.sws-card-name {
    font-size: 12px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sws-card-price { margin-top: 4px; font-size: 13px; font-weight: 700; }
.sws-card-price del { color: rgba(0, 0, 0, .45); font-weight: 400; margin-right: 4px; }
.sws-card-price ins { text-decoration: none; color: var(--sws-accent); }

.sws-attrs {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
}
.sws-attrs-title {
    margin-bottom: 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, .5);
}
.sws-attr { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; }
.sws-attr dt { color: rgba(0, 0, 0, .6); font-weight: 400; }
.sws-attr dd { margin: 0; text-align: right; font-weight: 500; }

/* ---------- presná zhoda (hero) ---------- */

.sws-exact { display: grid; gap: 16px; padding: 16px; }
@media (min-width: 768px) {
    .sws-exact { grid-template-columns: 200px 1fr; }
}
.sws-exact-img {
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    overflow: hidden;
    display: block;
}
.sws-exact-img img { display: block; width: 100%; height: 100%; max-height: 100%; object-fit: contain; padding: 12px; }
.sws-exact-body { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.sws-exact-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--sws-accent) 12%, #fff);
    color: var(--sws-accent);
    font-size: 11px;
    font-weight: 600;
}
.sws-exact-brand {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, .55);
}
.sws-exact-name { margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.25; }
.sws-exact-price { font-size: 1.35rem; font-weight: 700; color: var(--sws-accent); }
.sws-exact-price del { font-size: 1rem; color: rgba(0, 0, 0, .45); font-weight: 400; margin-right: 6px; }
.sws-exact-price ins { text-decoration: none; }
.sws-exact-attrs { margin-top: 2px; width: 100%; }
.sws-exact-open {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 8px 16px;
    border: 0;
    border-radius: 8px;
    background: var(--sws-accent);
    color: #fff;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
}
.sws-exact-open:hover { background: var(--sws-accent-dark); }

/* ---------- open animation, helpers ---------- */

.sws-dropdown:not([hidden]) { animation: sws-pop .14s ease-out; }
/* `translate` (not `transform`): JS positions the panel with left/transform inside the viewport. */
@keyframes sws-pop {
    from { opacity: 0; translate: 0 -4px; }
    to { opacity: 1; translate: 0 0; }
}

.sws-muted { color: rgba(0, 0, 0, .4); }
mark.sws-hl { background: none; color: inherit; font-weight: 700; padding: 0; }

/* ---------- welcome panel (empty field) ---------- */

.sws-welcome { display: grid; max-height: min(75vh, 640px); overflow-y: auto; }
@media (min-width: 768px) {
    .sws-welcome { grid-template-columns: 300px minmax(0, 1fr); overflow: visible; max-height: none; }
    .sws-welcome.is-single { grid-template-columns: minmax(0, 1fr); }
    .sws-welcome-main, .sws-welcome-side { max-height: min(70vh, 520px); overflow-y: auto; }
    .sws-welcome-main { border-right: 1px solid var(--sws-border); }
    .sws-welcome.is-single .sws-welcome-main { border-right: 0; }
}
.sws-welcome-main .sws-group:last-child { border-bottom: 0; }

.sws-welcome-side { min-width: 0; padding: 14px; background: rgba(0, 0, 0, .02); }
.sws-welcome-side .sws-right-label { display: flex; align-items: center; gap: 7px; }
.sws-welcome-side .sws-right-label .sws-ic { color: var(--sws-accent); }
.sws-welcome-side > * + .sws-right-label { margin-top: 18px; }
.sws-welcome-side .sws-cards { row-gap: 12px; }
@media (max-width: 767px) {
    .sws-welcome-side { border-top: 1px solid var(--sws-border); }
    /* Mobile: product cards in one swipeable row. */
    .sws-welcome .sws-cards {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: 40%;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 4px;
    }
    .sws-welcome .sws-card { scroll-snap-align: start; }
}

.sws-welcome-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 12px;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    color: var(--sws-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.sws-welcome-chip .sws-ic { width: 13px; height: 13px; color: var(--sws-accent); }
.sws-welcome-chip:hover, .sws-welcome-chip.is-active {
    border-color: var(--sws-accent);
    background: color-mix(in srgb, var(--sws-accent) 6%, #fff);
}
.sws-chip-term.is-active { color: var(--sws-accent); }
.sws-chip:has(.sws-chip-term.is-active) { border-color: var(--sws-accent); }

.sws-welcome-viewed { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.sws-welcome-viewed-item {
    flex: 0 0 72px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--sws-text);
    text-align: left;
    cursor: pointer;
}
.sws-welcome-viewed-item .sws-thumb { width: 72px; height: 72px; border-radius: 8px; transition: border-color .12s; }
.sws-welcome-viewed-item:hover .sws-thumb, .sws-welcome-viewed-item.is-active .sws-thumb { border-color: var(--sws-accent); }
.sws-welcome-viewed-name {
    font-size: 11px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sws-welcome-skel { display: grid; gap: 10px; padding: 14px 12px; }
.sws-welcome-skel span, .sws-welcome-skel-card {
    display: block;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(0, 0, 0, .05) 25%, rgba(0, 0, 0, .1) 37%, rgba(0, 0, 0, .05) 63%);
    background-size: 400% 100%;
    animation: sws-shimmer 1.2s ease infinite;
}
.sws-welcome-skel span:nth-child(odd) { width: 70%; }
.sws-welcome-skel-card { height: 160px; border-radius: 10px; }
@keyframes sws-shimmer {
    from { background-position: 100% 50%; }
    to { background-position: 0 50%; }
}

/* ---------- predictions while typing ---------- */

.sws-predict li { position: relative; }
.sws-predict .sws-row { padding-right: 42px; }
.sws-predict .sws-row-title { font-weight: 400; }
.sws-predict .sws-row-title strong { font-weight: 700; }
.sws-predict-in { color: rgba(0, 0, 0, .55); }
.sws-predict-fill {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: none;
    color: rgba(0, 0, 0, .4);
    cursor: pointer;
}
.sws-predict-fill:hover, .sws-predict-fill:focus-visible { background: rgba(0, 0, 0, .08); color: var(--sws-text); }

/* Inline completion: the typed part is invisible (the real input text shows through), the rest is grey. */
.sws-predict-ghost {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: 44px;
    display: flex;
    align-items: center;
    white-space: pre;
    overflow: hidden;
    pointer-events: none;
    color: rgba(0, 0, 0, .35);
    z-index: 1;
}
.sws-predict-ghost[hidden] { display: none; }
.sws-predict-ghost-typed { visibility: hidden; }

/* ---------- empty result tips ---------- */

.sws-empty-tips { margin-top: 6px; font-size: 12px; }
.sws-empty .sws-chips { justify-content: center; padding: 0; }

@media (prefers-reduced-motion: reduce) {
    .sws-dropdown:not([hidden]), .sws-welcome-skel span, .sws-welcome-skel-card { animation: none; }
}
