/* ============================================
   RM Search — Styles
   ============================================ */

.rm-search-wrap {
    position: relative;
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
        Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ---- Search bar (pill shape) ---- */
.rm-search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid #d1d5db;
    border-radius: 999px;
    padding: 14px 22px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rm-search-bar:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Magnifying glass icon */
.rm-search-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #9ca3af;
    margin-right: 12px;
    transition: color 0.2s ease;
}

.rm-search-bar:focus-within .rm-search-icon {
    color: #6b7280;
}

/* Input */
.rm-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: #1f2937;
    line-height: 1.4;
}

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

/* Loading spinner */
.rm-search-spinner {
    display: none;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-left: 10px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: rm-spin 0.6s linear infinite;
}

.rm-search-spinner.is-active {
    display: block;
}

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

/* ---- Results dropdown ---- */
.rm-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    max-height: 420px;
    overflow-y: auto;
    z-index: 9999;
    display: none;
    padding: 6px;
}

.rm-search-results.is-open {
    display: block;
}

/* Single result item */
.rm-search-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: #1f2937;
    transition: background-color 0.15s ease;
}

.rm-search-item:hover,
.rm-search-item:focus,
.rm-search-item.is-active {
    background-color: #f3f4f6;
    text-decoration: none;
    color: #1f2937;
}

/* Thumbnail */
.rm-search-thumb {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 10px;
    object-fit: cover;
    background-color: #f3f4f6;
}

/* Placeholder when no featured image */
.rm-search-thumb-placeholder {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #e0e7ff 0%, #dbeafe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rm-search-thumb-placeholder svg {
    width: 22px;
    height: 22px;
    color: #93a3b8;
}

/* Title */
.rm-search-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* No results message */
.rm-search-empty {
    padding: 24px 16px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* ---- Scrollbar ---- */
.rm-search-results::-webkit-scrollbar {
    width: 6px;
}

.rm-search-results::-webkit-scrollbar-track {
    background: transparent;
}

.rm-search-results::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .rm-search-bar {
        padding: 12px 18px;
    }

    .rm-search-input {
        font-size: 15px;
    }

    .rm-search-thumb,
    .rm-search-thumb-placeholder {
        width: 44px;
        height: 44px;
    }
}
