/* ======================================
   REEMCO SMART SEARCH BAR
   Premium AJAX search with live results
   ====================================== */

/* ── Container wrapper ────────────────── */
.rc-search-wrap {
    position: relative;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    z-index: 999;
}

/* ── Search form ──────────────────────── */
.rc-search-form {
    display: flex;
    align-items: center;
    background: #f4f5f7;
    border: 2px solid transparent;
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.rc-search-form:focus-within {
    background: #fff;
    border-color: #1B5E3B;
    box-shadow: 0 4px 20px rgba(27, 94, 59, 0.12);
}

/* ── Search input ─────────────────────── */
.rc-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Cairo', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: #1A1A2E;
    padding: 14px 20px;
    direction: rtl;
    text-align: right;
}

.rc-search-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* ── Voice button (decorative) ────────── */
.rc-search-voice-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.2s;
    font-size: 1rem;
    flex-shrink: 0;
}

.rc-search-voice-btn:hover {
    color: #1B5E3B;
}

/* ── Submit button ────────────────────── */
.rc-search-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: none;
    background: #1B5E3B;
    color: #fff;
    cursor: pointer;
    font-size: 1.05rem;
    flex-shrink: 0;
    border-radius: 12px;
    margin: 3px;
    transition: background 0.2s, transform 0.15s;
}

.rc-search-submit:hover {
    background: #143D2B;
    transform: scale(1.04);
}

/* ── Spinner inside submit ────────────── */
.rc-search-submit .fa-spinner {
    animation: rc-spin 0.8s linear infinite;
}

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

/* ══════════════════════════════════════
   LIVE RESULTS DROPDOWN
   ══════════════════════════════════════ */
.rc-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    max-height: 460px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    direction: rtl;
    scrollbar-width: thin;
    scrollbar-color: #C4A265 transparent;
}

.rc-search-results.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.rc-search-results::-webkit-scrollbar {
    width: 5px;
}

.rc-search-results::-webkit-scrollbar-thumb {
    background: #C4A265;
    border-radius: 10px;
}

/* ── Results header ───────────────────── */
.rc-search-results__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px 8px;
    border-bottom: 1px solid #f0f0f0;
}

.rc-search-results__header span {
    font-family: 'Cairo', sans-serif;
    font-size: 0.78rem;
    color: #9ca3af;
    font-weight: 500;
}

.rc-search-results__header strong {
    color: #1B5E3B;
    font-weight: 700;
}

/* ── Single result item ───────────────── */
.rc-search-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    text-decoration: none;
    transition: background 0.15s;
    border-bottom: 1px solid #f8f8f8;
}

.rc-search-item:hover {
    background: #f0f7f2;
}

.rc-search-item:last-child {
    border-bottom: none;
}

/* ── Product image ────────────────────── */
.rc-search-item__img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    background: #f4f5f7;
    border: 1px solid #eee;
    flex-shrink: 0;
}

/* ── Product info ─────────────────────── */
.rc-search-item__info {
    flex: 1;
    min-width: 0;
}

.rc-search-item__name {
    font-family: 'Cairo', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: #1A1A2E;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    line-height: 1.4;
}

.rc-search-item__cat {
    font-family: 'Cairo', sans-serif;
    font-size: 0.72rem;
    color: #9ca3af;
    margin-top: 2px;
}

/* ── Product price ────────────────────── */
.rc-search-item__price {
    font-family: 'Cairo', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: #1B5E3B;
    white-space: nowrap;
    flex-shrink: 0;
}

.rc-search-item__price del {
    color: #ccc;
    font-weight: 400;
    font-size: 0.75rem;
    margin-left: 4px;
}

.rc-search-item__price ins {
    text-decoration: none;
    color: #1B5E3B;
}

/* ── Sale badge in results ────────────── */
.rc-search-item__sale {
    display: inline-block;
    background: linear-gradient(135deg, #C4A265, #A88B4A);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
}

/* ── "View all" footer ────────────────── */
.rc-search-results__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    border-top: 1px solid #f0f0f0;
    text-decoration: none;
    font-family: 'Cairo', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: #C4A265;
    transition: color 0.2s, background 0.2s;
    border-radius: 0 0 16px 16px;
    gap: 6px;
}

.rc-search-results__footer:hover {
    color: #1B5E3B;
    background: #f0f7f2;
}

/* ── No results state ─────────────────── */
.rc-search-no-results {
    padding: 30px 18px;
    text-align: center;
    font-family: 'Cairo', sans-serif;
}

.rc-search-no-results__icon {
    font-size: 2rem;
    color: #ddd;
    margin-bottom: 10px;
}

.rc-search-no-results__text {
    font-size: 0.9rem;
    color: #999;
    font-weight: 500;
}

.rc-search-no-results__hint {
    font-size: 0.78rem;
    color: #bbb;
    margin-top: 6px;
}

/* ── Category pills in results ────────── */
.rc-search-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 18px;
    border-bottom: 1px solid #f0f0f0;
}

.rc-search-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 20px;
    background: #f0f7f2;
    color: #1B5E3B;
    font-family: 'Cairo', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.rc-search-cat-pill:hover {
    background: #1B5E3B;
    color: #fff;
}

.rc-search-cat-pill i {
    font-size: 0.65rem;
}

/* ══════════════════════════════════════
   HEADER INTEGRATION
   ══════════════════════════════════════ */

/* Desktop: search bar in header below nav */
.rc-header-search-row {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 10px 20px;
}

.rc-header-search-row .rc-search-wrap {
    max-width: 640px;
}

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */
@media (max-width: 768px) {
    .rc-search-wrap {
        max-width: 100%;
    }

    .rc-search-input {
        padding: 12px 14px;
        font-size: 0.88rem;
    }

    .rc-search-submit {
        width: 42px;
        height: 42px;
    }

    .rc-search-results {
        max-height: 380px;
        border-radius: 12px;
    }

    .rc-search-item {
        padding: 10px 14px;
        gap: 10px;
    }

    .rc-search-item__img {
        width: 46px;
        height: 46px;
    }

    .rc-search-cat-pill {
        font-size: 0.68rem;
        padding: 4px 10px;
    }

    .rc-header-search-row {
        padding: 8px 12px;
    }
}

/* ── Highlight matching text ──────────── */
.rc-search-highlight {
    background: rgba(196, 162, 101, 0.2);
    border-radius: 2px;
    padding: 0 1px;
}

/* ── Skeleton loading ─────────────────── */
.rc-search-skeleton {
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.rc-search-skeleton__img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: rc-shimmer 1.2s ease-in-out infinite;
    flex-shrink: 0;
}

.rc-search-skeleton__lines {
    flex: 1;
}

.rc-search-skeleton__line {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: rc-shimmer 1.2s ease-in-out infinite;
    margin-bottom: 8px;
}

.rc-search-skeleton__line:first-child {
    width: 75%;
}

.rc-search-skeleton__line:last-child {
    width: 40%;
    margin-bottom: 0;
}

@keyframes rc-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
