/* ═══════════════════════════════════════════════
   Medic Supplier — Ajax Search Pro v2.0.0
   Colors: #3d82b8 · #6da66d · #1b2f42
   ═══════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

.medic-search-wrap {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    z-index: 999;
}

/* ══ SEARCH BAR ══════════════════════════════════ */
.medic-search-bar {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 2px solid #dde8f2;
    border-radius: 50px;
    transition: border-color 0.25s, box-shadow 0.25s;
    box-shadow: 0 4px 24px rgba(61,130,184,0.12), 0 1px 4px rgba(0,0,0,0.05);
    overflow: hidden;
}

.medic-search-bar:focus-within {
    border-color: #3d82b8;
    box-shadow: 0 6px 36px rgba(61,130,184,0.22), 0 1px 4px rgba(0,0,0,0.06);
}

/* ══ INPUT WRAPPER ══════════════════════════════ */
.medic-search-input-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
    display: flex;
    align-items: center;
}

/* ── Search icon ── */
.medic-search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #c0cfd8;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
    transition: color 0.22s;
    line-height: 1;
}

.medic-search-bar:focus-within .medic-search-icon {
    color: #3d82b8;
}

/* ── Input ── */
.medic-search-input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    font-weight: 400;
    color: #1b2f42;
    padding: 17px 52px 17px 52px;
    font-family: inherit;
    min-width: 0;
    line-height: 1.4;
    position: relative;
    z-index: 1;
}

.medic-search-input::placeholder {
    color: #b8cad8;
    font-weight: 400;
}

/* ── Spinner ── */
.medic-search-spinner {
    display: none;
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #dde8f0;
    border-top-color: #3d82b8;
    border-radius: 50%;
    animation: medic-spin 0.65s linear infinite;
    z-index: 2;
}

@keyframes medic-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* ── Clear (×) button ── */
.medic-search-clear {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: #eaf1f8;
    border: none;
    color: #7a8fa0;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 0;
    transition: background 0.18s, color 0.18s, transform 0.18s;
    z-index: 2;
    flex-shrink: 0;
}

.medic-search-clear:hover {
    background: #3d82b8;
    color: #fff;
    transform: translateY(-50%) scale(1.1);
}

/* ══ CATEGORY FILTER ════════════════════════════ */
.medic-search-cat-wrap {
    position: relative;
    border-left: 2px solid #e2eaf2;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    background: #f6f9fd;
    min-width: 155px;
}

.medic-search-cat {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    outline: none;
    padding: 0 36px 0 16px;
    height: 100%;
    min-height: 54px;
    font-size: 12px;
    font-weight: 700;
    color: #3d82b8;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    transition: color 0.18s;
}

.medic-search-cat:hover { color: #2d6fa3; }

.medic-cat-arrow {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-55%);
    color: #3d82b8;
    pointer-events: none;
    font-size: 12px;
    line-height: 1;
}

/* ══ SEARCH BUTTON ══════════════════════════════ */
.medic-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #3d82b8 0%, #2d70a8 100%);
    color: #fff;
    border: none;
    padding: 0 28px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.22s, box-shadow 0.22s, transform 0.15s;
    font-family: inherit;
    flex-shrink: 0;
    letter-spacing: 0.3px;
    border-radius: 0 48px 48px 0;
    min-height: 54px;
    position: relative;
    overflow: hidden;
}

.medic-search-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    pointer-events: none;
}

.medic-search-btn:hover {
    background: linear-gradient(135deg, #2d70a8 0%, #1e5a8e 100%);
    box-shadow: 0 6px 20px rgba(61,130,184,0.40);
}

.medic-search-btn:active { transform: scale(0.97); }

/* ══ DROPDOWN ═══════════════════════════════════ */
.medic-search-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid #e2eaf2;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(27,47,66,0.16), 0 4px 12px rgba(27,47,66,0.06);
    overflow: hidden;
    z-index: 99999;
    animation: medic-fadein 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes medic-fadein {
    from { opacity: 0; transform: translateY(-8px) scale(0.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ══ DROPDOWN HEADER ════════════════════════════ */
.medic-dropdown-header {
    padding: 10px 18px 8px;
    font-size: 10px;
    font-weight: 800;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    border-bottom: 1px solid #f0f5fa;
    background: linear-gradient(to right, #fafcff, #f8fdf8);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Clear Recent button (inside header) ── */
.medic-clear-recent {
    background: none;
    border: 1px solid #dde8f2;
    color: #9ca3af;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.6;
}

.medic-clear-recent:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* ══ RESULT ITEMS ═══════════════════════════════ */
.medic-result-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 18px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f0f5fa;
    transition: background 0.14s;
    cursor: pointer;
    outline: none;
}

.medic-result-item:last-of-type { border-bottom: none; }

.medic-result-item:hover,
.medic-result-item.is-focused {
    background: linear-gradient(to right, #f0f7ff, #f8fbff);
}

/* Product image */
.medic-result-img {
    position: relative;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #f0f5fb;
    border: 1.5px solid #e4edf5;
}

.medic-result-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.medic-result-item:hover .medic-result-img img {
    transform: scale(1.08);
}

.medic-sale-dot {
    position: absolute;
    top: 4px;
    left: 4px;
    background: linear-gradient(135deg, #6da66d, #5b9a5b);
    color: #fff;
    font-size: 8px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* Body */
.medic-result-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.medic-result-cat {
    font-size: 10px;
    font-weight: 700;
    color: #3d82b8;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    line-height: 1;
}

.medic-result-title {
    font-size: 14px;
    font-weight: 600;
    color: #1b2f42;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
}

.medic-result-title mark {
    background: linear-gradient(135deg, #fff0b3 0%, #ffe566 100%);
    color: inherit;
    border-radius: 3px;
    padding: 0 2px;
}

.medic-result-sku {
    font-size: 11px;
    color: #9ca3af;
}

/* ── Star Rating ── */
.medic-result-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.medic-result-stars {
    display: inline-flex;
    gap: 1px;
    line-height: 1;
}

.medic-star {
    font-size: 12px;
    line-height: 1;
}

.medic-star.full  { color: #f59e0b; }
.medic-star.half  { color: #f59e0b; opacity: 0.6; }
.medic-star.empty { color: #d1d9e0; }

.medic-rating-count {
    font-size: 11px;
    color: #9ca3af;
    line-height: 1;
}

/* ── Price + Stock Meta Row ── */
.medic-result-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1;
}

.medic-result-price {
    font-size: 13px;
    font-weight: 700;
    color: #6da66d;
    line-height: 1;
}

.medic-result-price del {
    color: #b0bec5;
    font-weight: 400;
    font-size: 11px;
    margin-right: 4px;
}
.medic-result-price ins { text-decoration: none; }

/* ── Stock Badges ── */
.medic-stock-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    line-height: 1.6;
}

.medic-stock-in {
    background: #d1fae5;
    color: #065f46;
}

.medic-stock-low {
    background: #fef3c7;
    color: #92400e;
}

.medic-stock-out {
    background: #fee2e2;
    color: #991b1b;
}

.medic-stock-back {
    background: #ede9fe;
    color: #5b21b6;
}

/* ── Post date ── */
.medic-result-date {
    font-size: 11px;
    color: #b0bec5;
    line-height: 1;
}

/* Arrow */
.medic-result-arrow {
    font-size: 22px;
    color: #dde8f2;
    flex-shrink: 0;
    transition: color 0.16s, transform 0.2s;
    line-height: 1;
}

.medic-result-item:hover .medic-result-arrow,
.medic-result-item.is-focused .medic-result-arrow {
    color: #3d82b8;
    transform: translateX(5px);
}

/* ══ NO RESULTS ════════════════════════════════ */
.medic-no-results {
    padding: 28px 24px 20px;
    text-align: center;
}

.medic-no-icon {
    font-size: 38px;
    display: block;
    margin-bottom: 10px;
}

.medic-no-results > p {
    margin: 0 0 4px;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.medic-no-results > small {
    font-size: 12px;
    color: #9ca3af;
}

/* No-results suggestion chips */
.medic-no-suggestions {
    margin-top: 16px;
    text-align: left;
}

.medic-no-suggest-label {
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 8px;
}

.medic-no-suggest-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.medic-suggest-chip {
    background: #eef5fd;
    color: #3d82b8;
    border: 1px solid #c8dcf0;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.16s, border-color 0.16s, transform 0.15s;
    font-family: inherit;
    user-select: none;
}

.medic-suggest-chip:hover {
    background: #3d82b8;
    color: #fff;
    border-color: #3d82b8;
    transform: scale(1.04);
}

/* ══ FOOTER / VIEW ALL ═════════════════════════ */
.medic-search-footer {
    border-top: 1.5px solid #eef3f8;
    background: linear-gradient(to right, #f4f9ff, #f5fbf5);
}

.medic-search-viewall {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 18px;
    font-size: 13px;
    font-weight: 700;
    color: #3d82b8;
    text-decoration: none;
    transition: background 0.16s, color 0.16s;
}

.medic-search-viewall svg { transition: transform 0.2s; }

.medic-search-viewall:hover {
    background: #e8f3fb;
    color: #2d6fa3;
}

.medic-search-viewall:hover svg { transform: translateX(4px); }

/* ══ POST ITEM ═════════════════════════════════ */
.medic-post-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef5fd, #e6f2ff);
}

.medic-post-cat {
    color: #6da66d !important;
}

.medic-result-excerpt {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.45;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
}

/* ══ TRENDING / SUGGESTION ITEMS ═══════════════ */
.medic-trending-item .medic-result-title,
.medic-suggestion-item .medic-result-title {
    font-weight: 500;
    color: #374151;
}

.medic-trend-icon {
    font-size: 14px;
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #eef5fd, #e6f2ff);
    border: 1.5px solid #dde9f6;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.medic-recent-icon {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-color: #bbf7d0;
}

/* ══ RESPONSIVE ════════════════════════════════ */
@media (max-width: 640px) {
    .medic-search-cat-wrap { display: none; }
    .medic-search-bar { border-radius: 14px; }
    .medic-search-btn {
        border-radius: 0 12px 12px 0;
        padding: 0 18px;
    }
    .medic-search-input { font-size: 14px; padding: 15px 48px 15px 48px; }
    .medic-search-icon { left: 16px; }
    .medic-search-dropdown { border-radius: 14px; }
    .medic-result-meta { flex-direction: column; align-items: flex-start; gap: 4px; }
}
