/* =====================================================
   Anatecs Search Overlay
   Couleurs : #116483 (contrast), #FFFFFF (base),
              #cfe0e6 (accent-3), #e5f8ff (accent-4)
   ===================================================== */

#anatecs-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

#anatecs-search-overlay:not([hidden]) {
    pointer-events: auto;
}

#anatecs-search-overlay.is-open {
    opacity: 1;
}

/* ---------- Backdrop ---------- */
#anatecs-search-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 100, 131, 0.30);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* ---------- Panel ---------- */
#anatecs-search-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 700px;
    margin: 72px 16px 16px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 24px 64px rgba(17, 100, 131, 0.16), 0 4px 16px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 100px);
    transform: translateY(-16px);
    transition: transform 0.25s ease;
}

#anatecs-search-overlay.is-open #anatecs-search-panel {
    transform: translateY(0);
}

/* ---------- Header / Input ---------- */
#anatecs-search-header {
    display: flex;
    align-items: center;
    padding: 0 16px 0 20px;
    border-bottom: 1.5px solid #cfe0e6;
    flex-shrink: 0;
}

#anatecs-search-input-wrap {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 12px;
    color: #116483;
}

#anatecs-search-input-wrap > svg {
    flex-shrink: 0;
    opacity: 0.7;
}

#anatecs-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    padding: 18px 0;
    background: transparent;
    color: #1a1a1a;
    font-family: inherit;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
}

#anatecs-search-input::-webkit-search-cancel-button { display: none; }
#anatecs-search-input::placeholder { color: #99bbc9; }

#anatecs-search-close {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #116483;
    padding: 8px;
    margin-left: 4px;
    opacity: 0.55;
    transition: opacity 0.18s;
    flex-shrink: 0;
    border-radius: 4px;
}

#anatecs-search-close:hover { opacity: 1; }

/* ---------- Results ---------- */
#anatecs-search-results {
    overflow-y: auto;
    flex: 1;
    overscroll-behavior: contain;
}

/* Loading dots */
.as-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 44px 20px;
}

.as-loading span {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #116483;
    animation: as-pulse 0.85s infinite alternate ease-in-out;
}
.as-loading span:nth-child(2) { animation-delay: 0.17s; }
.as-loading span:nth-child(3) { animation-delay: 0.34s; }

@keyframes as-pulse {
    from { opacity: 0.25; transform: scale(0.65); }
    to   { opacity: 1;    transform: scale(1); }
}

/* Empty / error */
.as-message {
    margin: 0;
    padding: 40px 24px;
    text-align: center;
    color: #99bbc9;
    font-size: 0.9rem;
}

/* ---------- Groups ---------- */
.as-group {
    padding-bottom: 4px;
}

.as-group + .as-group {
    border-top: 1px solid #e5f8ff;
}

.as-group-title {
    margin: 0;
    padding: 14px 20px 6px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #99bbc9;
}

.as-group-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ---------- Items ---------- */
.as-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 20px;
    text-decoration: none;
    color: inherit;
    transition: background 0.13s;
}

.as-item:hover {
    background: #e5f8ff;
    text-decoration: none;
}

.as-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
    background: #cfe0e6;
    display: block;
}

.as-thumb--empty {
    display: flex;
}

.as-item-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.as-item-title {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-item-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.as-badge {
    font-size: 0.68rem;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 3px;
    white-space: nowrap;
}

.as-badge--sku   { background: #e5f8ff; color: #116483; }
.as-badge--brand { background: #cfe0e6; color: #116483; }
.as-badge--cat   { background: #a4b49f22; color: #5a6e58; }

.as-item-excerpt {
    display: block;
    font-size: 0.76rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
    #anatecs-search-panel {
        margin: 0;
        border-radius: 0;
        max-height: 100dvh;
        height: 100dvh;
    }

    #anatecs-search-overlay {
        align-items: flex-start;
    }

    .as-item { padding: 10px 14px; }
    .as-group-title { padding: 12px 14px 4px; }
}
