:root,
[data-bs-theme=dark],
[data-bs-theme=light] {
    --ais-secondary-color: color-mix(in srgb, var(--ais-primary-color) 80%, #000 20%)
}

.autocomplete-heading,
.autocomplete-item {
    border-bottom: 1px solid var(--ais-border-color)
}

.autocomplete-img,
.autocomplete-item,
.autocomplete-results,
.category-name {
    transition: var(--ais-transition)
}

:root,
[data-bs-theme=light] {
    --ais-primary-color: #6366f1;
    --ais-text-color: #1f2937;
    --ais-light-text: #6b7280;
    --ais-background: #f9fafb;
    --ais-card-bg: #fff;
    --ais-border-color: #e5e7eb;
    --ais-shadow: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05);
    --ais-hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 10px 10px -5px rgba(0, 0, 0, .04);
    --ais-transition: all .2s ease
}

[data-bs-theme=dark] {
    --ais-primary-color: #818cf8;
    --ais-text-color: #f9fafb;
    --ais-light-text: #d1d5db;
    --ais-background: #1f2937;
    --ais-card-bg: #111827;
    --ais-border-color: #374151;
    --ais-shadow: 0 10px 15px -3px rgba(0, 0, 0, .3), 0 4px 6px -2px rgba(0, 0, 0, .25);
    --ais-hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, .3), 0 10px 10px -5px rgba(0, 0, 0, .2)
}

#aisearch-input::-webkit-search-cancel-button{
    position:relative;
    right:20px;
}

.autocomplete-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--ais-card-bg);
    border-radius: 12px;
    box-shadow: var(--ais-shadow);
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1050;
    border: 1px solid var(--ais-border-color);
    display: none;
    opacity: 0;
    transform: translateY(-10px)
}

.autocomplete-results.show {
    display: block;
    opacity: 1;
    transform: translateY(0)
}

.autocomplete-results:hover {
    box-shadow: var(--ais-hover-shadow)
}

.autocomplete-row {
    display: flex;
    padding: 0 1em
}

.autocomplete-section-row {
    padding: 10px 0
}

.autocomplete-section-row:first-child {
    width: 28%;
    border-right: 1px solid var(--ais-border-color);
    padding-right: 15px
}

.autocomplete-section-row:last-child {
    width: 72%;
    padding-left: 15px
}

.autocomplete-section-row:only-child {
    width: 100%;
    border-right: none;
    padding-right: 0;
    padding-left: 0
}

.autocomplete-section-category {
    list-style: none;
    padding: 0;
    margin: 0
}

.autocomplete-heading {
    font-size: .85rem;
    font-weight: 600;
    color: var(--ais-light-text);
    padding: .7rem 1rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 5px
}

.autocomplete-item,
.autocomplete-name,
.category-name {
    color: var(--ais-text-color)
}

.autocomplete-item {
    display: flex;
    align-items: center;
    padding: .8rem 1rem;
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden
}

.autocomplete-description,
.autocomplete-name {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical
}

.autocomplete-item.category {
    border: none;
    padding: .5rem 1rem;
    border-radius: 6px
}

.autocomplete-item:hover {
    background: var(--ais-background)
}

.autocomplete-item.category>a {
    width: 100%
}

.autocomplete-item:last-child {
    border-bottom: none
}

.autocomplete-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 1rem;
    border: 1px solid var(--ais-border-color)
}

.autocomplete-item:hover .autocomplete-img {
    transform: scale(1.05)
}

.autocomplete-info {
    flex-grow: 1;
    overflow: hidden
}

.category-name {
    font-weight: 500
}

.autocomplete-item.category:hover .category-name {
    color: var(--ais-primary-color);
    transform: translateX(3px)
}

.autocomplete-name {
    font-weight: 600;
    margin-bottom: .2rem;
    -webkit-line-clamp: 2;
    line-clamp: 2
}

.autocomplete-description mark,
.autocomplete-name mark {
    color: var(--ais-primary-color);
    font-style: normal;
    font-weight: 700
}

.autocomplete-sku {
    color: var(--ais-light-text);
    font-size: .8rem;
    margin-bottom: .2rem
}

.autocomplete-description {
    text-overflow: ellipsis;
    color: var(--ais-light-text);
    font-size: .85rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    margin-top: 3px
}

.autocomplete-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 135px;
    justify-content: center
}

.autocomplete-price-original {
    font-size: .75rem;
    color: var(--ais-light-text);
    text-decoration: line-through
}

.autocomplete-price-current {
    font-weight: 700;
    color: var(--ais-secondary-color);
    font-size: 1.05rem
}

.no-results {
    padding: 2rem;
    text-align: center;
    color: var(--ais-light-text);
    font-style: italic
}

@media (max-width:768px) {
    .autocomplete-row {
        flex-direction: column;
        padding: 0
    }

    .autocomplete-section-row:first-child,
    .autocomplete-section-row:last-child {
        width: 100%;
        border-right: none;
        padding-right: 0;
        padding-left: 0
    }

    .autocomplete-section-row:first-child {
        border-bottom: 1px solid var(--ais-border-color)
    }

    .autocomplete-img {
        width: 50px;
        height: 50px
    }
}

@media (max-width:480px) {
    .autocomplete-item {
        padding: .6rem
    }

    .autocomplete-info {
        margin-left: .5rem;
        width: 60%
    }

    .autocomplete-price {
        min-width: 100px
    }

    .autocomplete-price-current {
        font-size: .95rem
    }
}

.autocomplete-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--ais-primary-color);
    transition: width .3s
}

.autocomplete-item:hover::after {
    width: 100%
}

.autocomplete-results::-webkit-scrollbar {
    width: 8px
}

.autocomplete-results::-webkit-scrollbar-track {
    background: var(--ais-background);
    border-radius: 10px
}

.autocomplete-results::-webkit-scrollbar-thumb {
    background: var(--ais-light-text);
    border-radius: 10px
}

.autocomplete-results::-webkit-scrollbar-thumb:hover {
    background: var(--ais-primary-color)
}

#aisearch-mic {
    position: absolute;
    right: 75px;
    top: 50%;
    transform: translateY(-50%);
    background: 0 0;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 5;
    color: #6b7280;
    transition: color .2s
}

#aisearch-camera {
    position: absolute;
    right: 45px;
    top: 50%;
    transform: translateY(-50%);
    background: 0 0;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 5;
    color: #6b7280;
    transition: color .2s
}

#aisearch-mic:hover,
#aisearch-camera:hover {
    color: var(--ais-primary-color)
}

header[role=banner] .UI-SEARCH {
    padding-left: 15px !important;
    padding-right: 110px !important;
    transition: padding-left .2s ease
}

header[role=banner] .UI-SEARCH.has-image-preview {
    padding-left: 70px !important
}

#aisearch-mic.listening {
    color: #e02b27;
    animation: pulse-mic 1.5s infinite
}

@keyframes pulse-mic {
    0% {
        opacity: 1
    }

    50% {
        opacity: .4
    }

    100% {
        opacity: 1
    }
}

.aisearch-image-modal {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--ais-card-bg);
    border-radius: 12px;
    box-shadow: var(--ais-shadow);
    z-index: 1050;
    border: 1px solid var(--ais-border-color);
    padding: 30px 20px 20px;
    box-sizing: border-box;
    color: var(--ais-text-color);
    animation: fadeInDown .3s ease-out
}

.aisearch-modal-close {
    position: absolute;
    top: 3px;
    right: 10px;
    background: none;
    border: none;
    color: var(--ais-light-text);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: color .2s
}

.aisearch-modal-close:hover {
    color: var(--ais-primary-color)
}

.aisearch-dropzone {
    border: 1px dashed var(--ais-border-color);
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    background: var(--ais-card-bg);
    transition: background .2s, border-color .2s;
    position: relative;
    outline: none;
}

.aisearch-dropzone.dragover,
.aisearch-dropzone:focus {
    background: var(--ais-background);
    border-color: var(--ais-primary-color)
}

.aisearch-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px
}

.aisearch-image-icon {
    color: #8ab4f8;
    display: flex;
    align-items: center;
    justify-content: center
}

.aisearch-dropzone-text {
    margin: 0;
    font-size: 14px;
    color: var(--ais-text-color);
    line-height: 1.5
}

.aisearch-dropzone-text .upload-link {
    color: var(--ais-primary-color);
    text-decoration: underline;
    font-weight: 500;
    cursor: pointer
}

.aisearch-dropzone-text .upload-link:hover {
    color: #aecbfa
}

.aisearch-dropzone-text .kbd {
    background: var(--ais-card-bg);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    color: var(--ais-light-text)
}

.aisearch-input-preview-container {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    background: var(--ais-background);
    border-radius: 6px;
    padding: 3px 6px;
    z-index: 6;
    height: 34px;
    border: 1px solid var(--ais-border-color);
    box-sizing: border-box;
}

#aisearch-input.has-image-preview {
    padding-left: 100px !important;
}

.aisearch-input-preview-container img {
    height: 24px;
    width: 24px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 6px
}

.aisearch-input-preview-container button {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--ais-light-text);
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .2s
}

.aisearch-input-preview-container button:hover {
    color: #e02b27
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.aisearch-recent-container { display: flex; gap: 20px; padding: 15px; background: #fff; border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.aisearch-history-column { flex: 1; min-width: 200px; border-right: 1px solid #eee; padding-right: 20px; }
.aisearch-products-column { flex: 2; }
.aisearch-recent-title-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; padding-bottom: 5px; margin-bottom: 10px; }
.aisearch-recent-title { font-size: 13px; font-weight: bold; color: #444; }
.aisearch-clear-history { font-size: 11px; color: #999; text-decoration: none; cursor: pointer; }
.aisearch-clear-history:hover { color: var(--ais-primary-color, #000); }
.aisearch-history-list { list-style: none; padding: 0; margin: 0; }
.aisearch-history-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed #f5f5f5; }
.aisearch-history-link { font-size: 13px; color: #555; text-decoration: none; display: block; width: 85%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aisearch-history-link:hover { color: var(--ais-primary-color, #000); }
.aisearch-history-remove { font-size: 14px; color: #ccc; cursor: pointer; border: none; background: none; padding: 0 5px; }
.aisearch-history-remove:hover { color: #e02b27; }
.aisearch-recent-row { display: flex; flex-wrap: wrap; gap: 10px; }
.aisearch-recent-card { display: flex; flex-direction: column; width: 125px; border: 1px solid #eee; border-radius: 4px; padding: 8px; text-decoration: none; color: #333; transition: all 0.2s ease; }
.aisearch-recent-card:hover { border-color: var(--ais-primary-color, #000); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.aisearch-recent-card img { width: 100%; height: 80px; object-fit: contain; margin-bottom: 5px; }
.aisearch-recent-card-name { font-size: 11px; font-weight: 500; height: 32px; overflow: hidden; line-height: 16px; margin-bottom: 5px; }
.aisearch-recent-card-price { font-size: 12px; font-weight: bold; color: var(--ais-primary-color, #000); }
@media (max-width: 600px) {
    .aisearch-recent-container { flex-direction: column; }
    .aisearch-history-column { border-right: none; border-bottom: 1px solid #eee; padding-right: 0; padding-bottom: 15px; }
    .aisearch-recent-row{gap: 5px;}
    .aisearch-recent-card{width: 120px;}
}
