/* Softaware AI Visual Search - Luma styles (Hyvä uses Tailwind classes in its own templates). */
.sw-vs-overlay[hidden], .sw-vs-overlay [hidden], .sw-vs-results [hidden], .sw-vs-similar[hidden], [data-sw-vs-similar-trigger][hidden] { display: none !important; }
.sw-vs-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Camera button inside the mini search field */
.block-search .control { position: relative; }
.sw-vs-camera {
    position: absolute; top: 50%; right: 38px; transform: translateY(-50%); z-index: 2;
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; color: #757575; box-shadow: none; cursor: pointer; line-height: 1;
}
.sw-vs-camera:hover, .sw-vs-camera:focus { background: #f0f0f0; color: #333; border: 0; }
.sw-vs-camera:focus-visible { outline: 2px solid #1979c3; outline-offset: 1px; }
.block-search input#search { padding-right: 76px; }
@media (max-width: 767px) {
    .sw-vs-camera { right: 6px; display: none; }
    .block-search .label.active + .control .sw-vs-camera { display: inline-flex; }
    .block-search input#search { padding-right: 44px; }
}

/* Upload dialog */
html.sw-vs-open { overflow: hidden; }
.sw-vs-overlay {
    position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(20, 24, 31, .55);
}
.sw-vs-dialog {
    position: relative; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto;
    padding: 28px 28px 20px; border-radius: 12px; background: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.sw-vs-dialog:focus { outline: none; }
.sw-vs-close {
    position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; color: #555; font-size: 26px; line-height: 36px; box-shadow: none; cursor: pointer;
}
.sw-vs-close:hover, .sw-vs-close:focus { background: #f2f2f2; border: 0; color: #111; }
.sw-vs-title { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.sw-vs-intro { margin: 0 0 18px; color: #555; }
.sw-vs-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; padding: 0; border: 0; }
.sw-vs-mode {
    display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border: 1px solid #d9d9d9; border-radius: 8px;
    cursor: pointer; font-weight: normal;
}
.sw-vs-mode input { margin: 3px 0 0; }
.sw-vs-mode strong { display: block; font-size: 14px; }
.sw-vs-mode small { display: block; color: #666; font-size: 12px; line-height: 1.35; }
.sw-vs-mode:has(input:checked) { border-color: #1979c3; background: #f3f8fd; }
.sw-vs-drop {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    min-height: 170px; padding: 20px; border: 2px dashed #c5ccd6; border-radius: 10px; background: #fafbfc;
    color: #1979c3; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.sw-vs-drop:hover, .sw-vs-drop.is-over, .sw-vs-drop:focus-within { border-color: #1979c3; background: #f3f8fd; }
.sw-vs-file { position: absolute; width: 1px; height: 1px; opacity: 0; }
.sw-vs-drop-main { font-size: 16px; font-weight: 600; color: #1979c3; }
.sw-vs-drop-hint { font-size: 12px; color: #6b7280; }
.sw-vs-preview { position: relative; overflow: hidden; border-radius: 10px; background: #f3f4f6; }
.sw-vs-preview img { display: block; width: 100%; max-height: 300px; object-fit: contain; }
.sw-vs-status {
    position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; align-items: center; justify-content: center;
    padding: 12px; background: rgba(255, 255, 255, .92); font-weight: 600;
}
.sw-vs-spinner {
    display: inline-block; width: 18px; height: 18px; border: 2px solid #c9d8ea; border-top-color: #1979c3; border-radius: 50%;
    animation: sw-vs-spin .8s linear infinite; vertical-align: middle; margin-right: 8px;
}
.sw-vs-status .sw-vs-spinner { margin-right: 0; }
@keyframes sw-vs-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sw-vs-spinner { animation-duration: 2s; } }
.sw-vs-error { margin: 12px 0 0; padding: 10px 12px; border-radius: 6px; background: #fdecea; color: #a4262c; }
.sw-vs-privacy { margin: 14px 0 0; color: #6b7280; font-size: 12px; text-align: center; }
@media (max-width: 480px) {
    .sw-vs-overlay { align-items: flex-end; padding: 0; }
    .sw-vs-dialog { max-width: none; border-radius: 14px 14px 0 0; padding: 24px 18px 16px; }
    .sw-vs-modes { grid-template-columns: 1fr; }
}

/* Results page */
.sw-vs-results { margin-bottom: 40px; }
.sw-vs-empty { padding: 30px 0; text-align: center; }
.sw-vs-head { display: flex; gap: 20px; align-items: center; margin: 0 0 20px; }
.sw-vs-head-photo img { display: block; width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid #e5e7eb; }
.sw-vs-count { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.sw-vs-again { margin: 0; }
.sw-vs-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.sw-vs-chip {
    display: inline-block; padding: 6px 14px; border: 1px solid #d1d5db; border-radius: 999px; color: #333; font-size: 13px;
    text-decoration: none;
}
.sw-vs-chip:hover { border-color: #1979c3; color: #1979c3; text-decoration: none; }
.sw-vs-chip.is-active { border-color: #1979c3; background: #1979c3; color: #fff; }
.sw-vs-tip { color: #555; }
.sw-vs-actions form { display: inline-block; }

/* Shop the Look result (customer photo) */
.sw-vs-look-result { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 32px; align-items: start; }
.sw-vs-look-photo { position: sticky; top: 20px; }
.sw-vs-look-photo .sw-vs-again { margin-top: 12px; }
.sw-vs-look-canvas { position: relative; line-height: 0; }
.sw-vs-look-canvas img { width: 100%; height: auto; border-radius: 10px; }
.sw-vs-box { position: absolute; border: 2px solid #1979c3; border-radius: 6px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0); }
.sw-vs-box-num, .sw-vs-num {
    display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
    background: #1979c3; color: #fff; font-size: 13px; font-weight: 700; line-height: 1;
}
.sw-vs-box-num { position: absolute; top: -12px; left: -12px; }
.sw-vs-item { margin: 0 0 24px; }
.sw-vs-item-title { display: flex; gap: 10px; align-items: center; margin: 0 0 10px; font-size: 18px; }
.sw-vs-look-result .product-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; }
.sw-vs-look-result .product-item { width: auto !important; margin: 0 !important; padding: 0 !important; }
.sw-vs-addall { margin-top: 10px; }
@media (max-width: 767px) {
    .sw-vs-look-result { grid-template-columns: 1fr; gap: 20px; }
    .sw-vs-look-photo { position: static; }
    .sw-vs-look-result .product-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Product page: Find similar + Visually similar */
.product.media { position: relative; }
.sw-vs-find-similar {
    position: absolute; top: 12px; right: 12px; z-index: 5; display: inline-flex; gap: 6px; align-items: center;
    padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, .94); color: #333; font-size: 13px; font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .18); text-decoration: none;
}
.sw-vs-find-similar:hover, .sw-vs-find-similar:focus { color: #1979c3; text-decoration: none; }
.sw-vs-similar { margin: 40px 0; }
.sw-vs-similar:focus { outline: none; }
.sw-vs-similar-loading { padding: 20px 0; color: #666; }
.sw-vs-similar .block-title strong { font-size: 18px; font-weight: 300; }
.sw-vs-similar-grid .product-items { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 0; }
.sw-vs-similar-grid .product-item { width: auto !important; margin: 0 !important; padding: 0 !important; }
@media (max-width: 767px) { .sw-vs-similar-grid .product-items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }

/* Look (widget, product page) */
.sw-vs-lookbook { margin: 40px 0; }
.sw-vs-lookbook .block-title strong { font-size: 18px; font-weight: 300; }
.sw-vs-look {
    display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 32px; align-items: start; margin: 0 0 32px;
}
.sw-vs-look-canvas .sw-vs-hotspot {
    position: absolute; transform: translate(-50%, -50%); display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: #1979c3; color: #fff;
    font-size: 14px; font-weight: 700; line-height: 1; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); cursor: pointer;
}
.sw-vs-look-canvas .sw-vs-hotspot::after {
    content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .7);
    animation: sw-vs-pulse 2s ease-out infinite;
}
@keyframes sw-vs-pulse { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sw-vs-look-canvas .sw-vs-hotspot::after { animation: none; } }
.sw-vs-look-canvas .sw-vs-hotspot:hover, .sw-vs-look-canvas .sw-vs-hotspot.is-active { background: #006bb4; transform: translate(-50%, -50%) scale(1.12); border-color: #fff; }
.sw-vs-look-title { margin: 0 0 6px; font-size: 24px; font-weight: 300; }
.sw-vs-look-desc { margin: 0 0 16px; color: #555; }
.sw-vs-look-list { margin: 0 0 16px; padding: 0; list-style: none; }
.sw-vs-look-item {
    display: grid; grid-template-columns: 24px 64px minmax(0, 1fr) auto; gap: 12px; align-items: center;
    margin: 0 0 10px; padding: 10px; border: 1px solid #e5e7eb; border-radius: 10px; transition: border-color .15s, box-shadow .15s;
}
.sw-vs-look-item.is-active { border-color: #1979c3; box-shadow: 0 0 0 1px #1979c3; }
.sw-vs-look-thumb .product-image-container { width: 64px !important; }
.sw-vs-look-thumb img { max-width: 64px; height: auto; }
.sw-vs-look-name { display: block; margin-bottom: 2px; color: #333; font-weight: 600; }
.sw-vs-look-info .price-box { margin: 0; }
.sw-vs-look-info .price { font-size: 14px; font-weight: 600; }
.sw-vs-look-action .action { padding: 7px 12px; font-size: 13px; white-space: nowrap; }
.sw-vs-addall-btn { width: 100%; }
.sw-vs-addall-note { display: block; margin-top: 6px; color: #666; }
@media (max-width: 767px) {
    .sw-vs-look { grid-template-columns: 1fr; gap: 16px; }
    .sw-vs-look-item { grid-template-columns: 24px 56px minmax(0, 1fr); }
    .sw-vs-look-action { grid-column: 2 / -1; }
}
.sw-vs-look-action .action.secondary { display: inline-block; padding: 6px 12px; border: 1px solid #1979c3; border-radius: 3px; background: #fff; color: #1979c3; font-weight: 600; text-decoration: none; }
.sw-vs-look-action .action.secondary:hover { background: #f3f8fd; text-decoration: none; }
