.aels-wrapper,
.aels-wrapper * {
    box-sizing: border-box;
}

.aels-wrapper {
    --aels-width: 420px;
    --aels-accent: #111111;
    --aels-icon: #111111;
    position: relative;
    display: inline-flex;
    align-items: center;
    font-family: inherit;
}

.aels-toggle {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--aels-icon);
    cursor: pointer;
    padding: 0;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.aels-toggle:hover,
.aels-toggle:focus-visible {
    background: rgba(0, 0, 0, .07);
    color: var(--aels-accent);
    outline: none;
}

.aels-open .aels-toggle {
    transform: scale(.96);
}

.aels-icon {
    display: block;
}

.aels-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(var(--aels-width), calc(100vw - 28px));
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
    padding: 16px;
    z-index: 999999;
    opacity: 0;
    transform: translateY(-8px) scale(.98);
    pointer-events: none;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: opacity .18s ease, transform .18s ease;
}

.aels-wrapper.aels-open .aels-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.aels-form {
    display: flex;
    gap: 10px;
    margin: 0;
}

.aels-input {
    width: 100%;
    min-width: 0;
    height: 48px;
    border: 1px solid rgba(15, 23, 42, .14);
    border-radius: 12px;
    background: #fff;
    color: #111827;
    font-size: 15px;
    line-height: 1.3;
    padding: 0 14px;
    outline: none;
    box-shadow: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.aels-input:focus {
    border-color: var(--aels-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--aels-accent) 18%, transparent);
}

.aels-submit,
.aels-view-all {
    border: 0;
    border-radius: 12px;
    background: var(--aels-accent);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: filter .18s ease, transform .18s ease;
}

.aels-submit {
    min-height: 48px;
    padding: 0 18px;
}

.aels-submit:hover,
.aels-view-all:hover {
    color: #fff;
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.aels-loader {
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: center;
    min-height: 42px;
}

.aels-loader span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--aels-accent);
    animation: aelsPulse .8s ease-in-out infinite;
}

.aels-loader span:nth-child(2) {
    animation-delay: .12s;
}

.aels-loader span:nth-child(3) {
    animation-delay: .24s;
}

@keyframes aelsPulse {
    0%, 80%, 100% { opacity: .25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-4px); }
}

.aels-results {
    margin-top: 12px;
    max-height: 360px;
    overflow: auto;
    overscroll-behavior: contain;
}

.aels-result {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px;
    border-radius: 14px;
    color: #111827;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.aels-result:hover,
.aels-result.aels-active {
    background: rgba(15, 23, 42, .045);
    border-color: rgba(15, 23, 42, .08);
    color: #111827;
    transform: translateX(2px);
}

.aels-thumb {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border-radius: 13px;
    overflow: hidden;
    background: #f3f4f6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.aels-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.aels-thumb-fallback {
    font-weight: 800;
    color: var(--aels-accent);
}

.aels-result-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.aels-result-topline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.aels-result-title {
    min-width: 0;
    flex: 1;
    color: inherit;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
}

.aels-type-badge {
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgba(15, 23, 42, .07);
    color: #4b5563;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    line-height: 1;
}

.aels-price {
    color: var(--aels-accent);
    font-size: 13px;
    font-weight: 800;
}

.aels-price del {
    opacity: .55;
    font-weight: 500;
}

.aels-excerpt {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.4;
}

.aels-result mark {
    background: color-mix(in srgb, var(--aels-accent) 18%, transparent);
    color: inherit;
    border-radius: 4px;
    padding: 0 2px;
}

.aels-empty {
    margin-top: 12px;
    padding: 18px 14px;
    border-radius: 14px;
    background: rgba(15, 23, 42, .045);
    color: #6b7280;
    font-size: 14px;
    text-align: center;
}

.aels-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 12px;
    padding: 0 16px;
}

.aels-dark .aels-panel {
    background: rgba(17, 24, 39, .96);
    border-color: rgba(255, 255, 255, .08);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}

.aels-dark .aels-input {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .12);
    color: #fff;
}

.aels-dark .aels-input::placeholder {
    color: rgba(255, 255, 255, .55);
}

.aels-dark .aels-result,
.aels-dark .aels-result:hover,
.aels-dark .aels-result.aels-active {
    color: #fff;
}

.aels-dark .aels-result:hover,
.aels-dark .aels-result.aels-active,
.aels-dark .aels-empty {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .12);
}

.aels-dark .aels-type-badge {
    background: rgba(255, 255, 255, .12);
    color: rgba(255, 255, 255, .75);
}

.aels-dark .aels-excerpt,
.aels-dark .aels-empty {
    color: rgba(255, 255, 255, .68);
}

@media (max-width: 767px) {
    .aels-panel {
        position: fixed;
        top: 76px;
        left: 14px;
        right: 14px;
        width: auto;
    }

    .aels-form {
        flex-direction: column;
    }

    .aels-submit {
        width: 100%;
    }

    .aels-results {
        max-height: 55vh;
    }

    .aels-result-topline {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }
}
