/**
 * WebARTing Smart Search - Frontend CSS
 */

.wass-search-wrapper {
    --wass-front-bg: #ffffff;
    --wass-front-text: #172033;
    --wass-front-muted: #667085;
    --wass-front-border: #d9e1ec;
    --wass-front-primary: #2563eb;
    --wass-front-primary-dark: #1d4ed8;
    --wass-front-soft: #f4f7fb;
    --wass-front-success: #16a34a;
    --wass-front-warning: #f59e0b;
    --wass-front-danger: #dc2626;
    --wass-front-shadow: 0 16px 42px rgba(15, 23, 42, 0.14);
    --wass-front-radius: 16px;

    position: relative;
    width: 100%;
    max-width: 760px;
    color: var(--wass-front-text);
    font-family: inherit;
    z-index: 30;
}

.wass-search-wrapper *,
.wass-search-wrapper *::before,
.wass-search-wrapper *::after {
    box-sizing: border-box;
}

.wass-search-form {
    display: flex;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    margin: 0;
}

.wass-search-field-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.wass-search-input {
    width: 100%;
    min-height: 48px;
    padding: 11px 46px 11px 16px;
    border: 1px solid var(--wass-front-border);
    border-radius: var(--wass-front-radius);
    background: var(--wass-front-bg);
    color: var(--wass-front-text);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    outline: none;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.wass-search-input:focus {
    border-color: var(--wass-front-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), 0 8px 22px rgba(15, 23, 42, 0.08);
}

.wass-search-input::placeholder {
    color: #98a2b3;
}

.wass-search-clear {
    position: absolute;
    top: 50%;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #eef2f7;
    color: #667085;
    cursor: pointer;
    transform: translateY(-50%);
    transition: 0.18s ease;
}

.wass-search-clear:hover {
    background: #e2e8f0;
    color: #172033;
}

.wass-search-submit {
    flex: 0 0 auto;
    min-height: 48px;
    padding: 0 20px;
    border: 1px solid var(--wass-front-primary-dark);
    border-radius: var(--wass-front-radius);
    background: linear-gradient(135deg, var(--wass-front-primary), var(--wass-front-primary-dark));
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
    transition: 0.18s ease;
}

.wass-search-submit:hover {
    filter: brightness(0.96);
    color: #ffffff;
}

.wass-search-status {
    min-height: 0;
    margin-top: 6px;
    color: var(--wass-front-muted);
    font-size: 13px;
}

.wass-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    overflow: hidden;
    border: 1px solid var(--wass-front-border);
    border-radius: 18px;
    background: var(--wass-front-bg);
    box-shadow: var(--wass-front-shadow);
    z-index: 99999;
}

.wass-results-inner {
    max-height: min(72vh, 680px);
    overflow-y: auto;
    padding: 12px;
}

.wass-results-message {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--wass-front-soft);
    color: var(--wass-front-muted);
    font-size: 13px;
    font-weight: 700;
}

.wass-results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wass-result-item {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: #ffffff;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.wass-result-item:hover {
    border-color: #dbe5f0;
    background: #f8fafc;
    transform: translateY(-1px);
}

.wass-result-image-link {
    display: block;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
    text-decoration: none;
}

.wass-result-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wass-result-content {
    min-width: 0;
}

.wass-result-title {
    display: block;
    color: var(--wass-front-text);
    font-size: 14px;
    line-height: 1.35;
    font-weight: 800;
    text-decoration: none;
}

.wass-result-title:hover {
    color: var(--wass-front-primary-dark);
    text-decoration: none;
}

.wass-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
    color: var(--wass-front-muted);
    font-size: 12px;
}

.wass-result-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #f1f5f9;
}

.wass-result-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 7px;
}

.wass-result-price {
    color: var(--wass-front-text);
    font-size: 14px;
    font-weight: 900;
}

.wass-result-price del {
    margin-right: 5px;
    color: #98a2b3;
    font-weight: 600;
    opacity: 0.85;
}

.wass-result-price ins {
    color: var(--wass-front-danger);
    text-decoration: none;
}

.wass-result-stock {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
}

.wass-stock-instock {
    background: #ecfdf3;
    color: #166534;
}

.wass-stock-onbackorder {
    background: #fffbeb;
    color: #92400e;
}

.wass-stock-outofstock {
    background: #fef2f2;
    color: #991b1b;
}

.wass-result-action {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.wass-result-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    background: var(--wass-front-primary);
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
    transition: 0.16s ease;
}

.wass-result-button:hover {
    background: var(--wass-front-primary-dark);
    color: #ffffff;
    text-decoration: none;
}

.wass-empty-state {
    padding: 16px;
    border-radius: 14px;
    background: #f8fafc;
    color: var(--wass-front-muted);
    font-size: 14px;
    text-align: center;
}

.wass-related-block {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--wass-front-border);
}

.wass-related-title {
    margin-bottom: 10px;
    color: var(--wass-front-text);
    font-size: 13px;
    font-weight: 900;
}

.wass-result-related {
    background: #fbfdff;
}

.wass-search-wrapper.is-loading .wass-search-input {
    background-image: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.05), transparent);
    background-size: 200% 100%;
    animation: wass-loading 1.1s linear infinite;
}

/* Floating assistant */
.wass-floating-search {
    --wass-front-bg: #ffffff;
    --wass-front-text: #172033;
    --wass-front-muted: #667085;
    --wass-front-border: #d9e1ec;
    --wass-front-primary: var(--wass-floating-color, #2563eb);
    --wass-front-primary-dark: color-mix(in srgb, var(--wass-floating-color, #2563eb) 78%, #000000);
    --wass-front-shadow: 0 18px 52px rgba(15, 23, 42, 0.2);

    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 999990;
    font-family: inherit;
    isolation: isolate;
}

.wass-floating-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 52px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--wass-front-primary), var(--wass-front-primary-dark));
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 14px 34px color-mix(in srgb, var(--wass-floating-color, #2563eb) 32%, transparent);
    transition: transform 0.18s ease, filter 0.18s ease;
}

.wass-floating-toggle:hover {
    filter: brightness(0.97);
    transform: translateY(-1px);
}

.wass-floating-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    font-size: 20px;
    line-height: 1;
}

.wass-floating-panel {
    position: absolute;
    right: 0;
    bottom: 66px;
    width: min(440px, calc(100vw - 32px));
    max-height: calc(100vh - 110px);
    padding: 14px;
    border: 1px solid var(--wass-front-border);
    border-radius: 22px;
    background: var(--wass-front-bg);
    box-shadow: var(--wass-front-shadow);
    opacity: 1;
    transform: translateY(0) scale(1);
    transform-origin: bottom right;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.wass-floating-search.is-collapsed .wass-floating-panel {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px) scale(0.96);
}

.wass-floating-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 2px 2px 8px;
    border-bottom: 1px solid #edf1f7;
}

.wass-floating-head strong {
    color: var(--wass-front-text);
    font-size: 14px;
    font-weight: 900;
}

.wass-floating-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #eef2f7;
    color: #667085;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.wass-floating-close:hover {
    background: #e2e8f0;
    color: #172033;
}

.wass-search-style-floating {
    max-width: none;
}

.wass-search-style-floating .wass-search-form {
    flex-direction: column;
}

.wass-search-style-floating .wass-search-submit {
    width: 100%;
}

.wass-search-style-floating .wass-results-dropdown {
    position: static;
    margin-top: 10px;
    box-shadow: none;
}

.wass-search-style-floating .wass-results-inner {
    max-height: min(56vh, 520px);
}

.wass-floating-panel .wass-search-submit,
.wass-floating-panel .wass-result-button {
    border-color: var(--wass-front-primary-dark);
    background: linear-gradient(135deg, var(--wass-front-primary), var(--wass-front-primary-dark));
}

/* Floating position options */
.wass-floating-position-bottom_right {
    right: 22px;
    bottom: 22px;
    left: auto;
    top: auto;
}

.wass-floating-position-bottom_left {
    left: 22px;
    bottom: 22px;
    right: auto;
    top: auto;
}

.wass-floating-position-top_right {
    right: 22px;
    top: 22px;
    left: auto;
    bottom: auto;
}

.wass-floating-position-top_left {
    left: 22px;
    top: 22px;
    right: auto;
    bottom: auto;
}

body.admin-bar .wass-floating-position-top_right,
body.admin-bar .wass-floating-position-top_left {
    top: 54px;
}

/* Panel direction per position */
.wass-floating-position-bottom_right .wass-floating-panel {
    right: 0;
    left: auto;
    bottom: 66px;
    top: auto;
    transform-origin: bottom right;
}

.wass-floating-position-bottom_left .wass-floating-panel {
    left: 0;
    right: auto;
    bottom: 66px;
    top: auto;
    transform-origin: bottom left;
}

.wass-floating-position-top_right .wass-floating-panel {
    right: 0;
    left: auto;
    top: 66px;
    bottom: auto;
    transform-origin: top right;
}

.wass-floating-position-top_left .wass-floating-panel {
    left: 0;
    right: auto;
    top: 66px;
    bottom: auto;
    transform-origin: top left;
}

/* Floating size options */
.wass-floating-size-icon .wass-floating-toggle {
    width: 56px;
    height: 56px;
    min-height: 56px;
    justify-content: center;
    padding: 0;
    border-radius: 999px;
}

.wass-floating-size-icon .wass-floating-label {
    display: none;
}

.wass-floating-size-icon .wass-floating-icon {
    width: 30px;
    height: 30px;
    font-size: 22px;
}

.wass-floating-size-small .wass-floating-toggle {
    min-height: 44px;
    padding: 0 14px;
    font-size: 13px;
}

.wass-floating-size-small .wass-floating-icon {
    width: 22px;
    height: 22px;
    font-size: 17px;
}

.wass-floating-size-normal .wass-floating-toggle {
    min-height: 52px;
    padding: 0 18px;
}

.wass-floating-size-wide {
    width: min(520px, calc(100vw - 44px));
}

.wass-floating-size-wide .wass-floating-toggle {
    width: 100%;
    justify-content: center;
    min-height: 54px;
    border-radius: 18px;
}

.wass-floating-size-wide .wass-floating-panel {
    width: 100%;
}

.wass-floating-size-full {
    left: 22px;
    right: 22px;
    width: auto;
}

.wass-floating-size-full.wass-floating-position-bottom_left,
.wass-floating-size-full.wass-floating-position-bottom_right {
    bottom: 22px;
    top: auto;
}

.wass-floating-size-full.wass-floating-position-top_left,
.wass-floating-size-full.wass-floating-position-top_right {
    top: 22px;
    bottom: auto;
}

body.admin-bar .wass-floating-size-full.wass-floating-position-top_left,
body.admin-bar .wass-floating-size-full.wass-floating-position-top_right {
    top: 54px;
}

.wass-floating-size-full .wass-floating-toggle {
    width: 100%;
    justify-content: center;
    min-height: 56px;
    border-radius: 18px;
}

.wass-floating-size-full .wass-floating-panel {
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
}

.wass-floating-size-full.wass-floating-position-bottom_left .wass-floating-panel,
.wass-floating-size-full.wass-floating-position-bottom_right .wass-floating-panel {
    bottom: 70px;
    top: auto;
    transform-origin: bottom center;
}

.wass-floating-size-full.wass-floating-position-top_left .wass-floating-panel,
.wass-floating-size-full.wass-floating-position-top_right .wass-floating-panel {
    top: 70px;
    bottom: auto;
    transform-origin: top center;
}

/* Browser and accessibility fixes */
.wass-search-wrapper input[type="search"]::-webkit-search-decoration,
.wass-search-wrapper input[type="search"]::-webkit-search-cancel-button,
.wass-search-wrapper input[type="search"]::-webkit-search-results-button,
.wass-search-wrapper input[type="search"]::-webkit-search-results-decoration {
    display: none;
}

.wass-search-wrapper .screen-reader-text,
.wass-floating-search .screen-reader-text {
    position: absolute !important;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    word-wrap: normal !important;
}

.wass-results-dropdown[hidden],
.wass-search-clear[hidden] {
    display: none !important;
}

.wass-floating-search button,
.wass-search-wrapper button,
.wass-floating-search input,
.wass-search-wrapper input {
    font-family: inherit;
}

.wass-search-wrapper .wass-result-button:focus,
.wass-search-wrapper .wass-result-title:focus,
.wass-search-wrapper .wass-result-image-link:focus,
.wass-search-wrapper .wass-search-submit:focus,
.wass-search-wrapper .wass-search-clear:focus,
.wass-floating-toggle:focus,
.wass-floating-close:focus {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 2px;
}

@supports not (color: color-mix(in srgb, #000 50%, #fff)) {
    .wass-floating-search {
        --wass-front-primary-dark: var(--wass-floating-color, #2563eb);
    }

    .wass-floating-toggle,
    .wass-floating-panel .wass-search-submit,
    .wass-floating-panel .wass-result-button {
        background: var(--wass-floating-color, #2563eb);
    }
}

@keyframes wass-loading {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

@media (max-width: 640px) {
    .wass-search-form {
        gap: 8px;
    }

    .wass-search-submit {
        padding: 0 14px;
    }

    .wass-result-item {
        grid-template-columns: 54px minmax(0, 1fr);
        gap: 10px;
    }

    .wass-result-image-link {
        width: 54px;
        height: 54px;
    }

    .wass-result-action {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .wass-result-button {
        width: 100%;
    }

    .wass-results-inner {
        max-height: 72vh;
    }

    .wass-floating-position-bottom_right,
    .wass-floating-position-top_right {
        right: 14px;
    }

    .wass-floating-position-bottom_left,
    .wass-floating-position-top_left {
        left: 14px;
    }

    .wass-floating-position-bottom_right,
    .wass-floating-position-bottom_left {
        bottom: 14px;
    }

    .wass-floating-position-top_right,
    .wass-floating-position-top_left {
        top: 14px;
    }

    body.admin-bar .wass-floating-position-top_right,
    body.admin-bar .wass-floating-position-top_left {
        top: 60px;
    }

    .wass-floating-size-wide {
        width: calc(100vw - 28px);
    }

    .wass-floating-size-full {
        left: 14px;
        right: 14px;
    }

    .wass-floating-position-bottom_right .wass-floating-panel,
    .wass-floating-position-bottom_left .wass-floating-panel {
        bottom: 62px;
    }

    .wass-floating-position-top_right .wass-floating-panel,
    .wass-floating-position-top_left .wass-floating-panel {
        top: 62px;
    }

    .wass-floating-panel {
        width: calc(100vw - 28px);
    }
}

@media (max-width: 420px) {
    .wass-search-form {
        flex-direction: column;
    }

    .wass-search-submit {
        width: 100%;
    }

    .wass-floating-size-icon .wass-floating-label,
    .wass-floating-size-small .wass-floating-label,
    .wass-floating-size-normal .wass-floating-label {
        display: none;
    }

    .wass-floating-size-icon .wass-floating-toggle,
    .wass-floating-size-small .wass-floating-toggle,
    .wass-floating-size-normal .wass-floating-toggle {
        width: 54px;
        height: 54px;
        justify-content: center;
        padding: 0;
        border-radius: 999px;
    }

    .wass-floating-size-wide .wass-floating-label,
    .wass-floating-size-full .wass-floating-label {
        display: inline;
    }
}

@media (max-width: 360px) {
    .wass-result-meta {
        display: none;
    }

    .wass-result-title {
        font-size: 13px;
    }

    .wass-result-bottom {
        gap: 5px;
    }
}

/**
 * WebARTing Smart Search - Recent search history CSS.
 * Append at the end of assets/css/frontend.css
 */

.wass-history-inner {
    padding: 14px;
}

.wass-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.wass-history-header strong {
    color: var(--wass-front-text);
    font-size: 13px;
    font-weight: 900;
}

.wass-history-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid #d9e1ec;
    border-radius: 999px;
    background: #ffffff;
    color: #667085;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.16s ease;
}

.wass-history-clear:hover {
    border-color: var(--wass-front-primary);
    color: var(--wass-front-primary);
    background: #f8fafc;
}

.wass-history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wass-history-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid #d9e1ec;
    border-radius: 999px;
    background: #f8fafc;
    color: #344054;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.16s ease;
}

.wass-history-chip::before {
    content: "⌕";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--wass-front-primary);
    font-size: 12px;
    line-height: 1;
}

.wass-history-chip:hover {
    border-color: var(--wass-front-primary);
    background: #ffffff;
    color: var(--wass-front-primary);
    transform: translateY(-1px);
}

.wass-search-style-floating .wass-history-inner {
    max-height: min(46vh, 420px);
    overflow-y: auto;
}

@media (max-width: 420px) {
    .wass-history-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .wass-history-chip {
        width: 100%;
        justify-content: flex-start;
    }
}

