/* =========================================
   DTECH AJAX Search — Dropdown Styles
   ========================================= */

/* ── Search Dropdown Container ────────────────────────── */
.dtech-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--dtech-white);
    border-radius: 0 0 10px 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .15);
    z-index: 100003;
    max-height: 480px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--dtech-g200) transparent;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .2s var(--dtech-ease), transform .2s var(--dtech-ease);
    pointer-events: none;
}

.dtech-search-dropdown::-webkit-scrollbar {
    width: 5px;
}
.dtech-search-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.dtech-search-dropdown::-webkit-scrollbar-thumb {
    background: var(--dtech-g200);
    border-radius: 3px;
}

/* Visible state */
.dtech-search-dropdown.is-open {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ── Product Result Item ──────────────────────────────── */
.dtech-sr-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--dtech-dark);
    transition: background .15s var(--dtech-ease);
    border-bottom: 1px solid var(--dtech-g100);
    cursor: pointer;
}
.dtech-sr-item:last-of-type {
    border-bottom: none;
}
.dtech-sr-item:hover,
.dtech-sr-item:focus,
.dtech-sr-item.is-active {
    background: var(--dtech-g50);
    outline: none;
}
.dtech-sr-item:focus-visible {
    outline: 2px solid var(--dtech-red);
    outline-offset: -2px;
    background: var(--dtech-g50);
}

/* ── Thumbnail ────────────────────────────────────────── */
.dtech-sr-img {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--dtech-g100);
}
.dtech-sr-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Info Block ───────────────────────────────────────── */
.dtech-sr-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.dtech-sr-name {
    font-family: var(--dtech-geo);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--dtech-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.dtech-sr-name strong {
    color: var(--dtech-red);
    font-weight: 700;
}
.dtech-sr-cat {
    display: inline-block;
    font-family: var(--dtech-geo);
    font-size: 11px;
    font-weight: 500;
    color: var(--dtech-red);
    background: var(--dtech-red-soft);
    padding: 1px 7px;
    border-radius: 4px;
    line-height: 1.5;
    max-width: fit-content;
}
.dtech-sr-sku {
    font-family: var(--dtech-mono);
    font-size: 10.5px;
    color: var(--dtech-g400);
    line-height: 1.3;
}

/* ── Price ────────────────────────────────────────────── */
.dtech-sr-price {
    flex-shrink: 0;
    text-align: right;
    font-family: var(--dtech-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--dtech-dark);
    white-space: nowrap;
}
.dtech-sr-price del {
    color: var(--dtech-g400);
    font-weight: 400;
    font-size: 11px;
}
.dtech-sr-price ins {
    text-decoration: none;
    color: var(--dtech-red);
}

/* ── Category Suggestions Section ─────────────────────── */
.dtech-sr-categories {
    padding: 8px 16px 4px;
    border-top: 1px solid var(--dtech-g100);
}
.dtech-sr-categories-title {
    font-family: var(--dtech-geo);
    font-size: 11px;
    font-weight: 600;
    color: var(--dtech-g400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.dtech-sr-cat-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--dtech-geo);
    font-size: 12.5px;
    color: var(--dtech-g600);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 5px;
    margin: 0 4px 4px 0;
    background: var(--dtech-g50);
    border: 1px solid var(--dtech-g200);
    transition: all .15s var(--dtech-ease);
}
.dtech-sr-cat-link:hover,
.dtech-sr-cat-link:focus,
.dtech-sr-cat-link.is-active {
    background: var(--dtech-red-soft);
    border-color: var(--dtech-red-border);
    color: var(--dtech-red);
    outline: none;
}
.dtech-sr-cat-link:focus-visible {
    outline: 2px solid var(--dtech-red);
    outline-offset: -2px;
}
.dtech-sr-cat-count {
    font-family: var(--dtech-mono);
    font-size: 10px;
    color: var(--dtech-g400);
}

/* ── Footer: View All Results ─────────────────────────── */
.dtech-sr-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-top: 1px solid var(--dtech-g200);
    background: var(--dtech-g50);
    border-radius: 0 0 10px 10px;
}
.dtech-sr-footer a {
    font-family: var(--dtech-geo);
    font-size: 13px;
    font-weight: 600;
    color: var(--dtech-red);
    text-decoration: none;
    transition: color .15s var(--dtech-ease);
}
.dtech-sr-footer a:hover,
.dtech-sr-footer a:focus {
    color: var(--dtech-red-h);
    text-decoration: underline;
    outline: none;
}
.dtech-sr-footer a:focus-visible {
    outline: 2px solid var(--dtech-red);
    outline-offset: 2px;
}
.dtech-sr-footer a.is-active {
    color: var(--dtech-red-h);
    text-decoration: underline;
}

/* ── Loading State ────────────────────────────────────── */
.dtech-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 16px;
    font-family: var(--dtech-geo);
    font-size: 13px;
    color: var(--dtech-g400);
}
.dtech-search-loading::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid var(--dtech-g200);
    border-top-color: var(--dtech-red);
    border-radius: 50%;
    animation: dtechSpin .6s linear infinite;
}
@keyframes dtechSpin {
    to { transform: rotate(360deg); }
}

/* ── Empty / No Results State ─────────────────────────── */
.dtech-search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    text-align: center;
}
.dtech-search-empty-icon {
    width: 40px;
    height: 40px;
    color: var(--dtech-g300);
    margin-bottom: 10px;
}
.dtech-search-empty-text {
    font-family: var(--dtech-geo);
    font-size: 13.5px;
    color: var(--dtech-g500);
    font-weight: 500;
}

/* ── Mobile Dropdown ──────────────────────────────────── */
.dtech-search-dropdown--mobile {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    border-radius: 0;
    max-height: calc(100vh - 56px);
    max-height: calc(100dvh - 56px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
    z-index: 100004;
}
.dtech-search-dropdown--mobile .dtech-sr-item {
    padding: 10px 14px;
    gap: 10px;
}
.dtech-search-dropdown--mobile .dtech-sr-img {
    width: 42px;
    height: 42px;
}
.dtech-search-dropdown--mobile .dtech-sr-name {
    font-size: 13px;
}
.dtech-search-dropdown--mobile .dtech-sr-price {
    font-size: 12px;
}
.dtech-search-dropdown--mobile .dtech-sr-footer {
    border-radius: 0;
}

/* ── Responsive: Show/hide correct dropdown ───────────── */
@media (max-width: 768px) {
    .dtech-search-dropdown:not(.dtech-search-dropdown--mobile) {
        display: none !important;
    }
}
@media (min-width: 769px) {
    .dtech-search-dropdown--mobile {
        display: none !important;
    }
}
