/* ===== AJAX Search Dropdown ===== */

/* Dropdown container — positioned inside .search-wrapper */
.sd {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.14);
    z-index: 9999;
    overflow: hidden;
    animation: sd-in 0.15s ease;
}

@keyframes sd-in {
    from { opacity:0; transform:translateY(-6px); }
    to   { opacity:1; transform:translateY(0); }
}

/* ---- State messages ---- */
.sd-state {
    padding: 18px 20px;
    text-align: center;
    font-size: 13px;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sd-state--empty::before {
    content: '🔍';
    font-size: 16px;
}

/* Spinner */
.sd-spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 2px solid #e8e8e8;
    border-top-color: #3ba54e;
    border-radius: 50%;
    animation: sd-spin 0.65s linear infinite;
    flex-shrink: 0;
}

@keyframes sd-spin { to { transform: rotate(360deg); } }

/* ---- Product list ---- */
.sd-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}

.sd-item + .sd-item {
    border-top: 1px solid #f2f2f2;
}

.sd-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    cursor: pointer;
}

.sd-link:hover {
    background: #f4fbf5;
    text-decoration: none;
}

/* ---- Image ---- */
.sd-media { flex-shrink: 0; }

.sd-img {
    width: 62px;
    height: 62px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid #efefef;
    background: #fafafa;
    display: block;
}

.sd-img--ph {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.sd-img--ph svg {
    width: 26px;
    height: 26px;
    color: #ccc;
}

/* ---- Body ---- */
.sd-body {
    flex: 1;
    min-width: 0;
}

.sd-name {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.35;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sd-sku {
    font-size: 11px;
    color: #b0b0b0;
    display: block;
    margin-bottom: 3px;
}

.sd-text {
    margin: 0;
    font-size: 12px;
    color: #888;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ---- Aside (price + button) ---- */
.sd-aside {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    min-width: 80px;
}

.sd-price {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    white-space: nowrap;
    text-align: right;
}

.sd-price ins { text-decoration: none; }
.sd-price del { font-size: 11px; color: #bbb; font-weight: 400; margin-right: 2px; }

.sd-btn {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, #2d8c3c, #3ba54e);
    color: #fff;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    transition: opacity 0.18s;
}

.sd-link:hover .sd-btn { opacity: 0.82; }

/* ---- "All results" footer ---- */
.sd-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 11px 14px;
    border-top: 1px solid #f0f0f0;
    font-size: 13px;
    font-weight: 600;
    color: #2d8c3c;
    text-decoration: none;
    background: #f8fcf8;
    transition: background 0.15s, color 0.15s;
}

.sd-all:hover {
    background: #edf7ee;
    color: #1e6a2a;
    text-decoration: none;
}

.sd-all-n {
    font-weight: 400;
    color: #999;
    font-size: 12px;
}


/* ===== Category Dropdown (sc = search-category) ===== */

.sc-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* The trigger button */
.sc-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 12px 0 14px;
    height: 38px;
    background: none;
    border: none;
    border-right: 1px solid rgba(255,255,255,0.25);
    cursor: pointer;
    color: inherit;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 0.15s;
    outline: none;
}

.sc-btn:hover { opacity: 0.75; }
.sc-btn:focus-visible { outline: 2px solid currentColor; border-radius: 4px; }

.sc-arrow {
    transition: transform 0.2s;
    flex-shrink: 0;
    opacity: 0.7;
}
.sc-btn[aria-expanded="true"] .sc-arrow {
    transform: rotate(180deg);
}

/* Panel */
.sc-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 230px;
    max-height: 320px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.13);
    overflow-y: auto;
    z-index: 10000;
    animation: sc-in 0.15s ease;
    scrollbar-width: thin;
    scrollbar-color: #d0d0d0 transparent;
}

.sc-panel::-webkit-scrollbar { width: 5px; }
.sc-panel::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 3px; }

@keyframes sc-in {
    from { opacity:0; transform:translateY(-6px); }
    to   { opacity:1; transform:translateY(0); }
}

/* List */
.sc-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}

.sc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 16px;
    font-size: 13px;
    color: #222;
    cursor: pointer;
    transition: background 0.12s;
    outline: none;
    gap: 6px;
}

.sc-item:hover { background: #f4fbf5; }

.sc-item:focus-visible { background: #edf7ee; }

.sc-item--active {
    font-weight: 700;
    color: #2d8c3c;
    background: #f0f9f1;
}

.sc-item--active::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-right: 2px solid #2d8c3c;
    border-bottom: 2px solid #2d8c3c;
    transform: rotate(45deg) translateY(-2px);
    flex-shrink: 0;
}

.sc-count {
    font-size: 11px;
    color: #aaa;
    font-weight: 400;
    margin-left: auto;
}


/* ===== SKU Autocomplete Chips ===== */

.sd-sku-section {
    padding: 10px 14px 6px;
    border-bottom: 1px solid #f0f0f0;
}

.sd-sku-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #bbb;
    margin-bottom: 7px;
}

.sd-sku-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sd-sku-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1.5px solid #d8eeda;
    border-radius: 100px;
    background: #f5fbf6;
    color: #2d8c3c;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    white-space: nowrap;
    outline: none;
    line-height: 1;
}

.sd-sku-chip:hover {
    background: #e8f5ea;
    border-color: #2d8c3c;
    transform: translateY(-1px);
}

.sd-sku-chip:focus-visible {
    outline: 2px solid #2d8c3c;
    outline-offset: 2px;
}

.sd-sku-chip::before {
    content: '#';
    opacity: 0.45;
    font-weight: 400;
    font-size: 10px;
}

/* ===== Highlight matching text ===== */

.sd-hl {
    background: none;
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: #3ba54e;
    text-underline-offset: 2px;
}

/* SKU chips also highlight */
.sd-sku-chip .sd-hl {
    text-decoration: none;
    background: rgba(59,165,78,0.15);
    border-radius: 2px;
    padding: 0 1px;
}
