/* ============================================================
   Nubexa Product Search — v1.0.0
   Dark-theme-first styles for Nubexa V42
   ============================================================ */

/* ── Variables (easy to tweak) ─────────────────────────── */
:root {
    --nbs-bg:           #1a1a2e;
    --nbs-bg-input:     #16213e;
    --nbs-bg-hover:     #0f3460;
    --nbs-border:       rgba(128,128,128,0.25);
    --nbs-text:         #e0e0e0;
    --nbs-text-muted:   #8a8a9a;
    --nbs-accent:       #2cb5a0;        /* Nubexa teal */
    --nbs-accent-dark:  #1e8a79;
    --nbs-radius:       10px;
    --nbs-shadow:       0 8px 32px rgba(0,0,0,0.45);
    --nbs-transition:   0.2s ease;
}

/* ── Overlay ───────────────────────────────────────────── */
.nbs-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(10, 10, 20, 0.92);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.nbs-overlay.active {
    opacity: 1;
    visibility: visible;
}

.nbs-overlay-inner {
    width: 90%;
    max-width: 620px;
    position: relative;
}

.nbs-overlay-close {
    position: absolute;
    top: -48px;
    right: 0;
    background: none;
    border: none;
    color: var(--nbs-text-muted);
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    transition: color var(--nbs-transition);
}
.nbs-overlay-close:hover {
    color: #fff;
}

/* ── Floating toggle button ────────────────────────────── */
.nbs-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99998;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    background: var(--nbs-accent);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(44,181,160,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--nbs-transition), box-shadow var(--nbs-transition);
}
.nbs-toggle svg {
    width: 22px;
    height: 22px;
}
.nbs-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(44,181,160,0.55);
}

/* ── Search wrapper ────────────────────────────────────── */
.nbs-wrap {
    position: relative;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Input ──────────────────────────────────────────────── */
.nbs-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.nbs-icon {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    color: var(--nbs-text-muted);
    pointer-events: none;
    transition: color var(--nbs-transition);
}

.nbs-input {
    width: 100%;
    padding: 14px 80px 14px 48px;
    font-size: 16px;
    color: var(--nbs-text);
    background: var(--nbs-bg-input);
    border: 1px solid var(--nbs-border);
    border-radius: var(--nbs-radius);
    outline: none;
    transition: border-color var(--nbs-transition), box-shadow var(--nbs-transition);
}
.nbs-input::placeholder {
    color: var(--nbs-text-muted);
}
.nbs-input:focus {
    border-color: var(--nbs-accent);
    box-shadow: 0 0 0 3px rgba(44,181,160,0.2);
}
.nbs-input:focus ~ .nbs-icon {
    color: var(--nbs-accent);
}

/* ── Spinner ───────────────────────────────────────────── */
.nbs-spinner {
    position: absolute;
    right: 48px;
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: var(--nbs-accent);
    border-radius: 50%;
    animation: nbs-spin 0.6s linear infinite;
    opacity: 0;
    transition: opacity var(--nbs-transition);
}
.nbs-spinner.active {
    opacity: 1;
}
@keyframes nbs-spin {
    to { transform: rotate(360deg); }
}

/* ── Clear button ──────────────────────────────────────── */
.nbs-clear {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--nbs-text-muted);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--nbs-transition), color var(--nbs-transition);
}
.nbs-clear.visible {
    opacity: 1;
    visibility: visible;
}
.nbs-clear:hover {
    color: #fff;
}

/* ── Results dropdown ──────────────────────────────────── */
.nbs-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--nbs-bg);
    border: 1px solid var(--nbs-border);
    border-radius: var(--nbs-radius);
    box-shadow: var(--nbs-shadow);
    max-height: 420px;
    overflow-y: auto;
    display: none;
    z-index: 10;
}
.nbs-results.open {
    display: block;
}

/* Scrollbar */
.nbs-results::-webkit-scrollbar { width: 6px; }
.nbs-results::-webkit-scrollbar-track { background: transparent; }
.nbs-results::-webkit-scrollbar-thumb {
    background: rgba(128,128,128,0.35);
    border-radius: 3px;
}

/* ── Single result item ────────────────────────────────── */
.nbs-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--nbs-text);
    border-bottom: 1px solid var(--nbs-border);
    transition: background var(--nbs-transition);
}
.nbs-item:last-child {
    border-bottom: none;
}
.nbs-item:hover,
.nbs-item.nbs-active {
    background: var(--nbs-bg-hover);
}

.nbs-item-thumb {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(128,128,128,0.15);
}

.nbs-item-info {
    flex: 1;
    min-width: 0;
}

.nbs-item-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--nbs-text);
}

.nbs-item-price {
    font-size: 13px;
    color: var(--nbs-accent);
    margin-top: 2px;
}
.nbs-item-price del {
    color: var(--nbs-text-muted);
    margin-right: 6px;
}
.nbs-item-price ins {
    text-decoration: none;
}

.nbs-item-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}
.nbs-badge-out {
    background: rgba(220,53,69,0.15);
    color: #f77;
}

/* ── No results / View all ─────────────────────────────── */
.nbs-no-results {
    padding: 20px 14px;
    text-align: center;
    color: var(--nbs-text-muted);
    font-size: 14px;
}

.nbs-view-all {
    display: block;
    padding: 12px 14px;
    text-align: center;
    color: var(--nbs-accent);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-top: 1px solid var(--nbs-border);
    transition: background var(--nbs-transition);
}
.nbs-view-all:hover {
    background: var(--nbs-bg-hover);
    color: var(--nbs-accent);
}

/* ── Keyboard shortcut hint ────────────────────────────── */
.nbs-hint {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--nbs-text-muted);
    background: rgba(128,128,128,0.15);
    padding: 2px 8px;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0.7;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 600px) {
    .nbs-overlay { padding-top: 6vh; }
    .nbs-overlay-inner { width: 94%; }
    .nbs-toggle {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }
    .nbs-toggle svg { width: 20px; height: 20px; }
    .nbs-input { font-size: 15px; padding: 12px 70px 12px 44px; }
    .nbs-results { max-height: 55vh; }
    .nbs-item-thumb { width: 42px; height: 42px; }
}

/* ── Inline variant (for shortcode in content) ─────────── */
.nbs-inline .nbs-results {
    position: relative;
    top: 0;
    margin-top: 6px;
}
