/* =============================================================
   Woosis Header Search  —  woosis-header-search.css  v2.0.0
   Loaded ONLY on pages that render [woosis_header_search].
   ============================================================= */

/* ── Wrapper ──────────────────────────────────────────────── */
.woosis-header-wrapper {
    position: relative;
    width: 100%;
    max-width: 350px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Search container (holds input + spinner) ─────────────── */
.woosis-search-container {
    position: relative;
    width: 100%;
}

/* ── Input ────────────────────────────────────────────────── */
.woosis-header-input {
    display: block;
    width: 100%;
    padding: 8px 34px 8px 12px; /* right room for spinner */
    font-size: 14px;
    line-height: 1.4;
    color: #1d2327;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    box-sizing: border-box;
    outline: none;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.woosis-header-input:focus {
    background: #fff;
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76,175,80,.15);
}

.woosis-header-input::placeholder {
    color: #888;
}

/* ── Spinner (CSS-only, inside input) ─────────────────────── */
.woosis-spinner {
    position: absolute;
    right: 10px;
    top: 50%;
    translate: 0 -50%;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: #4caf50;
    border-radius: 50%;
    animation: woosis-spin .6s linear infinite;
    pointer-events: none;
}

@keyframes woosis-spin {
    to { rotate: 1turn; }
}

/* ── Results dropdown ─────────────────────────────────────── */
.woosis-results {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 350px;
    max-height: 480px;
    overflow-y: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,.18);
    z-index: 999999;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f5f5f5;
    /* entry animation */
    animation: woosis-drop .2s ease;
}

@keyframes woosis-drop {
    from { opacity: 0; translate: 0 -8px; }
    to   { opacity: 1; translate: 0 0;    }
}

.woosis-results::-webkit-scrollbar        { width: 5px; }
.woosis-results::-webkit-scrollbar-track  { background: #f5f5f5; }
.woosis-results::-webkit-scrollbar-thumb  { background: #ccc; border-radius: 3px; }
.woosis-results::-webkit-scrollbar-thumb:hover { background: #999; }

/* ── Result item ──────────────────────────────────────────── */
.woosis-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
    transition: background .15s ease;
}

.woosis-item:last-child { border-bottom: none; }
.woosis-item:hover      { background: #f9f9f9; }

/* ── Thumbnail ────────────────────────────────────────────── */
.woosis-item img {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    background: #f0f0f0;
}

/* ── Item info ────────────────────────────────────────────── */
.woosis-item-info {
    flex: 1;
    min-width: 0;          /* allow text truncation */
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.woosis-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.woosis-item-price {
    font-size: 13px;
    font-weight: 600;
    color: #4caf50;
    line-height: 1.2;
}

.woosis-item-price ins   { text-decoration: none; }
.woosis-item-price del   { color: #999; font-weight: 400; font-size: 12px; margin-right: 4px; }

/* ── Stock status ─────────────────────────────────────────── */
.woosis-stock {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
}

.woosis-instock    { color: #46b450; }
.woosis-outofstock { color: #dc3232; }
.woosis-onbackorder{ color: #f56e28; }

/* ── Buttons ──────────────────────────────────────────────── */
.woosis-item-btns {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.woosis-btn {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity .15s ease;
    white-space: nowrap;
}

.woosis-btn:hover  { opacity: .85; }
.woosis-btn:active { opacity: .7;  }

.woosis-btn-add  { background: #4caf50; color: #fff; }
.woosis-btn-buy  { background: #FFA500; color: #fff; }

/* ── Empty / error ────────────────────────────────────────── */
.woosis-msg {
    padding: 18px;
    text-align: center;
    font-size: 13px;
    color: #666;
}

.woosis-msg--error { color: #dc3232; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .woosis-header-wrapper,
    .woosis-results { max-width: 100%; width: 100%; }
}

@media (max-width: 480px) {
    .woosis-item img          { width: 100px; height: 100px; }
    .woosis-item-name         { font-size: 13px; }
    .woosis-item-btns         { gap: 4px; }
    .woosis-btn               { padding: 3px 8px; font-size: 10px; }
}